Keil Logo

ARM: LPCxxxx: flashing application breaks custom bootloader


Information in this knowledgebase article applies to:

  • MDK-ARM and NXP LPCxxxx devices

SYMPTOM

For my project based on an NXP LPCxxxx device I have developed a custom bootloader that starts the application program. The start address of the application was moved accordingly to not conflict with the bootloader area. And when I flash the application before the bootloader, the system starts as expected. The problem is that the boot process fails when the bootloader is flashed before the application. What is the reason for this?

CAUSE

One possible reason is, that the default startup file shipped with MDK-ARM or the device family pack, e. g. startup_LPC17xx.s, will place the Code Read Protection (CRP) at the required absolute address in the image. For more detail about the CRP, see the device manual.
However, in the startup file you should find code like this:

                IF      :LNOT::DEF:NO_CRP
                AREA    |.ARM.__at_0x02FC|, CODE, READONLY
CRP_Key         DCD     0xFFFFFFFF
                ENDIF

Even if the base address for the application image was moved, this CRP object is still output at this absolute address. If then such an application image is flashed to its moved address, this CRP object will also be flashed causing the flash sector it is in to be erased as well. This also erases parts of the previously flashed bootloader, which is the reason for the boot failure.

RESOLUTION

The creation of the CRP value needs to be prevented in this case. This can be done by adding NO_CRP in Options for Target ... -> Conditional Assembly Control Symbols -> Asm -> Define.

MORE INFORMATION

Last Reviewed: Tuesday, April 4, 2017


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.