Raspberry Pi RP2040 programmer wanted -- 2

Job ID: 34984646

Budget: $30 – $250 USD

Firstly you must have some Pi Picos otherwise please don't bid.

If you’ve run some Pico test programs you’ve probably noticed the compiled programs are located in Flash memory and run through the XIP port, a form of cache. You’ve probably also noticed the extensive use of CMake in the build system, a large number of embedded sub-directories and a CmakeList.txt at each level. If you go to the outermost level you should see it pulling in the SDK and checking the version used. Then below this after the add-compile-options statement there should be a pico-set-binary-type instruction. If you change this to :
pico-set-binary-type(PROGRAM_NAME, copy-to-ram)
it should attempt to load the code from Flash into RAM and run from there.
Now it gets complicated. The system I’m designing stores the program in a flash on the first RP2040. This then connects to a second RP2040 via GPIO16 -> SWCLK and GPIO17->SWD pins. The second RP2040 similarly connects into a third RP2040 and so on forming a long chain. BUT ONLY THE FIRST RP2040 HAS FLASH MEMORY.

The idea being you can update one flash memory and all processors run the same program in RAM.
Unfortunately the image the first processor copies to RAM using copy-to-ram will run on the processor with the flash, but when you copy it to another processor it fails to run because some of the initialisation work is done during the copying process. Instead you need to create a different binary using
pico-set-binary-type(PROGRAM_NAME, no-flash)
But when you load this into the flash of the first processor and reboot nothing happens. You need to write a small second level boot program that copies this binary image into the memory and then perform a jmp to the first instruction.
I haven’t done anything on this yet, but the first answer by Kilograham here says what is needed :
https://forums.raspberrypi.com/viewtopic.php?t=328174
Once this is booted and running it needs to transfer a copy of the program to the second processor via SWD and boot the same program there using GPIO16/17 to the SWD pins of the second RP2040.
Programming the processor via SWD is probably best based upon converting this program which is proven to work when running on a Pi4.
https://github.com/rsta2/circle/tree/master/addon/pico
Convert this to RP2040 code and check you can move the program from the first Pico to the second and have it boot.
For all of this, just use a simple blink function as proof that your code is being moved and booted on each processor. But do make sure the program is running from RAM. You can do this by adding the following at the top of the C code
#if !PICO_NO_FLASH
#error “Not running from RAM”
#endif

Hope this is clear. Let me clarify again, only one RP2040 has flash memory, the other have to run from RAM. Previous bidders didn't seem to understand this limitation.
Related categories: C Programming Raspberry Pi