Skip to content

machine/rp2350: add flash support for rp2350 #4803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 16, 2025

Conversation

mikesmitty
Copy link
Contributor

Hi all, this still needs a bit of cleanup and I haven't had the chance to properly test it on hardware, but it builds cleanly. Figured I'd push it up to see if any big changes need to happen before I give it a final polish.

Fixes #4799

@mikesmitty mikesmitty marked this pull request as ready for review March 13, 2025 13:46
@mikesmitty
Copy link
Contributor Author

Ok, I had a chance to test the console functions in https://github.com/tinygo-org/tinyfs/blob/release/examples/console/littlefs/machine/main.go and it seems to be working as far as I can tell, but I've not used tinyfs before

@mikesmitty mikesmitty force-pushed the ms/rp2350-flash-port branch from ec9f977 to 432b01d Compare March 14, 2025 03:26
@mikesmitty mikesmitty requested a review from eliasnaur March 14, 2025 12:27
@eliasnaur
Copy link
Contributor

I'm not the right reviewer for the details of the flash interface. Perhaps @deadprogram who authored the other implementation.

@mikesmitty
Copy link
Contributor Author

Sounds good. It's mostly just copy/paste from pico-sdk with the RISC-V and RP2040-specific macro branches trimmed out and I grouped everything by source file with a header comment so it should hopefully be relatively straightforward to cross-reference. The only real changes I made were to mimic the conversion of flash_range_program()/flash_range_erase() to flash_range_write()/flash_erase_blocks() that was done in machine_rp2040_rom.go and to ditch the enum flash_devinfo_get_cs_size() used as a return value in favor of a uint8_t. It's only used once and only to check against the zero value from 4 register bits. I left that bit in even though it's only used for checking if a PSRAM chip exists to make it easier to add support for it down the road, but I can trim it out if that makes more sense

@deadprogram
Copy link
Member

Thank you for working on this @mikesmitty and to @eliasnaur for review.

I tested on real hardware, working exactly as expected. Now squash/merging. Thanks again!

@deadprogram deadprogram merged commit 4768c7d into tinygo-org:dev Mar 16, 2025
18 checks passed
@mikesmitty mikesmitty deleted the ms/rp2350-flash-port branch March 16, 2025 14:40
@mikesmitty
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants