Download AT91 ISP/SAM-BA User Guide

Transcript
SAM-BA Customization
Figure 4-6.
Applet Mapping
SDRAM
isp_cstartup.S
0x2000_0000 Jump Instrauction to 0x2000_0084
0x2000_0004 Argument area 4x32 bytes
...
0x2000_0084
Stack initialization
C variables initialization
Branch to the main
Return to the ROM monitor
main.c
main()
{
unsigned int *pArgument = (unsigned int *) 0x2000_0004;
switch (pArgument[0]) {
case INIT:
case WRITE:
}
// Update Command state
pArgument[0] = ~pArgument[0];
// Update Command Status
pArgument[1] = result;
}
end Payload Buffer
End of SDRAM Stack
The 32 4-byte words mailbox definition must be shared between the applet and the host application. By
default, the first word of the mailbox initialized by the host application corresponds to the applet function
ID. The first word of the mailbox set by the applet corresponds to the logical inversion of the function ID.
The other words may be used as applet function arguments. The first word is used by the application to
determine that the applet function is achieved. The second word of the mailbox set by the applet corresponds to the result of the applet function. Other words can be used as values returned by the applet
function.
Memory space located after the applet binary code can be used as a dedicated area to store buffer payloads received in Boot ROM mode and programmed in the media by the applet. A good practice is to
implement an applet INIT function which returns the address of this memory space.
AT91 ISP/SAM-BA User Guide
4-13
6421B–ATARM–06-Jan-10