From zero to main(): How to write a bootloader from scratch

tigerlily | 332 points

A good real-world example is the Arduino bootloader. [1]

Once you read the OP and learn basic idea, it is pretty simple.

[1] https://github.com/arduino/ArduinoCore-samd/blob/master/boot...

kbumsik | 4 years ago

This whole website is really great; it has been a fantastic resource for me. https://interrupt.memfault.com/blog/cortex-m-fault-debug in particular was really great.

steveklabnik | 4 years ago

A good start. It's fun until you realize Cortex M0 doesn't have a VTOR. Then again, remapping the vector table by hand isn't much work.

numlock86 | 4 years ago

Note to the author: On the latest Firefox for mac, the code samples for some reason show up as black on grey text and are almost impossible to read.

I've noticed that if I remove 'Source Code Pro' from the font-family in the inspector for the code blocks, it looks fine.

peterkelly | 4 years ago

Not adding much to the discussion, just want to say how great this website is and its articles! They have been a fun read and fantastic resource!

the_spacebyte | 4 years ago

I wrote my last bootloader more than a decade ago, debugging problems is fun !

2rsf | 4 years ago

Conveniently omits any mention of hardware initialization and related fallouts in HVM.

Find it easy? Try to push all components -- interconnect, DDR and flash controllers, accelerators, etc -- to max performance and get the phone ready to hear from the factory about how the boards fail testing.

Not all of the SoC blocks may be reconfigured later after the boot completed, some have to be done right in the very early stages of it.

minipci1321 | 4 years ago