RP2040 stage2 bootloader / allow booting from flash

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Posts: 77
Joined: Sat Mar 19, 2016 8:07 pm
Been thanked: 17 times

RP2040 stage2 bootloader / allow booting from flash

Postby electronic_eel » Mon Feb 21, 2022 10:51 pm


the port for the RP2040 is currently not nice to use, because you can't boot from flash, but have to upload the code with a SWD debugger into RAM on each boot. To boot from flash, the RP2040 requires a short bootloader at the beginning of the flash (stage2). This bootloader is included in the Pico-SDK. But to be usable with ChibiOS, building the bootloader must be included in the make build system and the code be linked to the correct addresses.

The attached patches implement this. I have also added a .mk file to create the UF2 files that can be used to flash with the usb bootloader integrated in the RP2040.

I had to add small hooks to the generic ARM GCC makefiles. I have documented this in more detail the individual patch files. If any of my changes there are not acceptable or should be done differently, please explain why and I will try to adapt them.

The linker script patches are based on the work done by forum user szilveszter in this post.

The patches are attached as zip file. Alternatively you can view the whole tree with the patches applied at https://github.com/electroniceel/ChibiOS/tree/RP2040-flash

Please consider applying to ChibiOS.
(7.01 KiB) Downloaded 304 times

Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 8 guests