Skip to content

G0: automatically build, bundle and update companion firmware - #870

Open
dynfer wants to merge 27 commits into
FOME-Tech:masterfrom
dynfer:codex/g0-v9-06-updater
Open

dynfer wants to merge 27 commits into
FOME-Tech:masterfrom
dynfer:codex/g0-v9-06-updater

Conversation

@dynfer

@dynfer dynfer commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Make the normal Atlas build produce and embed the G0 firmware automatically. Pin the companion source as a submodule, build it with fome-fw’s ARM compiler, and generate an immutable image header containing the binary and its build identity. Clean builds recreate these outputs; unchanged inputs preserve their timestamps.

Before registering remote I/O, compare the application’s protocol and firmware identity with the bundled image. When an update is required, use dedicated BOOT/RESET pins to enter the STM32 ROM loader, program padded 256-byte blocks, verify every block by readback, then reset and check the application identity again.

Reject invalid vectors and oversized images before resetting hardware. Failed programming prevents G0 runtime I/O registration. The ROM path also permits upgrading older application protocols.

Atlas enables the expansion and updater by default. G0_FIRMWARE_UPDATE=no retains runtime I/O without building or programming an image; G0_EXTENSION=no disables the expansion.

Validation:

  • Protocol, output-adapter, bootloader and image-generator tests passed.
  • A clean default Atlas build passed.
  • All 12,060 image bytes were verified in packaged fome.bin, with storage in read-only flash.
  • An unchanged rebuild preserved binary and header timestamps.
  • The complete stack passed 770 native tests.

dynfer and others added 27 commits November 14, 2026 11:44
Preserve the factory ROM session and enable nBOOT_SEL through its SPI loader before erasing main flash. Validate the G071 identity, option complements and recovery settings; retain every other option byte and require complete readback after reconnect.

Keep Atlas NRST pulled up through both firmware stages and use ROM Go for first startup. Cover provisioning, existing applications, rejected options, missing ACKs and transport cleanup with sanitizer tests.
Use the realtime counter for the required ROM byte spacing and sleep every 32 bytes to keep lower-priority threads runnable. Show upload activity on the running LED while the normal LED callback is not yet started.

After verified flashing, Go allows G071 startup to clear EMPTY before a BOOT0-low reset restores normal peripheral state. Check the application identity after reset. Keep factory provisioning and failed-update paths free of premature resets.
Preload configured local MAX31855 CS latches high before enabling their GPIO drivers and before any G0 SPI activity. Leave ownership acquisition to the later thermocouple initialization. Skip other buses and unassigned or remote GPIO pins.
Treat NaN and nonnegative sub-1 Hz frequencies as paused PWM, retain duty for resume and honor logical inactive polarity. Keep negative, infinite and over-range frequencies invalid. Route initial G0 pause values before the generic low-frequency rejection.

Reapply active PWM setpoints against the engine PWM enable flag before each background SPI frame. This propagates disable/restore without requiring another controller callback and leaves static GPIO independent. Cover paused startup, inversion, disabled updates, late startup and deinitialization in adapter regressions.
G071 BOOT0 shares PA14 with SWCLK. Keep driving boot selection during reset and ROM programming, then switch the host control pin to input with pull-down after SPI cleanup on success or failure. Retain pin ownership and leave NRST behavior unchanged.

Assert that boot remains driven throughout reset/transfers and is released on every tested updater exit path.
# Conflicts:
#	firmware/hw_layer/g0_extension/g0.mk
# Conflicts:
#	firmware/hw_layer/g0_extension/g0.mk
# Conflicts:
#	firmware/CHANGELOG.md
#	firmware/hw_layer/g0_extension/README.md
#	firmware/hw_layer/g0_extension/g0.mk
#	firmware/hw_layer/g0_extension/image.mk
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.

1 participant