Skip to main content
Visitor II
June 1, 2022
Solved

Custom Bootloader?

  • June 1, 2022
  • 2 replies
  • 4996 views

I am planning to do a Over the air update for a tool.

And I'm planning to use a stm32l431cc ultra low power MCU with one flash bank.

So here we have an application which is some 100kb.

I'm confused with lot of terms.

OpenBootloader

In application programming

Custom Bootloader.

Default bootloader by stm32 in System memory.

etc.

Can you clarify these word's.

I want some idea where in i can flash my new software to some flash sections,

take backup of old software.

Then move the new software to old software's location.

is this possible?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    >>Can you clarify these word's, stm32 is more confusing that I thought.

    You have any relevant experience from some other MCU family you can leverage?

    >>I want some idea where in i can flash my new software to some flash sections,

    take backup of old software. Then move the new software to old software's location. is this possible?

    Holding multiple concurrent images, and swapping them, probably beyond you.

    On a device with 256 KB you could stage a 128KB image, and subsequently replace one with a newer one. You could break the memory space into three, and have a small loader manage the selection or replacement/update process. Generally you'd want that loader to be very small, efficient and focused, so as not to waste space for use by the application, whilst allowing for robust recovery methods so you aren't left with a bricked device in the field with no firmware on it.

    If you have a secondary flash memory, ie Micron, Macronix, Winbond QSPI device, you could stage and hold multiple firmware images in a more leisurely and flexible manner.

    2 replies

    Graduate II
    June 1, 2022

    In Application Programming (IAP) is where you program the device using your own code and protocols, and the FLASH API or register level interaction. So HAL or Reference Manual.

    I​n System Programming (ISP), where a blank device is assembled on a board, and subsequently programmed via JTAG/SWD, or ROM based System Loader using ST implemented and documented protocols, think UART, USB, I2C, can etc. See App Note AN2606 and related protocol docs.

    assume that you will likely need to stage the new firmware image in available memory, or partition memory so a small loader section can update or recover the application directly from the "air" connection you have minimally functional, and which you can control/pace the flow of data.​

    Graduate II
    June 1, 2022

    >>Can you clarify these word's, stm32 is more confusing that I thought.

    You have any relevant experience from some other MCU family you can leverage?

    >>I want some idea where in i can flash my new software to some flash sections,

    take backup of old software. Then move the new software to old software's location. is this possible?

    Holding multiple concurrent images, and swapping them, probably beyond you.

    On a device with 256 KB you could stage a 128KB image, and subsequently replace one with a newer one. You could break the memory space into three, and have a small loader manage the selection or replacement/update process. Generally you'd want that loader to be very small, efficient and focused, so as not to waste space for use by the application, whilst allowing for robust recovery methods so you aren't left with a bricked device in the field with no firmware on it.

    If you have a secondary flash memory, ie Micron, Macronix, Winbond QSPI device, you could stage and hold multiple firmware images in a more leisurely and flexible manner.

    Vmere.1Author
    Visitor II
    June 1, 2022

    I used PIC micro controller earlier to do small embedded systems. But my friend suggested to go with STM, so I purchased one nucleo-f411re and trying to use it to do some lift operations for a building.

    "stm32 is more confusing than I thought" --> Not needed, i feel dizziness looking at data sheets but very informative.

    I guess u r offended, I'm deleting that sentence.

    Vmere.1Author
    Visitor II
    June 1, 2022

    Thanks,

    So there is already one bootloader on system memory (ROM) flashed by ST.

    "And I think my task will/can be design a custom bootloader such that I receive the binary image using bootloader and put in in some flash region (probably some banks)."

    Also Open Bootloader is an example of IAP.

    Graduate II
    June 1, 2022

    The ST one can be very awkward and inflexible at times. There are often a lot of pins in play, which needs to be considered in the board design. And the protocol is ST unique, other devices frequently use a staged approach, and support X-MODEM or Intel/Motorola Hex files directly, and can use generic Terminal applications, typical of BBS and dial-up modems from the 80's- 90's.

    Some of ST's IAP examples support Y-MODEM, there are other Ethernet examples using LwIP. Use of TFTP, FTP and HTTP is also quite common. Firmwares on Cellular Modems or WiFi modules frequently support HTTP or FTP at an AT command level, from there you can fetch binary or hex files from a convenient server.