cancel
Showing results for 
Search instead for 
Did you mean: 

Source code for STM32 bootloader?

abaldur
Associate III

Hi all,

Is the source code of the bootloader (that is used to perform application programming over serial interface) available to download?

The AN2606 says that "The bootloader is stored in the internal boot ROM memory (system memory) of STM32 devices. It is programmed by ST during production."

Best Regards,

abaldur

1 ACCEPTED SOLUTION

Accepted Solutions

OpenBLT (linked above) is rather robust and well-known, it supports firmware uploading over the CAN bus (one of several supported interfaces). It has its own command line tools in the "Host" directory for working with the bootloader ("Target" directory).

View solution in original post

15 REPLIES 15

No, but if you are curious you should be able to read it from the system memory and disassemble/decompile it.

abaldur
Associate III

Thx for the reply.

Well, I'm sure that is possible, but that really seems like a lot of work.

I would have hoped it was freely available to be read, modified and recompiled if necessary.

/ abaldur

Pavel A.
Evangelist III

You cannot modify the built-in botloader in any case, because it is in write-once memory. But you can find examples of bootloaders on github and modify as you want, This goes into the user's flash memory of the MCU.

-- pa

abaldur
Associate III

I see. Do you know of any popular bootloader projects out there or do the majority stick to the build-in variant?

/ abaldur

The build-it variant is very simple, no encryption, no signature validation, it is generally used for the first-time flashing. If you want a robust bootloader you should use a custom one, I think.

There are many free bootloader projects in Github that you can use as a base:

https://github.com/akospasztor/stm32-bootloader

https://github.com/feaser/openblt

https://github.com/dmitrystu/sboot_stm32

abaldur
Associate III

Thx for the links. Looks interesting.

In my case, I have a CAN bus with many nodes where quite often all the nodes needs to be updated (as we do a lot of development). Do you know of any bootloaders that are specifically suitable for this? It's quite tricky to make a robust update system for this. Many things can happen during the update process, for instance a node fails at some random place and you have to recover with a lot of uncertainty.

Would love to use already tested command-line tools for this if they already exist.

/ abaldur

OpenBLT (linked above) is rather robust and well-known, it supports firmware uploading over the CAN bus (one of several supported interfaces). It has its own command line tools in the "Host" directory for working with the bootloader ("Target" directory).

abaldur
Associate III

Great, sounds pretty much like the tool that I'm looking for.

Do you know how well it deals with updating a "fleet" of devices that shares the same bus, like on a CAN bus? I guess its my job to broadcast a command to all the nodes to make them enter bootloader mode, but is the rest taken care of by the bootloader? I mean the logic necessary to update one board at a time and so forth.

/ abaldur

No idea, I have never used it. Please check its FAQ and wiki pages, maybe you'll find the information you are interested in. Even if MicroBoot and BootCommander (their GUI and CLI flashing tools) don't support what you want you may be able to write a custom tool using their LibOpenBLT library.