EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

IAP (In Application Programming ) LPC2378

Started by torben1962 January 30, 2009
Hello!

I'm reading about IAP programming of LPC2378 and found following in
User manual:

http://www.nxp.com/acrobat_download/usermanuals/UM10211_1.pdf

On page 588 is written:,
...
3.2.7 Interrupts during IAP
The on-chip flash memory is not accessible during erase/write
operations. When the user application code starts executing the
interrupt vectors from the user flash area are active.

The user should either disable interrupts, or ensure that user
interrupt vectors are active in RAM and that the interrupt handlers
reside in RAM, before making a flash erase/write IAP call. The IAP
code does not use or disable interrupts.

3.2.9 RAM used by IAP command handler
Flash programming commands use the top 32 bytes of on-chip RAM. The
maximum stack usage in the user allocated stack space is 128 bytes
and it grows downwards.
...

On page 601 is written,
...
The flash memory is not accessible during a write or erase operation.
IAP commands, which results in a flash write/erase operation, use 32
bytes of space in the top portion of the on-chip RAM for execution.
The user program should not be use this space if IAP flash
programming is permitted in the application.
...

My question is:
Because of the flash is not accessible during erase/write operations
- is it then neccessary to move my code to RAM before calling the IAP
command or is it only ment with respect to interrupt vector and
interrupt service rutines ?

Kind regards
Torben W. Hansen

An Engineer's Guide to the LPC2100 Series

--- In l..., "torben1962" wrote:
>
> Hello!
>
> I'm reading about IAP programming of LPC2378 and found following in
> User manual:
>
> http://www.nxp.com/acrobat_download/usermanuals/UM10211_1.pdf
>
> On page 588 is written:,
> ...
> 3.2.7 Interrupts during IAP
> The on-chip flash memory is not accessible during erase/write
> operations. When the user application code starts executing the
> interrupt vectors from the user flash area are active.
>
> The user should either disable interrupts, or ensure that user
> interrupt vectors are active in RAM and that the interrupt handlers
> reside in RAM, before making a flash erase/write IAP call. The IAP
> code does not use or disable interrupts.
>
> 3.2.9 RAM used by IAP command handler
> Flash programming commands use the top 32 bytes of on-chip RAM. The
> maximum stack usage in the user allocated stack space is 128 bytes
> and it grows downwards.
> ...
>
> On page 601 is written,
> ...
> The flash memory is not accessible during a write or erase operation.
> IAP commands, which results in a flash write/erase operation, use 32
> bytes of space in the top portion of the on-chip RAM for execution.
> The user program should not be use this space if IAP flash
> programming is permitted in the application.
> ...
>
> My question is:
> Because of the flash is not accessible during erase/write operations
> - is it then neccessary to move my code to RAM before calling the IAP
> command or is it only ment with respect to interrupt vector and
> interrupt service rutines ?
>
>
> Kind regards
> Torben W. Hansen

Only interrupt vectors, interrupts service routines, and anything that
the ISRs might access from flash (constants, library functions, etc).

Hi,

yes, any code executed during IAP must not be run from FLASH.

Foltos

torben1962 wrote:
> Hello!
>
> I'm reading about IAP programming of LPC2378 and found following in
> User manual:
>
> http://www.nxp.com/acrobat_download/usermanuals/UM10211_1.pdf
>
> On page 588 is written:,
> ...
> 3.2.7 Interrupts during IAP
> The on-chip flash memory is not accessible during erase/write
> operations. When the user application code starts executing the
> interrupt vectors from the user flash area are active.
>
> The user should either disable interrupts, or ensure that user
> interrupt vectors are active in RAM and that the interrupt handlers
> reside in RAM, before making a flash erase/write IAP call. The IAP
> code does not use or disable interrupts.
>
> 3.2.9 RAM used by IAP command handler
> Flash programming commands use the top 32 bytes of on-chip RAM. The
> maximum stack usage in the user allocated stack space is 128 bytes
> and it grows downwards.
> ...
>
> On page 601 is written,
> ...
> The flash memory is not accessible during a write or erase operation.
> IAP commands, which results in a flash write/erase operation, use 32
> bytes of space in the top portion of the on-chip RAM for execution.
> The user program should not be use this space if IAP flash
> programming is permitted in the application.
> ...
>
> My question is:
> Because of the flash is not accessible during erase/write operations
> - is it then neccessary to move my code to RAM before calling the IAP
> command or is it only ment with respect to interrupt vector and
> interrupt service rutines ?
>
>
> Kind regards
> Torben W. Hansen
>
>
> ...
>
> My question is:
> Because of the flash is not accessible during erase/write operations
> - is it then neccessary to move my code to RAM before calling the IAP
> command or is it only ment with respect to interrupt vector and
> interrupt service rutines ?
>
>
> Kind regards
> Torben W. Hansen
>

OK and thanks for the feedback. I have now tried to use IAP according
to your comfirms - It works perfectly - super!

Kind regards
Torben W. Hansen

Only code that executes as a result of interrupt handling must also reside in RAM during
IAP, alongside with interrupt vectors.
Code that is never executed on interrupt may be left in flash.
If using an RTOS the context switch routine (and its call graph) should be in RAM. This
may be difficult to ascertain. Also make sure to use a critical section around the IAP call
then.

I wish the flash programming procedure (the real one not the IAP) was made public.

--
Serge Zloto

--- In l..., "torben1962" wrote:

> My question is:
> Because of the flash is not accessible during erase/write operations
> - is it then neccessary to move my code to RAM before calling the IAP
> command or is it only ment with respect to interrupt vector and
> interrupt service rutines ?
>
>
> Kind regards
> Torben W. Hansen
>


The 2024 Embedded Online Conference