UM10503
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2012. All rights reserved.
User manual
Rev. 1.3 — 6 July 2012
1186 of 1269
NXP Semiconductors
UM10503
Chapter 46: LPC43xx flash programming/ISP and IAP
46.8 IAP commands
Remark:
Some IAP commands are supported for parts with on-chip flash only.
For in-application programming, call the IAP routine with a word pointer in register r0
pointing to memory (RAM) containing command code and parameters. The result of the
IAP command is returned in the result table pointed to by register r1. You 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 the number of results
are more than number of parameters. Parameter passing is illustrated in
. The
number of parameters and results vary according to the IAP command. The maximum
number of parameters is 4, passed to the "Copy RAM to Flash" command. The maximum
number of results is 4, returned by the "Read device serial number" command. The
command handler sends the status code INVALID_COMMAND when an undefined
command is received.
In C code, call the IAP function in the following:
1. Extract the IAP location entry point. The IAP location entry point is the main API entry
point 0x1040 0100 + 0x000.
2. Define data structure or pointers to pass the IAP command table and result table to
the IAP function:
unsigned long command[6]; unsigned long result[5];
or
command=(unsigned long *) 0x...; result= (unsigned long *) 0x...
3. Define a 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:
#define IAP_LOCATION *(volatile unsigned int *)(0x104000100);
t ypedef void (*IAP)(unsigned int [],unsigned int[]);
Fig 176. IAP parameter passing
COMMAND CODE
PARAMETER 1
PARAMETER 2
PARAMETER n
STATUS CODE
RESULT 1
RESULT 2
RESULT n
command
parameter table
command
result table
ARM REGISTER r0
ARM REGISTER r1