Repository navigation
feat(firmware): CAN bootloader core and the 4 KB app layout (#363) - #376
Merged
Merged
Conversation
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 #363.
Every STM32 board now carries our own CAN bootloader in its first 4 KB, and every app starts at
0x08001000. The bootloader starts only an app whose identity block (#362) and CRC check out. Otherwise it waits and takes an image over CAN, writing block 0 last (commit last), so an interrupted update always leaves the board in its bootloader and flashable. It also copies the last valid app's NODE_ID and kind into option bytes Data0/Data1, so a board with a broken app still answers as its node. Decision D26.What changed
Firmware/Bootloader/(new): bare-metal CMSIS, 2,876 B of 4,096 (the build fails past 4 KB). One image serves both the 64 KB and 128 KB chips; it reads the flash size at run time.BOOT_RSP_n. With no NODE_ID yet it announces on0x7C1instead.Firmware/Libraries/BootProtocol/BootProtocol.h(new, header-only): the one source for every CAN ID, command, reply, status, state, the transfer shape and the backup-register entry flag. It uses#346named values.Firmware/Bootloader/tools/flash_can.py: bench host for a CANable. It readsBootProtocol.hand the image's identity block.--listen,--stop-afterand--delay-mssupport fault tests.Firmware/shared/stm32.ininow setsboard_build.flash_offset = 0x1000. The PDU still ends its app at the calibration page (0x0800FC00).pio run -t bootstrap(inosh_image.py): builds and flashes the bootloader, then the app, for a blank board.firmware-release-assets.yml):<board>-<v>-full.hex: bootloader + app,objcopy -O ihexof both, joined. This file is new to the release; until now it shipped.elf+.uf2only.bootloader/bootloader-<v>.elfships only when its sources changed since the lastfirmware-v*tag.manifest.jsongainsbootloader: {protocol, tag}, naming the release that holds it.-full.hexfor a new board,.elffor a board that already has the bootloader.FirmwarePlan/12-bootloader.mdand decision D26.0x7C2–0x7FF), 08 (layout), 09 (the boot sequence now starts at the bootloader).Bootloader+BootProtocol(new) andFirmwareImage.docs/firmware/bootloader.md, plus edits to the firmware index,platformio-setup.md,compatibility.md,guides/flashing.md,architecture/can-bus.md,hardware/pdu.mdand the nav.BootProtocol.h. release-please bumpsBootProtocol/library.json, and the impact map is regenerated.Bench (Gateway board's bridge STM32 + CANable, 2026-10-25)
-full.hexonto a mass-erased chippio run -t bootstrap0xFF) + bootloader only0x7C1(a0 01 ff ff 03 40)0xFF→ 0 / 3_NODE_STATUSDR1 = 0xB007) + resetBAD_CRC; stays, announces APP_INVALID; good image recoversThe board was restored to its original image afterwards. Findings about option-byte reload and OpenOCD
unlockwent into #364.Notes
pio run -t bootstrap, orpio run -d Firmware/Bootloader -t upload) before its next app upload. Per-libraryTests/still flash at0x08000000and overwrite it; feat(firmware): CAN bootloader — safety features #364 decides how they coexist with write protection.-fltoor a 128 KB chip.