Skip to content

Optimize flash writes on SAMD51 #4908

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

Conversation

mateusznowakdev
Copy link
Contributor

Related to #4905, this PR will apply similar change to SAMD51, switching from write-quad to write-page mode.

https://ww1.microchip.com/downloads/en/DeviceDoc/SAM_D5xE5x_Family_Data_Sheet_DS60001507F.pdf
section 9.2.1 says

A single page contains 512 Bytes, which is applicable to all the device part numbers listed in the Configuration Summary

@deadprogram
Copy link
Member

Appears to work as expected:

$ tinygo flash -target pybadge -monitor examples/flash
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
Flash data start:       0x00008000
Flash data end:         0x00080000
Flash data size, bytes: 491520
Flash write block size: 512
Flash erase block size: 8192

Reading original data from flash:
1234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321
Erasing flash...
Writing new data to flash:
1234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321
Reading data back from flash: 
1234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321123456788765432112345678876543211234567887654321
Done.

Thank you for working on this @mateusznowakdev now merging.

@deadprogram deadprogram merged commit 5c35bad into tinygo-org:dev May 24, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants