Keil Logo

ARM: Verify Errors when Flashing NXP LPC Device with ST-Link


Information in this knowledgebase article applies to:

  • Keil MDK
  • NXP LPC device
  • ST-Link and possibly other 3rd party adapters

SYMPTOM

I'm using an NXP LPC device and try to download the software with the ST-LINK debug adapter. In the beginning, everything seems to be fine, but at the end, some content is not fitting:

Erase Done.
Programming Done.
Contents mismatch at: 0000001CH  (Flash=4FH  Required=00H) !
Contents mismatch at: 0000001DH  (Flash=EFH  Required=00H) !
Contents mismatch at: 0000001EH  (Flash=FFH  Required=00H) !
Contents mismatch at: 0000001FH  (Flash=EFH  Required=00H) !
Verify Failed!

What is the problem here?

CAUSE

For many NXP LPC devices, the exception vector location 7 (offset 0x0000001C in the vector table) contains the 2’s complement of the checksum of table entries 0 through 6. This is a very NXP specific feature. The flashloader generates this checksum on the fly while programming. This causes the flashed content to be actually different at those locations compared to the programmed image. So, it is normal, that the ST-Link driver, that will never be aware of that, reports verify errors.

RESOLUTION

The are two primary resolutions.

  1. Use a J-Link or ULINK debug adapter: Debug drivers for µVision created by Keil (for the ULINK family, CMSIS-DAP and J-Link) take care and also calculate the checksum when verifying NXP LPC devices. So, for example, using a ULINK unit would help.
  2. Use the Signature Creator: Update the checksum in the image before flashing. The ElfDWT tool can be used for this.
    • Project -> Options For Target -> Output tab, uncheck Create hex file.
    • On the User tab, after the After Build/Rebuild row:
    • For Run #1:
      • C:\Keil_v5\ARM\BIN\ElfDwT.exe !L
    • For Run #2:
      • C:\Keil_v5\ARM\ARMCC\bin\fromelf.exe --i32combined -o !H !L
    • Make sure to checkboxes are checked.
    • Press "OK" to close.

Flashing the resulting image should not give verify errors. Note: these commands use Key Sequences for Tool Parameters.

MORE INFORMATION

Last Reviewed: Thursday, November 12, 2020


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.