MOTOROLA
Appendix D. User-Callable DINK Functions
For More Information On This Product,
Go to: www.freescale.com
D-1
Appendix D
User-Callable DINK Functions
D.1
General Information
Many library functions such as printf() and memSpeed() are available via the DINK32
debugger. In the past, it has been necessary to ascertain the address of these functions,
which change with each compile, from the cross reference listing, and statically set these
addresses in the programs that used these features. The demo and dhrystone directories
included with the DINK32 distribution contained examples of how to set these static
function addresses. With the release of DINK32 V11.1 and V12.0, these addresses are now
dynamically ascertained and the user only need call a few functions and set up some
#defines. This technique is described in this appendix. Users with access to the entire
DINK32 source base can modify or add DINK32 functions. DINK32 global variables can
also be ascertained from this table. R12.1 includes the two global variables, memSpeed,
and process_type.
D.2
Methodology and Implementation
This method is implemented with a static structure that is filled with the current functions
address during link time. The table is allocated in the file par_tb.c. Only users with access
to this file can change the contents of the table, thereby, determining which DINK32
functions are available. par_tb.c is only available via the motorola sales office, it is not
included on the web site. However, all users can use the technique for linking their code
with the these DINK32 functions.
The structure is defined in dink.h as dink_exports
//---------------------------------------------------------------------------
// Transfer vector -- table of pointers to useful functions within DINK,
// callable through R21.
//---------------------------------------------------------------------------
typedef struct {
int version;
unsigned long *keyboard;
int (*printf)(const char*,...);
int (*dink_loop)();
unsigned int (*is_char_in_duart)(); // 16
/* 0 */
/* 4 */
/* 8 */
// 12
F
Freescale Semiconductor, Inc.
n
.