ROM / Reset Vector
β
eBootloader (stage-0 / minimal core)
β
E-Boot (stage-1 boot manager)
β
Application Firmware
β
EoS Firmware Services
Module
Layer
Role
stage0/
Stage-0
Reset entry, minimal HW init, recovery check, jump to stage-1
stage1/
Stage-1
Image scan, boot policy, boot log, jump to application
core/
Shared
Boot control, image verify, slot management, recovery state machine, firmware services
hal/
HAL
Board-agnostic flash/watchdog/UART/jump wrappers
boards/
BSP
Board-specific register-level implementations
include/
API
All public headers and type definitions
tools/
Host
Image packer, signing tool, UART recovery client
tests/
Test
Host-side unit tests with simulated flash
Flash Memory Map (STM32F407 Reference)
Address Range Size Region
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
0x08000000 - 0x08003FFF 16K Stage-0 (eBootloader)
0x08004000 - 0x0800FFFF 48K Stage-1 (E-Boot)
0x08010000 - 0x0807FFFF 448K Slot A (active firmware)
0x08080000 - 0x080EFFFF 448K Slot B (candidate firmware)
0x080F0000 - 0x080F3FFF 16K Recovery image
0x080F4000 - 0x080F5FFF 8K Boot control (primary)
0x080F6000 - 0x080F7FFF 8K Boot control (backup)
0x080F8000 - 0x080F9FFF 8K Boot log
0x080FA000 - 0x080FFFFF 24K Device config / reserved
Reset_Handler()
βββ Copy .data, zero .bss
βββ ebldr_hw_init_minimal()
β βββ board_get_ops() β register HAL
β βββ board_early_init() β clocks, flash latency
βββ ebldr_stage0_main()
βββ ebldr_watchdog_init()
βββ eos_bootctl_load() β load boot state
βββ ebldr_recovery_triggered()?
β βββ YES β eos_recovery_enter() β UART command loop
βββ jump to stage-1 β eboot_main()
βββ eos_bootctl_load()
βββ eos_boot_log_init()
βββ eboot_should_recover()?
β βββ YES β eos_recovery_enter()
βββ eboot_scan_images() β verify both slots
βββ eboot_select_slot() β boot policy
β βββ Check max attempts β rollback
β βββ Check pending upgrade β test boot
β βββ Try active slot
β βββ Fallback to alternate slot
βββ eboot_jump_to_app()
βββ Increment boot attempts
βββ Disable interrupts
βββ Deinit peripherals
βββ Jump to application vector table
1. Application writes new image β Slot B
2. eos_fw_request_upgrade(SLOT_B, EOS_UPGRADE_TEST)
3. system_reboot()
4. E-Boot sees pending_slot = B, flags = TEST_BOOT
5. Verifies Slot B image β boots Slot B
6. boot_attempts++
7. New firmware runs self-test
8. eos_fw_confirm_running_image() β marks CONFIRMED
OR
Firmware crashes / fails self-test
β Watchdog resets β boot_attempts++
β After max_attempts reached β E-Boot rolls back to Slot A
Command
Code
Description
PING
0x01
Identity check β returns "EOS"
INFO
0x02
Flash layout and slot addresses
ERASE
0x03
Erase target slot
WRITE
0x04
Write chunk to slot
VERIFY
0x05
Verify slot image integrity
BOOT
0x06
Set active slot and reboot
LOG
0x07
Dump boot log
RESET
0x08
System reset
FACTORY
0x09
Erase all + reset defaults
Packet format: [cmd:1][slot:1][len:2][offset:4]