Repository navigation
feat(firmware): image identity block on every production STM32 image (#362) - #375
Merged
Merged
Conversation
…362) Every production STM32 image carries a 32-byte identity block at image start + 0x200 (magic, layout, size, length, CRC, NODE_ID, NodeKind, version), defined by the role library and stamped after linking by Firmware/shared/osh_image.py with gaps filled 0xFF. The bootloader (#363), uploader (#366) and client read it. The 4 KB bootloader offset is staged in Firmware/shared/stm32.ini for #363. D25.
Contributor
📝 Docs site may need an updateThis PR touches files the docs site is built from. Before merging,
Backstop: the weekly docs-drift review. Ignore |
This was referenced Oct 26, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #362.
Every production STM32 image now carries a 32-byte identity block at image start +
0x200. It holds the magic, layout version, size, image length, image CRC, NODE_ID, NodeKind and firmware version. The bootloader (#363), the uploader (#366) and the client (SkyHawkClient#177) read it to check an image before it is flashed or booted. The bootloader layout (4 KB offset) is staged but stays off until #363.What changed
Libraries/FirmwareImage/(new, header-only): theIdentitystruct, its constants and field offsets, the CRC test vectors, andOSH_FIRMWARE_IDENTITY(kind).Role libraries define the block:
PanelGroup.cpp→PANEL_GROUPPduNode.cpp→PDUPanelBridge.cpp→BRIDGEA sketch author writes nothing.
Firmware/shared/(new):stm32f103.ld: the STM32 core's F103C8/CB linker script, plus.osh_identityat+0x200withFILL(0xFF)before it.stm32.ini: the shared[env]settings (linker script and post script). Theboard_build.flash_offset = 0x1000lines are staged, commented out, for feat(firmware): CAN bootloader — core #363.osh_image.py: the post-build step. It stampsimageLengthandimageCrcinto the.elf, then rewritesfirmware.binwith gaps filled 0xFF, so the.bin, the.elfand the board's flash give one CRC.tests/test_osh_image.py: checks the CRC vectors and field offsets againstFirmwareImage.h.Production projects include
shared/stm32.ini:Center_Armament (deprecated, no role library) and WiringCheck (a diagnostic) are left out. SoakRig follows when test(firmware): add SoakRig node sketches for the #291 soak rig #339 lands.
Tests: 19 per-library test projects add
file://../../Libraries/FirmwareImageto their dependency lists. They keep the core's default linker script, which has noKEEPfor the section, so the linker drops the block from test builds.CI and release:
FirmwareImage/library.json.Spec and docs:
FirmwareImage(new page) and an entry in the TechSpec README.docs/firmware/platformio-setup.md, new section "The production build lines".docs/firmware/build-flags.md: three line-number citations moved after the new lines, plus a new citation forFirmwareImage.has a NODE_ID reader.Verification
2A9D9F5C84E99DEFflash_offset = 0x1000puts the block at0x08001200.pytest Firmware/shared/testspasses (5 tests).check_doc_refs.py, the impact-map check andcheck_node_ids.pyalso pass.firmware.bin, and the recomputed CRC matches the stamp, so the gap reads 0xFF on the chip.HELLO_ACK._NODE_STATUSthrough the full USB → RP2040 → UART → bridge relay.Notes
FirmwareVersion.h. The header came in with feat(firmware)!: v1.0 freeze fixes — firmware version on the bus, config structs, pinned dependencies (#295) #359, after the 0.2.0 tag was cut, so the 0.2.0 release images carry no version.