Skip to main content
abaldur
Associate III
April 8, 2019
Solved

Source code for STM32 bootloader?

  • April 8, 2019
  • 11 replies
  • 7497 views

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

This topic has been closed for replies.
Best answer by After Forever

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).

11 replies

After Forever
Senior III
April 8, 2019

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

abaldur
abaldurAuthor
Associate III
April 8, 2019

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.
Super User
April 8, 2019

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

NKoot.1
Associate
June 16, 2020

hi pavel,

so if i upload the usb bootloader, can i still use the ftdi to program stm board using the inbuilt serial bootloader

Tesla DeLorean
Guru
June 16, 2020

The ROM based loader comes up when BOOT0 is HIGH at reset, and will always be there. Things like RDP can limit it's ability to function, read out, etc.

See AN2606

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
abaldur
abaldurAuthor
Associate III
April 8, 2019

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

/ abaldur

After Forever
Senior III
April 8, 2019

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
abaldurAuthor
Associate III
April 8, 2019

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

After Forever
After ForeverBest answer
Senior III
April 8, 2019

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
abaldurAuthor
Associate III
April 8, 2019

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

After Forever
Senior III
April 8, 2019

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.

ihouses ihouses
Associate III
April 17, 2019

​Hello,

I am trying to use the embedded STM32 bootloader. I have a STM32F723 microcontroller but looks like that the ST Flasher Demo doesn't support it.

Do you guys know any host written in Python that can communicate with the STM32F7 embedded bootloader?

Thanks!

Tesla DeLorean
Guru
April 17, 2019

The old app is deprecated, the STM32 Cube Programmer supports UART mode connectivity now.

There were some open source C projects, I wrote my own back in the F1/F2 days, and the protocol isn't that complicated to implement. If you're proficient in Python, perhaps a 4 hour exercise.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..