Electronic – ARM Cortex M software update via bootloader

armbootloadercortex-m4

I wish to update the software running on a node having a ARM Cortex M4 MCU.

to do so, I understand I will have to run a bootloader in my TI ARM Cortex M4 development board that can receive a binary file over-the-air and program certain section of flash. I understand the functionality of receiving binary file over-the-air will have to be added to this bootloader.

This sounds all correct but I do not understand how this can be achieved. How is it possible that I program parts of the flash in the MCU by the same MCU itself?

Do I need additional hardware to do update software running on my node? All I want to do it to update the software running on my node over-the-air. A bin fine can be downloaded over HSDPA. For easy testing I can do this over Ethernet.

I would so much appreciate if someone can elaborate how this process is done in a more detailed format for me to understand the procedure. Thank you very much.

Best Answer

In fact it's quite easy - there are multiple methods. I outlined one in this thread.

Basically you will have two separate pieces of software running. Consider the following setup (it's just an example):

  • Bootloader (Flash address 0x0000 - 0x1000)
  • Application (Flash address 0x1000 - 0x2000)

(of course, those are dependent on your requirements)

Now, the application will download the binary (we'll call it FW 2.0). It will set some special bit in your controller and perform a reboot. Your CPU always starts at address 0x0000, it will load your bootloader. Your bootloader checks if the "special" bit is set and will then flash the binary file to address 0x1000-0x2000. It will then reset that special bit, indicating no new firmware is available. It will then reset itself again. Now, again, the bootloader starts - it will detect that the special bit is in fact NOT set and do nothing but simply perform a jump to the application (0x1000) from where the program will execute (now with the new firmware).

You might also want to include an option to run a default firmware or to load a firmware via UART in case your application cannot be written correctly or power is lost during the update.