cancel
Showing results for 
Search instead for 
Did you mean: 

Is the ROM bootloader source available somewhere?

Matthijs Kooijman
Associate III

I'm planning to use the built-in ROM bootloader in an STM32F4 chip for DFU uploads and having a hard time figuring out how it works exactly (in particular what pins it initializes at what moment in the boot process, and what I need to do externally to prevent it from going into e.g. SPI or UART mode). The documentation is missing some details (and experiments also give me puzzling results), so I'm looking for some more specific insight in the workings of this bootloader, which would be perfectly solved by looking at the source code.

I've read some earlier related posts, and I suspect that the sources are not currently available, but maybe someone at ST will see this as a request to change that? I would think there will not be any secrets in their bootloader sources, but it would make the bootloaders (and thus their hardware platform) a lot more usable.

Note that I realize that the ROM bootloader is not perfect and might not be a good basis for a custom bootloader, but that is not my goal (my goal is to understand and use the ROM bootloader). I also realize that the bootloader is in ROM and cannot be modified.

I also realize that using a custom bootloader in flash is also a commonly used option, but I'd prefer to use the builtin one (since that can certainly not be erased, and simplifies production).

I noticed @Community member​ mentioning in this topic that you can read back the compiled bootloader from ROM and disassemble that, which would also be helpful (but a lot harder to read, of course). He mentions his "own annotated listings", but without a link it seems. I wonder if there is any repository of such listings or dumps? If not, anyone aware of some tutorial on how to generate them? Though I guess it's a matter of dumping memory through SWD and then disassembling with something like `objdump`?

15 REPLIES 15

At the end of the day, the bootloader sits in transistors we are paying for, so it would be nice to have a more thorough description of the details. Even if AN2606 is the best written and best maintained of all STM32 appnotes (which is kind of sad).

Although, the same applies to many other transistors on that chip...

JW

After doing few projects with several STM32s I hardly used the "system memory" bootloader at all.

For initial programming I always use the debug interface, then my own bootloaders.

Of course I am not an expert by any means but I'd rather prefer that ST leaves the "system memory"

one-time-programmable by end user.

So that we could make custom bootloaders perfectly tailored - and have the source too.

-- pa

Production programming via serial interfaces can be scaled very cheaply, especially in products that already expose the interfaces.

The transistor for the array are limited, the code however does not use the optimizer. Functionality if broken down cleanly and exported in unused vectors, could provide significantly more flexibility and consistency.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Piranha
Chief II

> the code however does not use the optimizer

That could be indication that the code is of bad quality and has stability problems. Just like HAL, CubeMX, examples and... all code from ST!? I'm wondering - is the system memory bootloader built no HAL? It would make sense, unfortunately... Maybe someone has figured it out?

They don't trust the Keil compiler/tool chain.

The firmwares do not look to use HAL constructs​.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Matthijs Kooijman
Associate III

I submitted an "Idea" to ST, asking them to publish bootloader source code. Let's see if they reply?

If you're also interested in the bootloader sources, be sure to vote on the idea: https://community.st.com/s/ideazone#0873W000000PAwtQAG