Nxp Semiconductors UM10237 用户手册

下载
页码 792
UM10237_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 19 December 2008 
706 of 792
NXP Semiconductors
UM10237
Chapter 31: LPC24XX On-chip bootloader for flashless parts
7.
IAP commands
For in application programming the IAP routine should be called with a word pointer in 
register r0 pointing to memory (RAM) containing command code and parameters. Result 
of the IAP command is returned in the result table pointed to by register r1. The user can 
reuse the command table for result by passing the same pointer in registers r0 and r1. The 
parameter table should be big enough to hold all the results in case if number of results 
are more than number of parameters. Parameter passing is illustrated in the 
The number of parameters and results vary according to the IAP 
command. The maximum number of parameters is 3, passed to the "Compare" command. 
The maximum number of results is 1, returned by all three available IAP commands. The 
command handler sends the status code INVALID_COMMAND when an undefined 
command is received. The IAP routine resides at 0x7FFF FFF0 location and it is thumb 
code.
The IAP function could be called in the following way using C.
Define the IAP location entry point. Since the 0th bit of the IAP location is set there will be 
a change to Thumb instruction set when the program counter branches to this address.
#define IAP_LOCATION 0x7ffffff1
Define data structure or pointers to pass IAP command table and result table to the IAP 
function:
unsigned long command[5];
unsigned long result[3];
or
unsigned long * command;
unsigned long * result;
command=(unsigned long *) 0x……
result= (unsigned long *) 0x……
Define pointer to function type, which takes two parameters and returns void. Note the IAP 
returns the result with the base address of the table residing in R1.
typedef void (*IAP)(unsigned int [],unsigned int[]);
IAP iap_entry;
14
ADDR_NOT_MAPPED
Address is not mapped in the memory map. Count 
value is taken in to consideration where applicable.
15
CMD_LOCKED
Command is locked.
16
INVALID_CODE
Unlock code is invalid.
17
INVALID_BAUD_RATE
Invalid baud rate setting.
18
INVALID_STOP_BIT
Invalid stop bit setting.
19
-
not used
Table 643. ISP Return Codes Summary
Return 
Code
Mnemonic
Description