bug loading mbed firmware on FRDM-KL25Z w/ reproduction instructions & solution

08 Aug 2013

There is a bug in the MBED firmware for the FRDM-KL25Z that can prevent the firmware being loaded depending on what application was installed on the FRDM prior to attempting to load the mbed firmware. This could possibly be the result of a use-before-initialize bug or some other bug in the mbed firmware. Tested on Windows XP SP3.

The referenced led_toggle_flash.bin program is a simple LED blink program compiled using GCC ARM, following this guide.

pwm_led.srec is part of the FRDM-KL25Z_QSP quickstart package provided by Freescale.

To reproduce:

  1. Update the mbed bootloader to the latest version (use PEMicro OpenSDA Firmware Apps package).
  2. Load the latest FRDM-KL25Z firmware from PEMicro (v112) (use PEMicro OpenSDA Firmware Apps package).
  3. Load the attached led_toggle_flash.bin program onto the FRDM-KL25Z. /media/uploads/jeady/led_toggle_flash.bin
  4. Attempt to load the mbed firmware onto the FRDM-KL25Z.
  5. The mbed drive does not show up on board restart.

To restore the mbed firmware after this:

  1. Restore PEMicro firmware v112.
  2. Load the attached pwm_led.srec program to the FRDM-KL25Z. /media/uploads/jeady/pwm_led.srec
  3. Load the mbed firmware.
  4. The mbed drive successfully shows up.

Cheers,

James Eady

08 Aug 2013

Hello james eady,

are you sure it's a bug, not user's application fault? I reviewed your led toggle flash bin, it definitely locks the chips flash. I had really similar problem with locking a chip with binary file while I was porting KL25Z to GCC on mbed. Therefore I don't advise anybody to upload your binary file :-)

Please verify this behaviour with setting properly flash protection registers at address 0x400.

Regards, 0xc0170

08 Aug 2013

That explanation makes sense. I was trying to get GCC working with the FRDM, whether it was with mbed or not, and that was the example program provided by the blog I was using as reference. I'm glad to know what the actual issue was though :)

However, this still seems like a bug to me - the PEMicro firmware has no problem being loaded after a bad application, but the mbed firmware does not load. So based on what you are saying, I would guess that the PEMicro firmware unlocks the flash on load but the mbed firmware does not. Even if you upload a bad application, you should be able to reflash with new firmware to restore the device to a good setting - which is possible with the PEMicro firmware but not the mbed firmware. There are actually several threads with people who are having trouble loading the mbed firmware, and this could be a fix for all of those people who are not going to be able to figure out that the chip flash is locked.

Thanks for taking a look! James