RP2350 Initial Support #244
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The RP2350 is now running Zig! Credit to @timsavage for some of the initial work in porting.
Restructuring
Some housekeeping for the new chip:
port/raspberrypi/rp2040has becomeport/raspberrypi/rp2xxxsince both chips are under the same HALexamples/raspberrypi/rp2040has similarly becomeexamples/raspberrypi/rp2xxxcompatibility.zigwas added to the HAL for determining which chip you're using at compile timeApologies as this makes the diffs horrendous, but if you have a good diff tool like BeyondCompare it's fairly easy to align the renamed folders to see what changed.
Boot Rom
Unlike the RP2040, there is no longer a need to write your own "stage 2 bootloader" that fits in 256 bytes and has a special header. They've changed things around quite a bit and added lots of functionality to the ROM code that runs on boot. Way too much to go over here, but the TLDR is the boot ROM looks for metadata in your binary that's sitting in flash to determine if/how to run it. I've added a "bare minimum dumb config" that essentially just says "run this binary sitting in flash please". Chapter 5 of the data sheet (Bootrom) is well worth the read as there's some pretty cool stuff we could do with this metadata in the future.
HAL Integration
Zig actually made this part pretty pleasant. You'll see a general pattern of:
There are two methodologies I've used a bit of both of:
gpio.zig)clocks.zig)Both have their pros and cons, but overall I'm pretty happy with the readability and intuitiveness of both.
Progress
So far I've ported + tested the following from the HAL:
clocks.ziggpio.zigpll.zigresets.zigtime.zigExamples
I've modified the examples so that there are:
This is a pretty easy way to see RP2350 port progress as well, since any example that runs on the RP2350 essentially means I've run that example on my own hardware and made sure it works.