This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Fix: minor deduplication in Puya driver - #2096
Merged
Merged
Conversation
dragonmux
reviewed
Mar 21, 2025
ALTracer
force-pushed
the
fix/puya-dedup
branch
from
March 22, 2025 08:46
229576e to
7b14350
Compare
dragonmux
approved these changes
Mar 22, 2025
dragonmux
left a comment
Member
There was a problem hiding this comment.
This LGTM, we'll get this merged when the v2.1 merge window opens. Thank you for the contribution!
6 tasks
Member
|
Please rebase this on |
Contributor
|
Am I still needed to test something here? |
Contributor
Author
Yes, I would prefer you took a test run of this 2096 and 2080 on any PY32F0 board you still have (and I still don't have any) -- the usual erase/flash/run, maybe reflash at five HSI scales to test voltage/frequency support. |
Member
|
Given we're right at the start of the cycle, and as this code looks reasonable, we're going to merge this. If it turns out to be subtly wrong then a follow-up PR can be opened - we've got no problems with that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Detailed description
puya_flash_prepare()is notably WET (or five-times), affecting BMF size in some configurations.epparaNis replaced by an array and a loop.Not tested on any py32 devices which I don't have.
Discovered via staring at
strings -n16 build-f411ce/blackmagic_blackpill_f411ce_firmware.bin | lessoutput.First commit doesn't affect BMF size, or saves 136 bytes when DEBUG_TARGET is enabled (in Farpatch or else). Consider this as preparation to enabling
DEBUG_TARGETfirmware-wide. Which is unlikely to happen in v2.0, so this can be tracked to v2.1.Second commit brings minor savings of 32 bytes in release, or 64 with logging, probably by eliminating 4 extra calls to
target_mem32_read32()andprintf(). It does loseconst-ness ofeppara[5]but the scope is fairly small. I guess I could even optimize this to a 20-byte block readtarget_mem32_read()but it'd change behaviour, and I don't know how Puya flash controller reacts to it.CC #1817 by @ArcaneNibble
Your checklist for this pull request
Closing issues