We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

josephchrzempiec
Posts: 481
Joined: Tue Jun 21, 2016 7:56 am

Rp2040 processor bootloader firmware?

Sat Jan 29, 2022 6:11 am

Hello, A friend of mine is helping me to make my own board for the rp2040 processor. However One thing I came accross is Where Can I find the bootloader, firmware to install on the processor? I know it takes SWD programming and I do have a programmer Because I program the ardiono zero samD21 processor that takes SWD programmer.

Sense I'm new to building and programming the pico. Where Can I find the steps to program the processor itself? I'm not much of a programmer bit I will try. My skills are mostly in hardware.


Joseph

trejan
Posts: 7747
Joined: Tue Jul 02, 2019 2:28 pm

Re: Rp2040 processor bootloader firmware?

Sat Jan 29, 2022 6:16 am

There is nothing to preload. The bootloader is in ROM inside the RP2040.

josephchrzempiec
Posts: 481
Joined: Tue Jun 21, 2016 7:56 am

Re: Rp2040 processor bootloader firmware?

Sat Jan 29, 2022 6:27 am

Thank you. So Once I build the board with the same Winbond chip as the original pico board. It should show up with out any problem and I can run my code like I do with the normal pico? I'm running it with Arduino IDE code.


Joseph

User avatar
MikeDB
Posts: 2877
Joined: Sun Oct 12, 2014 8:27 am

Re: Rp2040 processor bootloader firmware?

Sat Jan 29, 2022 8:29 am

josephchrzempiec wrote:
Sat Jan 29, 2022 6:27 am
Thank you. So Once I build the board with the same Winbond chip as the original pico board. It should show up with out any problem and I can run my code like I do with the normal pico? I'm running it with Arduino IDE code.


Joseph
Yes. Or you then write your own second stage bootloader to do anything else you want before loading the main program.
Always interested in innovative audio startups needing help and investment. Look for InPoSe Ltd or Future Horizons on LinkedIn to find me (same avatar photograph)

josephchrzempiec
Posts: 481
Joined: Tue Jun 21, 2016 7:56 am

Re: Rp2040 processor bootloader firmware?

Sat Jan 29, 2022 9:34 am

Hello MikeDB, I didn't know if the rp2040 come blank and needed to be loaded with some firmware, Or it already has preloaded default firmware build in.


Joseph

User avatar
triss64738
Posts: 131
Joined: Wed Jun 16, 2021 5:13 pm

Re: Rp2040 processor bootloader firmware?

Sat Jan 29, 2022 1:47 pm

The only code residing in the rp2040 chip is the first-stage bootloader, which is placed in mask ROM and cannot be changed. It will (depending on whether it can find a flash memory with a valid second-stage bootloader) either load the second stage from external QSPI into SRAM and execute it, or fall back to the USB loader.

The second-stage bootloader's job is to configure the flash properly to allow for faster access times, and then load the main program/app. As it resides in flash, you can change this bootstage to your liking.

So, in conclusion, the only firmware you need to write to a chip is the second-stage bootloader and the main app, which need to be written to the flash chip, not the rp2040. (This can be done using the USB bootloader of the rp2040, though.)

dthacher
Posts: 1333
Joined: Sun Jun 06, 2021 12:07 am

Re: Rp2040 processor bootloader firmware?

Sun Jan 30, 2022 5:47 pm

You know adding Arduino UART bootloader would be fairly straight forward. This would replace the current logic; however, this would likely need a loader. The Arduino is modified Harvard and does not support execution from RAM. The RP2040 does and in many ways relies on it.

The RP2040 is like PIC32MX in that from the factory it comes blank. However, the RP2040 does have a small on-board loader using USB to add new programs. This firmware presents the RP2040 as a mass storage device which allows uploading the uf2 firmware file. The on-board loader will read the image and begin uploading to the flash as configured by the settings.

Modifying the bootloader logic to use UART should be possible. This would be booted by the on-board logic using the required stage2. Installing this bootloader would work using the built-in bootloader which does not require any programmers. From this point on the loader would work just like a standard UART loader. Note this will require flash to work.

The challenge here would be reworking the SDK to support this. However, if the UART logic consumes the hex file directly this may not be required.

SWD can be used for programming however this is not required. SWD is likely intended to be used for debugging or RAM only operation. The on-board bootloader does not require special tools or programs work. USB and mass storage are very portable. If you want to retrofit something else on later, you can. You want to support Ethernet loader, go for it. CAN loader, go for it. You get the point.

hippy
Posts: 19920
Joined: Fri Sep 09, 2011 10:34 pm

Re: Rp2040 processor bootloader firmware?

Mon Jan 31, 2022 1:08 pm

josephchrzempiec wrote:
Sat Jan 29, 2022 6:27 am
So Once I build the board with the same Winbond chip as the original pico board. It should show up with out any problem and I can run my code like I do with the normal pico?
Yes, exactly that.

Once you have built your 'Clone Pico' it will behave exactly the same as a genuine Pico without having to program anything first.

WestfW
Posts: 284
Joined: Tue Nov 01, 2011 9:56 pm

Re: Rp2040 processor bootloader firmware?

Mon Jan 31, 2022 8:19 pm

The only code residing in the rp2040 chip is the first-stage bootloader, which is placed in mask ROM and cannot be changed.
There is other code in the ROM as well. The optimized floating point library and some other C support functions, for example.

But it IS in ROM and will always be there, so if the functionality of the ROM bootloader is sufficient, you don't need to have any other bootloader.

If you still want to look at the source code for the bootrom, you can find it here: https://github.com/raspberrypi/pico-bootrom

Return to “General”