5 years, 5 months ago.

Bootloader for K64f using IAP

Hello. I would need help with developing a bootloader for K64f. I have written a small bootloader which reads a binary file from serial port, and program it in the flash using the FreescaleIAP utilities. This is the easy part. The problem is, I want my bootloader stays at the beginning of the flash, from 0x00000 to 0x20000, and the binary file to be flashed starting from 0x20000. The binary file obviously is the application. How should I change my application in order to make it bootable from 0x20000? I mean, the bootloader, at some point should jump to 0x20000 and start the application, but I imagine this should be compiled a way that it starts from 0x20000 and not from 0x00000 as expected. How should I do that with mbed os? Please note, I have experience of firmware using Keil IDE, and I have already done this kind of things. In Keil I set the iROM1 parameter to a different location, and take care of the interrupts vector, and it all works fine. But I don't know at all how to do that in mbed os environment. Does someone do know how to do it? Thank you :)

Davide

1 Answer

5 years, 5 months ago.

Hello Davide,

You can find an example of mbed bootloader which meets your needs here :

  • The bootloader stays at beginning of the Flash, from 0x00000 to 0x20000
  • The application will start from 0x20000
  • Once the bootloader has finished flashing the application program it can start the main program by making a call to the function

mbed_start_application(0x20000);

Accepted Answer

Hi Zoltan. Thank you very much, I googled but I couldn't find that. It looks very close to what I needed. Just a question: the application, shouldn't it be compiled specifying a different ROM offset? I mean, shouldn't I perhaps compile it modifying the start-up file? (that one in mbed-os/targets/TARGETS_Freescale/...../device). Thank you

Davide

posted by Davide Longo 24 Oct 2018

I think you actually instruct mbed to take care about the application's offset when specifying path to the padded bootloader binary in the mbed_app.json file (see step #1 and #2 in "Building the application with the bootloader" section).

posted by Zoltan Hudak 24 Oct 2018

Indeed, offsets are automatically set.

I tried to implement that solution, but when the bootloader jumps to the application I can see again the bootloader starts-up. I mean, it seems like the bootloader reboots.

What can be the problem?

Thanks!

posted by Davide Longo 24 Oct 2018

I found the trick.

It couldn't boot the application because I added the header section. Without header, it works fine. Now, I am not sure I need the header section, so it's ok like this.

Thank you very much for your support!

Davide

posted by Davide Longo 24 Oct 2018