UM10413
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2011. All rights reserved.
User manual
Rev. 1 — 16 December 2011
232 of 268
NXP Semiconductors
UM10413
MPT612 User manual
25.10 IAP
commands
An In Application Programming routine must 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 must be able to hold all the results in case the number of results are more
than the 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 5, passed to the "Copy RAM to FLASH" command. The maximum number
of results is 2, returned by the "Blankcheck sector(s)" command. The command handler
sends the status code INVALID_COMMAND when an undefined command is received.
The IAP routine resides at 0x7FFF FFF0 location and is Thumb code.
The IAP function can 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[2];
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;
Setting function pointer:
14
ADDR_NOT_MAPPED
address is not mapped in the memory map. Count
value is considered 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
CODE_READ_PROTECTION_
ENABLED
code read protection enabled
Table 230. ISP Return codes summary
…continued
Return
code
Mnemonic
Description