11 months, 3 weeks ago.

Programming MBED-based binary on LPCXpresso 54114 without LPC-Link 2 interface

Dear all,

For a project, i am developing using MBED for a NXP LPC54114 MCU. I am able to download MBED-based binaries on the LPCXpresso 54114 evaluation board (after updating the firmware of the on-board Link2 probe based on the LPC43xx).

However, my code will finally be deployed on a custom board that includes the LPC54114 but not the LPC43xx. So, i have tried downloading some code on the target without using the Link2 probe, but i didn't succeed.

More specifically, I am trying to download a simple "blinky LED" example following these steps:

1. I reset my board while holding switch ISP0 to boot in "USB Mass Storage" mode.

2. Doing that, the "CRP_DISABLD" volume is automatically mounted on my system, and contains a "firmware.bin" file.

3. I delete the old firmware.bin and copy the new binary generated by MBED CLI on the volume (after renaming it to "firmware.bin" as well).

4. I unplug/safely disconnect/reset the board (i tried all three ways) and restart it.

However, the downloading clearly fails as the board restarts in "USB Mass Storage" mode again.

Notice that, following exactly the same method, i am able to download a similar blink LED example compiled within the original "LPCXpresso IDE" library, without using MBED.

So, the problem is definitely related to the compilation performed by MBED CLI. However, i don't know what i should change in my compilation options (mbed_app.json, targets.json, etc.) to make it work. Do you have any suggestion?

Thanks in advance.

Daniele

Question relating to:

NXP
NXP is a leading semiconductor company founded by Philips more than 50 years ago.

Nevermind, i solved the problem myself.

For future memory, the reason is the following. When downloading code using ISP mode, the bootloader checks the validity of the loaded image by computing the checksum of the first 7 vector table entries, and comparing it with the 8-th entry, as specified in the User Manual: https://www.nxp.com/docs/en/user-guide/UM10914.pdf

However, MBED's linker scripts leaves the 8-th entry fixed at all zeros, as you can see in the startup file: https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC54114/device/TARGET_LPC54114_M4/TOOLCHAIN_GCC_ARM/startup_LPC54114_cm4.S

When code is downloaded through the on-board debugger, the latter adds the checksum, so that's why MBED code was working in that case.

Currently, i solved the problem using the "checksum" binary utility, provided by NXP within the MCUXpresso suite, which can add the required checksum to a pre-compiled ".bin" file, as explained in this guide: https://community.nxp.com/thread/389046

Specifically, the command i used is the following: checksum -p LPC54114 -d firmware.bin;

After doing that, ISP mode works perfectly.

I am surprised that the checksum is not directly added during MBED compilation (through the linker script). Anyway, i'm glad the problem was solved.

posted by Daniele Jahier Pagliari 03 Oct 2018
Comment on this question
Be the first to answer this question.

You need to log in to post a question