Feature: Space-efficient 12-symbol serialno generation#1716
Conversation
dragonmux
left a comment
There was a problem hiding this comment.
We like the idea of this PR, the execution needs some love though - please see our review notes below.
addabe3 to
5f63e54
Compare
dragonmux
left a comment
There was a problem hiding this comment.
Most of the review items have been addressed and this is looking better for it - there are a couple of things we've spotted this run through and think once those are addressed this should be about ready for merge if you could squash commits appropriately.
a0f92d8 to
0690b80
Compare
dragonmux
left a comment
There was a problem hiding this comment.
This all looks good to us now - we're happy to merge this once the copyright and authorship notice issue is fixed as noted on Discord.
* Use programming practices applicable to bootloaders * Keep a 32-byte static buffer in local scope Co-Authored-By: dragonmux <git@dragonmux.network>
* STM32F4 case with 12-byte serial numbers simply relied on sprintf() * Use three calls to `utoa_upper()` to build the `serial_no[]` instead * This drastically reduces F4 usbdfu BMPBootloader binary size
0690b80 to
7e57aa0
Compare
|
Squashed intermediate progress into two distinct commits: one adding the function, one adjusting the callsite to use it (so no builds fail). Added a separate commit to refresh copyright info on the file. Thank you for propelling this PR with your extensive review. We're one step closer to making BMPBootloader/F4 DFU nicer to use (and went through the practice of adding a helper function). |
|
Merging, thank you for the contribution! |
DFU_SERIAL_LENGTH=13becoming larger than 16 KiB due tosiprintfpulled from newlib (not nano).sprintf()call with a few calls of simpler functions and introducing a variant ofutoa().12-symbol serialno consists of three halfwords calculated by pulling 16-bit values from Device Electronic Signature memory. I don't believe
hexify()can be useful here.I would not like to choose to mitigate this by downgrading the F4 BMPBootloader to newlib-nano because it would provide a small and inefficient memcpy, which is important for flash writes/upgrade reprogramming speed. And it's not like a bootloader would use *printf anyway.
Your checklist for this pull request
make PROBE_HOST=native) -- and is not applicablemake PROBE_HOST=hosted) -- and is not applicableClosing issues