9 years, 11 months ago.

Developing bootloader on mbed board

I'm new to the mbed world, sorry for my basic question. I need to prototype a circuit with both a user program and a bootloader and I'm looking for the fastest and easiest way to develop all on the same board. No doubt mbed meets my requirements for user program, but what about bootloader? Looking at the LPC1768 pinout, pin 98 and 99 are system UART0 used for flash programming, but they're not accessible on mbed board, so it's impossible to use an external FTDI programmer. Mbed magic chip flashes at location 0 of the flash memory: may mbed USB interface be used to flash a bootloader like other user program? I already know that bootloader must be compiled with an external toolchain/IDE

Thanks

1 Answer

9 years, 11 months ago.

Problem with the mbed LPC1768 is that as soon as it thinks anything new is on the flash drive it will program that, and erase everything else. That might not be great for most purposes.

Flashing in a bootloader vs regular drag and drop programming shouldn't be an issue. After that that bootloader could flash in your user program, although as said, if the interface chip sees something new it will overwrite your old program (I don't think it does it when nothing is changed and only power is cycled, but don't pin me on that).

Pins 98 and 99 are not accessible via FTDI, but they are connected to the interface IC which also performs the USB <> Serial conversion, so it should work to use flashmagic on it. I also think compiling the bootloader via mbed compiler should work fine. Only compiling user program won't work via the online compiler with normal settings, since it needs an offset.

Accepted Answer

Thanks for your answer. I think there's another problem: pin 2[10], needed to enter in ISP mode, is not accessible. So I think is impossible to flash bootloader with flash magic.

posted by Riccardo Pellegrini 23 Aug 2014

That would indeed be a problem. But for just flashing the bootloader the regular programming situation should work fine. It also depends on in what way you'd like to reprogram your device, and what your final product/device is goign to be. If it will include a complete mbed, there are some examples on self-programming by writing a new bin file to the LocalFileSystem. If not you might consider getting in addition one of the other LPC1768 boards where you have access to more pins.

posted by Erik - 23 Aug 2014

Thank you. So I need only a confirmation: can I use mbed usb device to flash a bootloader?

posted by Riccardo Pellegrini 25 Aug 2014

Well I have not done it myself so cannot give a 100% guaranteed response, but I don't see why not. The bootloader (assuming you put it at the beginning of the flash, which is the normal place) has no offsets or similar things which need to be taken into account. And I have once made a self destruct program, which erased its own flash. So that indicates that there is no write protection for flash sectors enabled.

posted by Erik - 25 Aug 2014

Thank you so much

posted by Riccardo Pellegrini 25 Aug 2014