Iap commands – NXP Semiconductors LPC24XX UM10237 User Manual

Page 706

Advertising
background image

UM10237_4

© NXP B.V. 2009. All rights reserved.

User manual

Rev. 04 — 26 August 2009

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

Figure 31–143

. 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 642. ISP Return Codes Summary

Return
Code

Mnemonic

Description

Advertising