tsb: the policy floor, measured and kept
A fourth tier answering one question: what does the full TinySafeBoot feature set cost in C++ under pureboot's rules — no assembly, no register variables, every pureboot lesson applied. 638 bytes, protocol suite green: 198 below the idiomatic tier, 126 above the 512 B section, and above the tiers that pay with the banned mechanisms (526 global registers, 510 with two asm routines). The gap decomposes into the rent policy-clean C++ pays for state held across calls — push/pop and argument threading a global-register protocol avoids — and both control-flow merges tried measured larger than the split cases they replaced, while the data merge (one send loop over both memories) paid. The tiers stay; this one keeps the floor an artifact instead of a claim. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -97,6 +97,10 @@ endfunction()
|
||||
# tsb_pure — pure idiomatic libavr, one function per command, TU-local
|
||||
# (internal linkage), streaming (no SRAM page buffer): 836 B in
|
||||
# the 1 KB section.
|
||||
# tsb_policy — the policy floor: pureboot's rules (no asm, no register
|
||||
# variables) with every pureboot lesson applied. 638 B in the
|
||||
# 1 KB section — the measured evidence that the 512 B fit is a
|
||||
# property of the mechanisms philosophy #5 bans.
|
||||
#
|
||||
# add_tsb_variant(<name> <boot-section-bytes>)
|
||||
function(add_tsb_variant name bytes)
|
||||
@@ -124,8 +128,13 @@ endfunction()
|
||||
# chips build pureboot alone.
|
||||
if(LIBAVR_MCU STREQUAL "atmega328p")
|
||||
add_tsb_variant(tsb_asm 512)
|
||||
add_tsb_variant(tsb_policy 1024)
|
||||
add_tsb_variant(tsb_pure 1024)
|
||||
add_tsb_variant(tsb_tricks 1024)
|
||||
# The policy tier's floor is measured with the loop flags pureboot's size
|
||||
# work found (a loader's loop bodies all contain calls); the other tiers
|
||||
# keep the flag set their recorded floors were measured with — none.
|
||||
target_compile_options(tsb_policy PRIVATE -fno-move-loop-invariants -fno-tree-ter)
|
||||
endif()
|
||||
|
||||
# pureboot — the pure-constraint port (see pureboot/README.md): one source,
|
||||
|
||||
Reference in New Issue
Block a user