Flash Magic Forum

In-System Programming Support => ARM Cortex => Topic started by: Werner on June 14, 2023, 06:44:34 AM

Title: LPC1853 ISP, Memory Location at 0x001C Corrupted on Non-Activated Flash Bank
Post by: Werner on June 14, 2023, 06:44:34 AM
Hi all,

I found that the current version of FlashMagic (V13.50) corrupts location 0x001C on bank B if "Activate Bank A" is checked. FlashMagic erases the chosen Flash blocks, then programs bank A, then programs bank B and then sends the ISP command to activate bank A. According to the NXP user manual this ISP activation command generates and writes the correct vector table checksum on location 0x001C for bank A and at the same time writes an invalid checksum (in fact 0x00000000) on location 0x001C on bank B. Dependant on what code is located at 0x001C this leads to the program to behave falsely or even crash.
Actually this is not a fault in FlashMagic itself, rather a bug in the design of the ISP command, but FlashMagic should work around it.
I suggest Flashmagic to change the order of operation: Erase the chosen sectors on the bank to be activated, program the bank to be activated, activate the bank, erase the chosen sectors on the other bank, program the other bank.

With older versions of FlashMagic (V9.80) one has to execute FlashMagic twice. One instance set to bank A and bank activation checked, the other instance set to bank B and bank activation unchecked. This process avoids corrupting the non-activated Flash bank and has worked fine for me.
Surprisingly neither version 13.50 nor version 9.80 shows an error when the corrupted code is verified. Obviously code location 0x001C is spared for verification on both banks.

Best regards
Werner
Title: Re: LPC1853 ISP, Memory Location at 0x001C Corrupted on Non-Activated Flash Bank
Post by: Andy Ayre on July 10, 2023, 02:40:15 PM
There should never be code located at 0x001C - it is reserved for the checksum. If your code is using it then you need to add a directive to reserve it. Andy