diff --git a/pureboot/pureboot.cpp b/pureboot/pureboot.cpp index 3431762..93be716 100644 --- a/pureboot/pureboot.cpp +++ b/pureboot/pureboot.cpp @@ -37,10 +37,11 @@ constexpr auto off = avr::irq::guard_policy::unused; constexpr std::uint8_t ack = '+'; -// Per-chip personality, from the chip database: the clocks the dogfood -// boards run (16 MHz crystal on the mega, calibrated RC on the tinies) and -// the device signature (compile-time data — the tiny13A cannot even read its -// signature row from code). +// Per-chip personality: the clocks the dogfood boards run (16 MHz crystal on +// the mega, calibrated RC on the tinies). The device signature comes straight +// from the chip database (avr::hw::db.signature) — compile-time data is the +// only universal source, since the tiny13A cannot even read its signature row +// from code. consteval avr::hertz_t clock() { if (avr::hw::db.name == "ATtiny13A") @@ -50,15 +51,6 @@ consteval avr::hertz_t clock() return 16_MHz; } -consteval std::array signature() -{ - if (avr::hw::db.name == "ATtiny13A") - return {0x1e, 0x90, 0x07}; - if (avr::hw::db.name == "ATtiny85") - return {0x1e, 0x93, 0x0b}; - return {0x1e, 0x95, 0x0f}; -} - using dev = avr::device<{.clock = clock()}>; // Geometry: the resident loader owns the top 512 bytes of flash; the word @@ -84,9 +76,9 @@ inline constexpr std::array info_data = { 'P', 'B', 1, // magic, protocol version - signature()[0], - signature()[1], - signature()[2], + avr::hw::db.signature[0], + avr::hw::db.signature[1], + avr::hw::db.signature[2], static_cast(page), base & 0xff, base >> 8, // app flash ends here; resident loader base