MOTOROLA
Appendix D. User-Callable DINK Functions
For More Information On This Product,
Go to: www.freescale.com
D-5
Error Conditions
The simple steps for using these dynamic addresses are:
1. Use DINK32 V11.1 or later.
2. Use #define for local functions that you wish to connect to the DINK32 functions
example: #define printf dink_printf
3. The first executable statement in your C code must be: set_up_transfer_base();
4. Now whenever your program calls one of these functions, such as printf, it will
transfer control to the equivalent DINK32 function.
5. Or, whenver your program needs the value of a DINK32 global value defined in the
table, call the associated get function in dinkusr.s.
D.5
Error Conditions
The only error condition is a trapword exception, which indicates that the
dink_transfer_table address is zero. This is caused by one of the following conditions:
1. The user has not called set_up_transfer_base()
2. R21 is getting trashed before set_up_transfer_base() is called.
3. The DINK32 version does not support dynamic functions. DINK32 V11.0.2 was
the last version that DID NOT support this feature. Ensure that you are using
DINK32 V12.0 or greater.
D.6
Alternative Method for Metaware Only
While printf is fairly straightforward, scanf is more complex. In the drystone directory, a
local copy of scanf is supplied in the file, support.c. Scanf and printf can also be emulated
in a simpler program when using the metaware compiler. Two metaware functions are
supplied to the user to give control to characters that are scanned into and out of the
smp_release_cpu
holds jump address for this cpu
read_pid
read the PID of this CPU
memSize
returns the size of memory
memCL
memory burst rates
NULL
unused
board_ctl
Various control featers of the board
cpu_info
CPU information like the name, cache sizes, altivect.
mach_info
Board information like the BoardID, ports, io drivers.
Table D-2. dinkusr.s Functions (continued)
Function Name
Function Definition
F
Freescale Semiconductor, Inc.
n
.