The RC-oscillator answer's device half (dev/tasks.md in libavr): OSCCAL joins pureboot_add_loader() as one optional byte, written at the top of run() before the WDRF bail so the watchdog hand-over inherits the corrected clock too. Orthogonal to the backend — an autobaud build may carry it purely for the application. No value, no code: the stock image differs from v5 in exactly the version's two bytes (the stamp and the 'b' immediate). Measured: +6 B where OSCCAL takes sts (328P, 404→410), +4 B in low I/O (t85, 402→406); the tightest image in the space (1284 autobaud on USART pins, 504) carries the sts form at 510 of 512. New gates: the OSCCAL size points on every chip, the wire-observed trim byte on both addressing classes (test/pbosccal.py, red-green), and the autobaud unit pinned to ram_start (test/check_unit.cmake, red-green) — the address --info's measured-clock read is about to rely on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
24 lines
1.1 KiB
CMake
24 lines
1.1 KiB
CMake
# Asserts the autobaud loader's measured unit is the first RAM object: the
|
|
# host tool reads the bit period from ram_start (--info's measured clock), so
|
|
# the unit's address is wire contract. Run as
|
|
# cmake -DOBJDUMP=... -DELF=... -DRAM_START=<data address> -P check_unit.cmake
|
|
|
|
execute_process(COMMAND ${OBJDUMP} -t ${ELF} OUTPUT_VARIABLE _syms RESULT_VARIABLE _res)
|
|
if(NOT _res EQUAL 0)
|
|
message(FATAL_ERROR "${OBJDUMP} -t ${ELF} failed")
|
|
endif()
|
|
|
|
# The symbol line: "00800100 l O .noinit 00000002 <mangled>unit_E".
|
|
string(REGEX MATCH "\n0*([0-9a-f]+)[^\n]+[ \t][^ \t\n]*unit_[^ \t\n]*\n" _line "${_syms}")
|
|
if(NOT _line)
|
|
message(FATAL_ERROR "no unit_ symbol in ${ELF} — is this the autobaud loader?")
|
|
endif()
|
|
|
|
# AVR data-space symbols carry the 0x800000 VMA offset.
|
|
math(EXPR _want "0x800000 + ${RAM_START}" OUTPUT_FORMAT HEXADECIMAL)
|
|
math(EXPR _have "0x${CMAKE_MATCH_1}" OUTPUT_FORMAT HEXADECIMAL)
|
|
if(NOT _have STREQUAL _want)
|
|
message(FATAL_ERROR "unit_ sits at ${_have}, ram_start is ${_want} — the host peeks ram_start")
|
|
endif()
|
|
message(STATUS "unit_ at ${_have} == ram_start")
|