mbed with flash bootloader

06 Jul 2015

Hello,

I have somewhat an interesting conundrum. After prototyping a product with a Freedom kl25z board using mbed a custom board was developed based on the same micro.

Now I want to offer my customer the ability to do in the field upgrades. Currently I'm trying to make the official Freescale bootloader work. In my opinion this isn't ideal for several reasons.

- USB support is based on using the in-built HID device drivers in Windows/Linux but this is quite slow for flashing. - USB MSD disk is not supported (yet) - The code is currently IAR only (and I'm using GNU GCC)

But due to time pressure this is currently the way to go.

After a lot of work and debugging I found the official mbed (exported to GNU GCC) code is not exactly ready to be used with a flash bootloader. The linker script is quite easily edited but there are some hardcoded references ie in cmsis_nvic.cpp which do not look at the linker file for the start of the ISR vector (but rather take it as default 0x0000). Since this file is exported as a compiled object file (.o) it took me quite a long time to figure this out and I kept wondering why my program was suddenly crashing when using an interrupt!

Even now, my mbed program hangs on the wait() function when it is located at an offset in flash memory (haven't figured out why yet)

Wouldn't it be a worthwhile idea to make mbed compatible with a flash resident bootloader by avoiding hard references? Or maybe even make an mbed based flash resident bootloader for finished products?

03 Sep 2015

I have the same problem. My program hangs on the wait() function when running by a flash-resident bootloader.

It seems the program hangs on Timer initialization, more specifically on lptmr_init() function at us_ticker.c file.