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>
A boot-linked image larger than its slot cannot execute on hardware, and
the naive copy smashed the heap beyond avr->flash — after which the
simulation misbehaved in ways that pointed everywhere but at the size:
phantom byte losses on the UART, garbage in SPMCSR, all downstream of
the overrun. The size gate had said it plainly; now the runner does too.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-27 18:57:13 +02:00
3 changed files with 320 additions and 0 deletions
case'f':// read application flash, one page per host '!'
for(std::uint16_ta=0;a<app_end;a+=page){
if(rx()!=confirm)
break;
send_block(false,a,page);
}
break;
case'e':// read EEPROM, one page per host '!', until the host stops
for(std::uint16_ta=0;;a+=page){
if(rx()!=confirm)
break;
send_block(true,a,page);
}
break;
case'F':{// erase the application, then take pages behind '?'
std::uint16_ta=erase_application();
for(;rcnf()==confirm;a+=page)
store_flash_page(a);
break;
}
case'E':// take EEPROM pages behind '?', each write host-paced
for(std::uint16_ta=0;rcnf()==confirm;){
std::uint8_tcount=page;
do{
eeput(a,rx());
++a;
}while(--count);
}
break;
case'c':// read the config page
read_config:
send_block(false,app_end,page);
break;
case'C':// replace the config page, then echo it back to verify
if(rcnf()!=confirm)
break;
store_flash_page(erase_below(app_end+page));
gotoread_config;
default:// 'q' or any other byte runs the application
appjump();
}
}
}
}// namespace
}// namespace tsb
// Reset lands at the boot section base (BOOTRST): the entry stub in .vectors
// is laid first and does the one line of crt a crt-less image needs.
templatestructavr::startup::entry<tsb::run>;
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.