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
-
josephchrzempiec
- Posts: 481
- Joined: Tue Jun 21, 2016 7:56 am
Re: Rp2040 processor bootloader firmware?
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?
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
Joseph
Re: Rp2040 processor bootloader firmware?
Yes. Or you then write your own second stage bootloader to do anything else you want before loading the main program.josephchrzempiec wrote: ↑Sat Jan 29, 2022 6:27 amThank 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
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?
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
Joseph
- triss64738
- Posts: 131
- Joined: Wed Jun 16, 2021 5:13 pm
Re: Rp2040 processor bootloader firmware?
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.)
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.)
Re: Rp2040 processor bootloader firmware?
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.
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.
Re: Rp2040 processor bootloader firmware?
Yes, exactly that.josephchrzempiec wrote: ↑Sat Jan 29, 2022 6:27 amSo 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?
Once you have built your 'Clone Pico' it will behave exactly the same as a genuine Pico without having to program anything first.
Re: Rp2040 processor bootloader firmware?
There is other code in the ROM as well. The optimized floating point library and some other C support functions, for example.The only code residing in the rp2040 chip is the first-stage bootloader, which is placed in mask ROM and cannot be changed.
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