From aa66cfccff997de5a23f0b5569909c34e5615f34 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Thu, 30 Jul 2026 16:13:44 +0200 Subject: [PATCH] pureboot: the poll-cost lookup rides the baud parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit usart_of<0> is an incomplete type on the USART-less chips, and a static member initializer with only non-dependent operands is checked when the template is parsed, not when it is instantiated — so the address probe broke every tiny build without hardware_link ever being named. The lookup moves into a member function template taking the link's own baud parameter, the dependence carrier that defers it to instantiation. Co-Authored-By: Claude Fable 5 --- pureboot/pureboot.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pureboot/pureboot.cpp b/pureboot/pureboot.cpp index 96671df..c2f154c 100644 --- a/pureboot/pureboot.cpp +++ b/pureboot/pureboot.cpp @@ -177,7 +177,15 @@ struct hardware_link { // bit-addressable I/O (the classic megas), lds + skip (4) in extended // I/O. A uint32_t countdown pays one more sbci — window_polls() adds it // where the count forces the wide type. Held by the pureboot.window gate. - static constexpr std::uint8_t poll_cycles = avr::hw::usart_of::ucsra::addr < 0x40 ? 7 : 9; + // The lookup rides the baud parameter so it stays dependent: the trait is + // an incomplete type on the USART-less chips, which parse this template + // without ever instantiating it. + template > + static consteval std::uint8_t poll_cost() + { + return U::ucsra::addr < 0x40 ? 7 : 9; + } + static constexpr std::uint8_t poll_cycles = poll_cost(); static void init() {