In development. It changes without notice.
MISRA C++:2023 — what the firmware holds, and its deviations
The owner wants the firmware held to as much of MISRA C++:2023 as the project can reach, step by step. This page is the register: what is claimed, which gate holds each claim, and every known departure with its reason. It is not a compliance statement. No certified MISRA C++:2023 checker runs on this tree (they are all commercial: Cppcheck Premium, Helix QAC, Parasoft, Polyspace, PVS-Studio, LDRA), so a rule is listed as held only where a free gate checks it or where the code was read against the rule and the reading is written here.
Scope
- Own code: everything under firmware/src. The rules apply to it.
- Adopted code (MISRA Compliance:2020's term): ESP-IDF, FreeRTOS, the C and C++ libraries, and the fake ESP-IDF of the host tests (firmware/
test/ native/ harness). They are not required to comply; where they affect a claim about our code, this page says how. - Tests and host tools (firmware/
test/ native, host/, scripts/) are outside the scope.
Rule numbers
The rule numbers and headlines below are confirmed against MathWorks' public index of MISRA C++:2023 (Polyspace Bug Finder documentation, "MISRA C++:2023 Rules and Directives", read 2026-11-20; the pages of 0.2.4, 4.1.1, 6.7.1, 7.11.2 and 11.6.2 read 2026-11-23, those of 0.0.2, 5.13.4, 7.0.4, 8.0.1, 8.1.2, 8.2.2, 8.14.1, 8.19.1, 9.4.1, 9.5.1 and 19.6.1 read the same day for FW-21, and those of 6.9.2 and 7.0.5 the same day for FW-23; 8.2.6's headline and category from MathWorks' page, read 2026-11-24 for the review that found its sites), not against the standard itself, which is not in either repository: confirm each against the owner's copy before it goes into a formal deviation record. Categories are given only where a public source states them (SonarSource's rule pages, SciTools' CodeCheck list, MathWorks' rule pages); the others are marked unconfirmed. A rule headline written with "shall" is usually Required and one with "should" Advisory, but that is an inference, not a source.
| Rule | Headline (MathWorks' index) | Category |
|---|---|---|
| 0.1.2 | The value returned by a function shall be used | Required (MathWorks) |
| 0.2.2 | A named function parameter shall be used at least once | Required (MathWorks) |
| 0.0.2 | Controlling expressions should not be invariant | unconfirmed |
| 0.2.4 | Functions with limited visibility should be used at least once | Advisory (MathWorks) |
| 4.1.1 | A program shall conform to ISO/IEC 14882:2017 (C++17) | Required (MathWorks) |
| 5.13.4 | Unsigned integer literals shall be appropriately suffixed | Required (MathWorks) |
| 5.13.5 | The lowercase form of L shall not be used as the first character in a literal suffix | Required (MathWorks) |
| 6.4.1 | A variable declared in an inner scope shall not hide a variable declared in an outer scope | unconfirmed |
| 6.7.1 | Local variables shall not have static storage duration | Required (MathWorks) |
| 6.7.2 | Global variables shall not be used | Required (SciTools) |
| 6.9.2 | The names of the standard signed integer types and standard unsigned integer types should not be used | Advisory (MathWorks) |
| 7.0.1 | There shall be no conversion from type bool | Required (MathWorks) |
| 7.0.2 | There shall be no conversion to type bool | Required (MathWorks) |
| 7.0.3 | The numerical value of a character shall not be used | Required (MathWorks) |
| 7.0.4 | The operands of bitwise operators and shift operators shall be appropriate | Required (MathWorks) |
| 7.0.5 | Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand | Required (MathWorks) |
| 7.11.2 | An array passed as a function argument shall not decay to a pointer | Required (MathWorks) |
| 8.0.1 | Parentheses should be used to make the meaning of an expression appropriately explicit | Advisory (MathWorks) |
| 8.1.2 | Variables should be captured explicitly in a non-transient lambda | Advisory (MathWorks) |
| 8.2.2 | C-style casts and functional notation casts shall not be used | Required (MathWorks) |
| 8.2.5 | reinterpret_ | Required (MathWorks) |
| 8.2.6 | An object with integral, enumerated, or pointer to void type shall not be cast to a pointer type | Required (MathWorks) |
| 8.2.10 | Functions shall not call themselves, either directly or indirectly | Required (SciTools) |
| 8.14.1 | The right-hand operand of a logical && or \|\| operator should not contain persistent side effects | Advisory (MathWorks) |
| 8.19.1 | The comma operator should not be used | Advisory (MathWorks) |
| 9.4.1 | All if ... else if constructs shall be terminated with an else statement | Required (MathWorks) |
| 9.4.2 | The structure of a switch statement shall be appropriate | Required (MathWorks) |
| 9.5.1 | Legacy for statements should be simple | Advisory (MathWorks) |
| 10.0.1 | A declaration should not declare more than one variable or member variable | Advisory (MathWorks) |
| 11.3.1 | Variables of array type should not be declared | unconfirmed |
| 11.6.2 | The value of an object must not be read before it has been set | Mandatory (MathWorks) |
| 13.3.3 | The parameters in all declarations or overrides of a function shall either be unnamed or have identical names | Required (MathWorks) |
| 15.0.1 | Special member functions shall be provided appropriately | Required (MathWorks) |
| 15.1.3 | Conversion operators and constructors that are callable with a single argument shall be explicit | Required (MathWorks) |
| 15.1.4 | All direct, non-static data members of a class should be initialized before the class object is accessible | Advisory (MathWorks) |
| 19.0.2 | Function-like macros shall not be defined | Required (MathWorks) |
| 19.6.1 | The #pragma directive and the _Pragma operator should not be used | Advisory (MathWorks) |
| 21.2.2 | The string handling functions from <cstring>, <cstdlib>, <cwchar> and <cinttypes> shall not be used | Required (MathWorks) |
| 21.6.1 | Dynamic memory should not be used | Advisory (SonarSource) |
| 21.6.2 | Dynamic memory shall be managed automatically | unconfirmed |
| 21.6.3 | Advanced memory management shall not be used | unconfirmed |
| 21.10.1 | The features of <cstdarg> shall not be used | unconfirmed |
| 30.0.1 | The C Library input/output functions shall not be used | unconfirmed |
The gates
| Gate | Where | What it holds |
|---|---|---|
| GCC and clang, every warning an error | firmware/ | Every warning an error as the compiler is actually told: ESP-IDF's own -Wno-error=unused-function, -Wno-error=unused-variable, -Wno-error=unused-but-set-variable, -Wno-error=deprecated-declarations, -Wno-error=extra, -Wno-unused-parameter, -Wno-sign-compare and -Wno-enum-conversion, which a later -Werror does not undo, are each answered by name after them (FW-01, 2026-11-22), and a linker warning is an error too. -Wold-style-cast, -Wconversion, -Wsign-conversion, -Wdouble-promotion, -Wcast-qual, -Wcast-align (the cast and conversion rules, in part); -Wshadow (6.4.1 for variables); -Wswitch-enum, -Wundef, -Wredundant-decls, -Wvla, -Walloca, -Wnull-dereference, and GCC's -Wduplicated-cond, -Wduplicated-branches, -Wlogical-op. Exceptions and RTTI are off in the image (CONFIG_ |
| clang-tidy, two legs | .clang-tidy, scripts/ | Each of the 23 sources of firmware/ |
| Include report (advisory) | scripts/ | misc-include-cleaner over the device leg's flags; it reports and fails nothing, because most of what it lists is ESP-IDF's umbrella headers (freertos/ |
| cppcheck | .cppcheck-suppress, the same script and job; release pinned in scripts/ | the firmware repository's flags (warning,style,performance,portability, exhaustive) over the CMake source list; another release is refused (exit 2). unusedFunction is no longer suppressed (FW-20): those flags do not enable it, and the AST census below reads it over the whole image, which cppcheck, one file at a time and blind to the console's table of member-function pointers, could not; every entry the list keeps has its row in "Tool suppressions" |
| The register's inventories (FW-20) | scripts/ | the tables of this page that the sources can be read for, each compared row by row with what firmware/src holds (comments and literals removed): D9's static locals (6.7.1), D10's constructs that C++17 does not have (4.1.1), every NOLINT, NOLINTNEXTLINE, NOLINTBEGIN and cppcheck-suppress under firmware/ and every entry of .cppcheck-suppress ("Tool suppressions"), D5's table of discarded results by the function called ("The counts"), and every name of a standard integer type outside an alias declaration (6.9.2, FW-23), each of which fails (the few printf's formats needed went with D2 in FW-26); a construct, a suppression or a cast with no row, a row nothing matches any more, a changed count and a row with no reason each fail, and a planted case of each proves it |
| AST census (FW-20) | scripts/ | the image's translation units read together from clang's AST: no function of the firmware's own that no unit of the image references (0.2.4 and further: every own function, not only those of limited visibility), but the five test seams it names with their reasons (one of them a single overload, named with its parameter types), each of which the image must not reference and a host test must call; the array-to-pointer decays of call arguments (7.11.2) and the C arrays declared (11.3.1), counted and held to "The counts", the decays to a count that only falls over this page's history (0 since FW-26) |
| MISRA rules (FW-21) | scripts/ | the image's translation units read from clang's AST, each declaration of kleidos:: |
| Source gate | tests/ | no allocation construct in firmware/src (21.6.1 to 21.6.3), and no C stream function (printf, puts, fwrite, fopen and their kin, FW-18); no call of an allocating ESP-IDF entry point outside the allow-list of D1 (empty since FW-16) and the made-safe list (FW-16: the flash log's write and erase, whose allocation the image's configuration takes out), and no entry of either its source no longer calls (FW-08) |
| Object gate | scripts/ | no allocator referenced by a compiled object of the firmware (21.6.1 to 21.6.3); no reference to an allocating ESP-IDF entry point outside the allow-list of D1 and the made-safe list, and no entry of either its object no longer references (FW-08, FW-16); and, with --elf, no operator new or operator delete, no __cxa_* function but ESP-IDF's empty _ |
| Host ledger (FW-08) | firmware/ | every fake of an ESP-IDF entry point that allocates or frees on the device records its call, and a case whose code called one on neither the allow-list nor the made-safe list fails; the harness's, the source gate's and the object gate's lists are held equal, each allowed call to its source and to the deviation below that names it, each made-safe call to its mechanism in the tree, and their history to an allow-list that only shrinks and a deny list that only grows |
| The counts since app_main() (FW-17, FW-19) | heap_ | allocs_ |
| Reachability gate (FW-19) | scripts/ | no allocator (the C library's, heap_caps_*, the multi-heap layer, TLSF, FreeRTOS's, the C++ operators) reachable from any function of the firmware's own code, called or not, in the call graph of the linked image, read from the relocation records the link keeps (-Wl,--emit-relocs): every direct call and jump decoded at its relocated site, every long call the linker relaxed to a direct one decoded at its R_ |
| Counts by phase and the bench sweep (FW-07) | heap_ | what ESP-IDF allocates before app_main() and everything allocated since, after the boot and after each command family, equal to a tracked file that only falls (tests/ |
| Stack bound (0.14.0) | -Wstack-usage=1024 in firmware/ | no function of the firmware's own takes more than 1 KiB of stack (the largest, 944 bytes at -O2); with the end-of-stack watchpoint and the stack high-water marks of SYSTem:HEALth? and *TST?, the run-time half |
Held, by the gates and by reading
- 6.7.2, global variables. One, and it is not a program variable: RMTMEM (firmware/
src/ status_ led.cpp), the RMT's symbol RAM, declared extern "C" volatile for the address the ESP32-S3's linker script gives it (esp32s3.peripherals.ld, PROVIDE ( RMTMEM = 0x60016800 )), a peripheral's memory the LED's blanker writes word by word (D7 for its name). clang-tidy's cppcoreguidelines-avoid-non-const-global-variables does not report it, an extern "C" declaration, so this sentence is what records it. Every object of the firmware's own has static storage inside a function, which keeps it out of 6.7.2 and puts it under 6.7.1 instead, a deviation of its own (D9): the five objects of the instrument are constinit statics of app_main() (firmware/ src/ main.cpp), and the TRACE ring a static of it that is not constinit (D9: no compiler evaluates its million elements as a constant expression, and an array of integers needs no guard), all reached only through the references app_main() hands out; the state of six modules (Record logs, Heap monitor, I2C master, Startup memory, uart0, watchdog) is a constinit static of each module's state() function, reached only through it; and the relay bank's reset record is a static of relay:: detail:: resetRecord() (D11). Constants at namespace scope are constexpr, or const objects (kChannelNames, an array of constant pointers to constant strings). - 0.1.2, the value a function returns. Every call's result is used or cast to void (FW-02, 2026-11-22): bugprone-unused-return-value with CheckedFunctions .* and AllowCastToVoid finds none left, in either leg. The 24 it found were the 11 memcpy and memmove calls below, 12 atomic read-modify-writes (fetch_add, fetch_sub, fetch_or) whose previous value no counter or flag set needs, and the ROM's esp_
rom_ printf() in app_main()'s fallback (gone in FW-26: the fallback writes through the ROM's esp_ rom_ output_ putc(), which returns nothing); the casts are listed under D5. - 21.2.2, the string handling functions of <cstring>. No memcpy and no memmove (FW-02): of the eleven calls, eight became std::copy_n and std::copy (each a forward copy, the destination before the source where they overlap, which std::copy allows), and the other three, the calibration blob's reinterpretations of the bytes NVS returned, std::bit_cast, so no raw byte copy is left; from FW-16 the blob is a record of the flash log, read and written through std::bit_cast both ways and judged after a std::copy_n of its 80 bytes (calibration.cpp), and NVS's older layout is no longer read. tests/
firmware/ test_ static_ analysis_ gate.py holds the sources to it. No str* function either (FW-22, 2026-11-23): names and patterns are carried as std:: string_ view (the command table's patterns, the profiles', the relays' and the error queue's names, every keyword list a handler matches), compared with ==, starts_with() and ends_with(), their lengths from size(); numbers are read with std:: from_ chars; the 13 strlen(), the four strncmp() and the two strcmp() are gone, and no source includes <cstring>. scripts/ misra_ rules.py fails a call of any string handling function of <cstring>, <cstdlib>, <cwchar> and <cinttypes> by name, and an #include of <cstring>, <string.h>, <cwchar> or <wchar.h>, in any source of firmware/src ("Held by `scripts/ misra_ rules.py`" below; a planted call of each kind fails it). The headline also names <cinttypes>, which no source includes since FW-26: its PRI* format macros went with the formats (21.10.1 and 30.0.1 below). - 0.2.4, functions with limited visibility used (FW-20), and further: no function of the firmware's own, whatever its visibility, that no translation unit of the image references (the AST census, "The gates"), but the six test seams scripts/
ast_ census.py names, public functions the host tests call (heap:: disarm() and heap:: attachCensus(), which reset and re-ring the heap monitor between cases, i2c_ bus:: clockHz() and i2c_ bus:: clearBus(), which read back the bus's clock and run its recovery without a staged fault, from FW-22 the overload of scpi:: Parameters:: choice() over an array of C strings, which the parser's host tests were written against while the image's handlers keep their keywords as views and call the std::span overload, and, while 0.18.0 is built, pinmap_ store:: save(), which FW-03 lands with its record log and FW-05 calls from SYSTem:PINS:APPLy, taking its entry out, as FW-04 took out load()'s when the boot called it). Its first run reported eight (FW-20): five dead functions, deleted (Sampler:: pace(); channelFromName() and profileFromName(), names the console resolves through its own tables; the one-argument flash_ log:: mount(), whose second argument the tests now give; and calmath:: pointsAgree() with the two-point combination only it used, agreementPpm(), combinedMicroOhm() and kRangeAgreementPpm, which the host judges, kleidos-meter calibrate and the configuration's range_ split_ max_ ppm, never the instrument), the two I2C functions now named as seams, and a function template, which the census now reads with its specializations. - 6.9.2, no standard integer type's name (FW-23, 2026-11-23). Members, constants, parameters and loop counters are std::int32_t, std::uint32_t, std::uint64_t or std::size_t: the 69 names the firmware's own code spelled outside a format (the interrupt router's cores and lines, the I2C master's port, core and command index, the parser's base, exponent and decimals, SHA-256's and the CRC's counters, the 128-bit division's bit, the console's self-test word and report fields, the relay bank's reserved pins and pad level) are gone. Where an ESP-IDF function takes or returns int (esp_
cpu_ get_ core_ id(), gpio_ get_ level(), esp_ cpu_ intr_ get_ desc(), the I2C and timer groups' low-level calls, std:: from_ chars's base), the fixed-width value meets it by an implicit conversion between two 32-bit types of one signedness, which -Wconversion passes on both legs; no cast names int for it. The 49 that printf's formats needed (a d, u, %* or llu reads int, unsigned or unsigned long long and no fixed-width type, so the casts in a printf-family call's arguments and the int count a snprintf returned kept them; D2's d2.integer_ names, a count that only fell) went with the formats in FW-26, and none is left. scripts/ misra_ register.py reads every name from the sources (comments and literals removed, an alias declaration exempt as the rule exempts it) and fails any (tests/ firmware/ test_ misra_ register.py, with a planted name of each kind, a cast in a call's arguments among them). - 7.11.2, no array decays to a pointer (FW-26, 2026-11-23). No array of the firmware's own reaches a function or a constructor as a pointer: clang-tidy's cppcoreguidelines-pro-bounds-array-to-pointer-decay finds none in either leg and is suppressed nowhere, and the AST census counts d3.decays at 0, a ratchet ("The counts"). How the 132 that were left after FW-25 went, and the string literals counted apart, is D3's text.
- Held by scripts/
misra_ rules.py (FW-21, "The gates"): each rule below finds nothing in the image, a planted case of each fails it and its compliant twin passes (tests/ firmware/ test_ misra_ rules.py). - 5.13.4, unsigned literals suffixed. No integer literal of an unsigned type without its U. The 34 that had none were all in sha256.h, round constants and words of the initial hash value unsigned by their value alone; every one of that file's 73 hex constants now carries it.
- 7.0.3, no character's numerical value. No conversion between a character type (char and the wide character types) and any other type, written or implicit, and so no arithmetic or ordering on a character (c - '0', c >= 'A'), no character as a condition, no static_
cast<unsigned char>( c ) and no static_ cast<char>( byte ) (FW-22). What the firmware needs of a character comes from firmware/ src/ chars.h: its class (white space, digit, letter, printable, graphic) and its value as a digit from a constexpr table of 128 entries built at compile time from strings that spell each class, indexed by std:: char_ traits<char>:: to_ int_ type() after a check against the table's size; its upper case as kDigits at its value; and the byte it stands for on the wire, both ways, through std:: char_ traits<char>, the conversions MathWorks' page for the rule names as compliant. The gate reads every cast clang writes or the source does, and passes one: the promotions of two characters compared with == or !=, which compare for identity and use no value; that the rule's text allows them is MathWorks' and Polyspace's reading as far as their pages go, to confirm against the owner's copy. The 27 findings the gate made in FW-21's tree were in the parser (scpi.cpp: the character classes, the case folding, the digit values), the scale's digit emission (scale.h), the console's byte checks, the CRC and serial bytes (crc32.h, identity.h) and UART0's ring (uart0.cpp). - 7.0.5, no operand whose signedness promotion or the usual arithmetic conversions change (FW-23, 2026-11-23). The operands of every arithmetic, bitwise, shift and relational operator, of ~, unary - and +, of a compound assignment and of the conditional operator's two arms are read for a conversion clang inserted between two integer types of different signedness, and a compound assignment for a left operand computed in a type of the other signedness. The first reading found more than 450 operands, of three kinds, all gone: 318 literals of type int meeting an unsigned operand (size == 0), each now suffixed U (size == 0U); about 150 narrow unsigned operands (std::uint8_t, std::uint16_t) promoted to int against another narrow one, in flag tests, register fields, the status registers and the command table's flags; and a dozen unsigned operands meeting a signed 64-bit one (a shunt bound against a parameter, a sample count dividing a sum), now cast. Masks and bit positions are std::uint32_t (the INA228's fields and DIAG_ALRT bits, the status bytes, the command flags, the channel and relay masks), so a narrow register value that meets one is converted to std::uint32_t without passing through int; the SCPI status registers, the command flags, the channel masks and relay::Mask are held in std::uint32_t themselves; flag tests and field extractions go through bits::
hasBit() and bits::field() on std::uint32_t (firmware/ src/ bits.h), so the conversion is the call's, to its parameter's type. What this reading passes and the rule's text might not is D12. - 8.0.1, for the conditional operator. Every operand of ?: that is itself a binary or a conditional expression of higher rank in the rule's table is parenthesized (( a == b ) ? x : ( y - z )), as 101 conditional expressions of FW-20's tree were not, most of them by their condition. An overloaded operator ranks as the built-in one it is spelled as (an iterator's ==, a rewritten != or a < answered by <=>), because the rule is about the expression as written; the gate read only built-in operators until the review of 2026-11-24 found findCommand()'s found == table.end() ? ... passed unparenthesized. The rule's other half, the operands of a binary operator (a + b * c), is not read by the gate and not claimed.
- 8.1.2, captures named. The six lambdas of firmware/src (src.lambdas under "The counts") name what they capture or capture nothing: Console::
findCommand()'s match [header, &suffix], samplerRefusalCode()'s match [error], Console:: printSample()'s line writer [this, &sample], the anchor record of TRACe:DATA? (console_ commands.cpp) [this], and two that capture nothing: the status update's edge rule in console.cpp and bufferErased()'s byte test in flash_log.cpp. The gate is stricter than the rule: it fails a default capture in a transient lambda too. - 8.2.2, for FreeRTOS's tick macros. pdMS_
TO_ TICKS() and portMAX_DELAY, which expand to C-style casts where they are used, are gone from the sources: rtos:: ticksFromMs() converts in 64 bits with one static_cast and rtos:: kWaitForever is the largest tick count (firmware/ src/ rtos_ ticks.h). FreeRTOS's other macros the sources use may still expand to C-style casts of its own headers, whichever they are (among them pdTRUE, pdFALSE, pdPASS, configMINIMAL_ STACK_ SIZE, queueQUEUE_ TYPE_ RECURSIVE_ MUTEX, portYIELD_ FROM_ ISR(), xSemaphoreGive(), xSemaphoreGiveFromISR(), xSemaphoreCreateBinaryStatic(), xQueueCreateStatic(), xQueueSend()); they are adopted code's spelling, not counted here and not claimed, and the gate's list (BANNED_MACROS) is where one is added. - 8.2.6, no cast to a pointer from an integer or an enumeration. No explicit cast in firmware/src converts an integer or an enumeration to a pointer type; a register is reached through ESP-IDF's low-level layer, whose casts are adopted code. A null pointer constant and a cast from void* to a function pointer are the rule's own exceptions. The four casts from void* to an object pointer are D13, counted by the gate (d13.void_
pointer_ casts) and held to D13's rows. The gate sees an enumeration only where clang spells its type enum ..., as 7.0.5's reading does. - 8.14.1, no side effect on the right of && and ||. The right operand assigns nothing, steps nothing, and calls only functions that are constexpr or const members, or one of the gate's side-effect-free calls (PURE_CALLS: std::atomic's load(), std::array's size(), cbegin() and operator[], std::span's size(), std::
string_ view's size(), operator[], starts_with(), empty(), front(), back() and operator==, std::equal(), esp_ timer_ get_ time() and xPortGetCoreID(), each with its reason; a member function or an operator is matched by the class of its object as well as its name, so an own load() or empty() is judged by its declaration like any own function, since the review of 2026-11-24 (HM2-05); one the image no longer calls fails as stale, which took std::strlen() and std::strcmp() off it with FW-22). Of the 33 right operands the gate found in FW-20's tree (two more went with the recursion), the calls that write state or whose declaration does not say they do not (the bus reads and writes of the bring-up, the self-test, the clip and alert set-up and the charge read, the flash log's scan, erase check and acceptor, the I2C recovery, the parameter decodes, the ABORt match, the census query and the profile lookup) are made in statements of their own, each only while the ones before it succeeded, as the short circuit made them; the character classes, the I2C argument checks and the flash log's word read, which change nothing, are constexpr. - 8.19.1, no comma operator. The dump's column loop and equalsIgnoreCase() step their two cursors in statements of their own.
- 9.4.1, every if ... else if chain ends in an else. The 13 chains of FW-20's tree end in an else whose comment says why nothing is left to do.
- 9.5.1, every legacy for simple. A for declares one integer counter, compares it alone with a bound the body does not change, and steps it alone by a constant; the 28 that did not are while loops (a pointer or a cursor walking a string, a loop with a second condition, a counter the body steps itself), and the infinite loops are while ( true ). Whether 0.0.2's ban on an invariant controlling expression spares an infinite loop is not in MathWorks' page: to confirm against the owner's copy.
- 19.6.1, no #pragma. Every header of firmware/src is guarded by #ifndef KLEIDOS_
METER_<FILE>_H, #define of the same name as its first directives and #endif // KLEIDOS_ METER_<FILE>_H as its last line (ina228_regs.h: KLEIDOS_ METER_ INA228_ REGS_ H), in place of #pragma once: a departure from the Kleidos firmware repository's house style, taken on the owner's "MISRA max" ruling of 2026-11-20. No source holds a #pragma or a _Pragma. - 21.10.1, no <cstdarg> (FW-26, 2026-11-23). No source includes <cstdarg> or <stdarg.h>, names va_list or one of its macros, or declares a function with a C ellipsis; clang-tidy's cppcoreguidelines-pro-type-vararg and cert-dcl50-cpp hold it too ("The gates"). The console's four printf-style members (printLine, respond, respondMore, fail, C variadic functions reading a std::va_list) were the last, and went with the formatted output they served (30.0.1, next).
- 30.0.1, no formatted output of the C library (FW-26, 2026-11-23). No source includes <cstdio> or <stdio.h>, or calls a formatted input or output function of the C library (snprintf, vsnprintf and their kin) or the ROM's esp_
rom_ printf(). Every response, error, stream record and dump row is composed with the bounded writer of text.h, typed appends on std::to_chars into a caller's buffer, with no format string, no variadic call and nothing allocated, through the console's typed members (openUnit(), respondText(), respondNumber(), respondScaled(), respondMoreText(), openRecord(), endRecord(), openError(), failText(), failI2c()): FW-24 moved the relay bank's reports, the LED's, the parser's errors and the sampler's refusals, FW-25 console.cpp, and FW-26 console_ commands.cpp, whose 24 snprintf calls and four printf-style members were the last; app_main()'s fallback, where UART0 could not be set up, writes its line through the ROM's esp_ rom_ output_ putc(). The golden transcript (firmware/ test/ native/ golden/ console.transcript, docs/ testing.md) held every byte on the wire the same through the three steps. The deviation that recorded the formatter (D2) went with it, and so did the dead conversions it left (scpi:: formatScaled(), scale:: formatThousandths(), chars:: decimalDigit()).
- 8.2.10, no recursion (FW-21). clang-tidy's misc-no-recursion finds none and suppresses none (tests/
firmware/ test_ misra_ rules.py fails a NOLINT naming it anywhere under firmware/). The one recursive function, matchFrom() (firmware/ src/ scpi.cpp), the header matcher that tries each optional node of a pattern present and then absent, is an iterative backtracking search over a fixed stack of kMaxSegments + 1 levels, one per pattern node, in the order the recursion tried them, so every match and its suffix are what they were (the parser's tests unchanged); the deviation that recorded it (D4) went with it. - 7.0.4, in the sign extension (FW-21, by reading). scale::
decode20() and scale:: decode40() extend the sign of a register's 20 and 40 bits in unsigned arithmetic, by flipping the sign bit and subtracting its weight, where they shifted a signed value right; the scale tests are unchanged, and two more hold the bits above the field ignored. The rest of the tree is not claimed under 7.0.4, whose list of appropriate operands is not on MathWorks' page; the narrow unsigned operands its bitwise and shift operators promoted to int are gone with 7.0.5 (FW-23, above). - 21.6.1, 21.6.2 and 21.6.3: no dynamic memory, allocs_
since_ main=0 frees_ since_ main=0 for every operation (0.7.0 for the firmware's own code; FW-17 for everything that runs from app_main()'s first line, ESP-IDF included, the boot too; FW-19 for every operation the SCPI table offers, on the host and through the call graph). What ESP-IDF allocates before that line is D1, row by row. No new, delete, smart pointer, allocating container (std::vector, std::deque, the lists, maps and sets), std::string, std::function, C or heap_caps allocator, or dynamic FreeRTOS create anywhere in firmware/src; std::array and std::span, which allocate nothing, are used. The sampler's queue and four semaphores are xQueueCreateStatic / xSemaphoreCreateBinaryStatic over storage the Sampler holds; the one task the firmware creates, the sampler's, is xTaskCreateStaticPinnedToCore over a stack and control block the Sampler holds, and ESP-IDF's startup tasks are made by the same call in startup_ memory.cpp's wrap (src.static_ tasks under "The counts"), and the console runs on ESP-IDF's main task, which app_main() never leaves, whose stack and control block are static slots its creation is linked wrapped onto (startup_ memory.h, D1's review of 2026-11-24); the TRACE ring is a static 4 MiB array in PSRAM (EXT_ RAM_ BSS_ ATTR, app_main()) handed to Sampler:: begin(); the five objects are constinit statics. No deviation for the firmware's own code. Three gates hold it, cheapest first, a fourth holds what ESP-IDF allocates for it, and a fifth what any of it can reach: - Source gate (tests/
firmware/ test_ no_ dynamic_ memory.py, every run): the sources with comments and strings removed hold none of those constructs; the allow-list is empty and a planted case of each proves the gate sees it. It also holds the ring's declaration to no initializer, which .ext_ram.bss (a NOLOAD section) would drop without a word. - Object gate (scripts/
check_ heap_ objects.py, CI's firmware job): nm --undefined-only over every object of the firmware's component finds no reference to malloc, calloc, realloc, free, the heap_caps_* allocators, pvPortMalloc, vPortFree, a dynamic FreeRTOS create or any operator new / operator delete, so nothing a header or the compiler inserted allocates either; the count per image is in the job summary. - The counts since app_main() (heap_
monitor.cpp, DIAGnostic:HEAP?): with CONFIG_ HEAP_ USE_ HOOKS, ESP-IDF calls esp_ heap_ trace_ alloc_ hook and esp_ heap_ trace_ free_ hook from every allocation and free in the image, whatever task or interrupt makes it; the firmware counts them from the first hook call, split at app_main()'s first line, whose first statement arms the monitor (pre_ main_ allocs, pre_ main_ frees, allocs_ since_ main, frees_ since_ main; FW-07, FW-17), and the claim is both since-main counts at 0 after every operation. On the host, firmware/ test/ native/ test_ heap.cpp runs the every-command session (kEveryCommand, then kLastWord: every header of the console's kCommands at least once, tests/ firmware/ test_ heap_ session_ covers_ the_ table.py failing a header left out and a unit the table does not have; the saves of the tag, the date, the VBUS side, the shunt on each range and a null; *RST, *TST?, the watchdog's query, a scan, register reads, the lead cycle, the charge reset, the STATus subsystem, every capture profile with a ring dump, and the watchdog's forced reset as the last word) and requires both counts at 0 after each message, with another session of each profile, a full ring, a null and 500 queries; the fakes of the ESP-IDF drivers do not allocate as the real ones do, so those counts cover the firmware's own code, what the drivers would allocate is the ledger's (item 4) and the call graph's (item 5), and the device's evidence is the bench session (below). - What ESP-IDF allocates on the firmware's behalf (FW-08): the deny list of the ESP-IDF entry points that allocate or free on the device (a driver's install and delete, NVS's init, open and writes, the task watchdog's subscriptions, the interrupt allocator, the partition and flash calls whose region check takes an iterator, and the rest the lists name with their reasons), the allow-list of the calls the firmware still makes, each tied to D1 below (empty since FW-16), and the made-safe list (FW-16: esp_
flash_ write() and esp_ flash_ erase_ region() from flash_ port.cpp, which stay on the deny list because they allocate in ESP-IDF's default configuration, and allocate nothing in this image: their region check is linked wrapped onto a static table and CONFIG_ SPI_ FLASH_ DANGEROUS_ WRITE_ ALLOWED leaves out the other; and, from the review of 2026-11-24, esp_ flash_ read(), which reads into a destination outside internal RAM through a bounce buffer it takes from the heap (get_ temp_ buffer), and which flash_ log:: port:: read() never hands one: it refuses a destination esp_ ptr_ in_ dram() rejects before the call, and a host test plants one), are held by the source gate (by source file), the object gate (by object) and the host tests' ledger (firmware/ test/ native/ harness/ idf_ ledger.h: every fake of a listed entry point records its call, and every Bench and Scope fails a case that called one outside the allow-list), each of which fails a planted call in its self-test. tests/ firmware/ test_ idf_ allocation_ lists.py holds the three equal, every allowed call to the deviation that names it, and their history to an allow-list that only shrinks; the zero-allocation work packages take entries off it as they replace the drivers behind them. - What any of it can reach (FW-19, scripts/
check_ heap_ reachability.py, CI's firmware job): the linked image's call graph, built from the relocation records the device link keeps (-Wl,--emit-relocs, firmware/ CMakeLists.txt; the loaded bytes are the same), with every function of the firmware's own objects as a root, whether anything calls it or not, must reach no allocator. It sees what the other gates cannot: an allocation two calls deep in ESP-IDF behind a call the firmware makes, through a callback or a table, or through a link-time wrap. On 2026-11-23's image it walked 359 own functions to 661 functions and objects and 17 ROM functions, and met four cuts, each an edge from picolibc's stdin and stdout FILE objects (which every task's TLS template points to) to their close and setvbuf operations, which run only from a C stream function that nothing the walk reaches calls (the gate fails once one is reachable). Since the review of 2026-11-24 it reads the long calls the linker relaxed (HM2-01), which it had missed: then the FILE objects' put and get operations, which allocate their buffer on first use through calloc(), are cut the same way (eight cuts in all, their guards the C library's formatted and character input and output as well as its stream functions), and so is TLSF's default walker, which prints each block and which tlsf_ walk_ pool() takes only for a null walker, its one caller in the image, multi_ heap_ get_ info_ impl(), passing its own; on the image of that review it walked 387 own functions to 891 functions and objects and 24 ROM functions. Since the review of 2026-11-24 it also walks the flash calls through the three tables ESP-IDF's startup installs on the default chip before app_main(): its os functions (esp_ flash_ spi1_ default_ os_ functions, set by esp_ flash_ app_ enable_ os_ functions()), its chip driver (one of default_ registered_ chips, picked by detect_ spi_ flash_ chip()) and its host's driver (esp_ flash_ default_ host, set by memspi_ host_ init_ pointers(), HM2-02). Each esp_flash_* call the firmware makes gets an edge to each by name (RUNTIME_EDGES, stale when the image lacks a name), so the made-safe calls are walked to the flash's command layer (spi_ flash_ chip_ generic_*, memspi_host_*, spi_ flash_ hal_*, and the ROM's Cache_ Invalidate_ Addr, listed as a leaf), to their region check (the wrapped one) and to their bounce buffer, whose allocation and free are cut with the reason (a read into internal RAM only) and fail the gate once one of ESP-IDF's other flash readers is reachable. Before, the table was installed by startup code, which is not a root, and the made-safe test held only because the walk could not see the path. Its blind spots are stated in the script: the ROM's code is not read (each ROM function reached is listed with why it allocates nothing), an address made at run time from something other than a relocated value, or a table installed by code that is not a root and not named in RUNTIME_EDGES, is not an edge, and what runs with no own caller (ESP-IDF's startup, its IPC and idle tasks, its tick and cross-core interrupts) is not a root, which is what the device's counts are for.
- Source gate (tests/
Deviations
Each is a known departure, kept on purpose. A deviation is removed from this list by the change that removes it from the code. D2, the formatted output of console_
D1. Allocation by adopted code: ESP-IDF before app_main() (21.6.1, adopted code)
The firmware's own code allocates nothing, and from app_main()'s first line nothing allocates or frees at all, the boot included (FW-17). Nor does ESP-IDF's startup before that line, which the firmware does not run: no allocation and no free since the review of 2026-11-24 (DIAGnostic:HEAP?'s pre_
The residue
No row. The last one, R1, was esp_
D3. C arrays (11.3.1, advisory)
Buffers, tables and the anchor and mark arrays are C arrays of fixed size: 48 of them (d3.arrays in "The counts": variables, members and parameters of array type), from 137 before the formatter rewrite (FW-22 to FW-26) and 71 before the review of 2026-11-24, which made the command handlers' keyword tables, the reset reasons, the powers of ten, the INA228's conversion-time and averaging tables, the month lengths, a channel name's buffer and the MAC std::arrays, and formatSerial()'s MAC a fixed-extent std::span. The count is a ratchet since then (tests/
D5. Return values discarded on purpose (0.1.2)
A call whose result the code has no use for is cast to void, never left bare (FW-02: bugprone-unused-return-value with every function checked and the cast as the only way out). Every such call, d5.void_casts in all ("The counts"), is counted below by the function it calls, each with why its result is not needed; tests/
The discarded results, by the function called
| Function | Count | Why |
|---|---|---|
| .begin() | 1 | gRelays.begin() in app_main(): a bank that did not come up is read back from the bank (relay:: |
| .fetch_add() | 7 | an atomic counter's increment (the sampler's edge, read-failure and stale-edge counts, the heap hooks' counts): the value before the change is of no use to a counter |
| .fetch_or() | 3 | an atomic flag set (the sampler's diagnostic flags, the watchdog's subscriptions): the flags before the change are of no use |
| .finishZero() | 1 | *RST closing a null window it abandons: the result is discarded on purpose, as the window is |
| .load() | 1 | gCalibration.load() in app_main(): a log with no record it takes keeps the defaults, which report q=uncal |
| .readDiagAlrt() | 5 | a DIAG_ALRT read made for its side effect, releasing the ALERT pin and clearing the conversion-ready flag; its value is not used, and a bus that failed it fails the reads that follow, which report it |
| .setBusSpeed() | 2 | *RST restoring the reset clock, and a reverted apply restoring the running one: a refusal leaves the clock the console reports (Ina228Driver:: |
| .setProfile() | 3 | *RST, SENSe:PROFile and Console:: |
| .setRange() | 1 | an apply putting back the range the INA228's reset cleared: a refusal leaves the range the console reports (Ina228Driver:: |
| .setThreshold() | 3 | the threshold commands, whose one refusal for a level (a capture open) the table's R flag has raised, and whose other (a negative hysteresis) the command's own bound has |
| .setThresholdMarks() | 2 | as .setThreshold() |
| applyRangeParameter() | 1 | the command it serves reports its own refusals inside the call |
| gpio_config() | 1 | parking an unused pin: one that does not park stays as reset left it, and the others are parked by their own calls |
| gpio_ | 3 | the relay outputs' latch, written before and after the pad is configured; the pad's real level is read back (padMismatches()) |
| identity:: | 1 | an eFuse MAC that cannot be read leaves the serial 0, which the console reports as it is |
| maskParameter() | 4 | the STATus mask setters, which report a refused parameter inside the call |
| mountLog() | 2 | a log that does not mount is mounted again at the store's next call, and reported as q=uncal meanwhile (the calibration's); the pin map's save reads the sectors again itself, and fails if that read fails too |
| push() | 1 | the I2C command list's last entry, whose index the list's length bounds by construction |
| recover() | 3 | the I2C master's recovery after a time-out, a fault or a held bus: the transaction reports the time-out either way, and the next one finds the bus as the recovery left it |
| readShuntPicovolts() | 2 | an apply's rest check reading the shunt before and after a relay move: a reading that fails leaves the stored null in its place, a share of nothing, which is not judged before the move and puts the map back after it |
| reportFunction() | 8 | the measurement queries, which answer or fail inside the call |
| selectRange() | 2 | *RST and the range command, which report a refusal inside the call |
| parseNumber() | 2 | the whole and the fractional digits of a decimal parameter (scpi:: |
| std::copy() | 2 | the end iterator of a copy whose length each site already holds |
| std::copy_n() | 12 | as std::copy() |
| uart0:: | 1 | the console's start empties the receive ring and takes its overrun with it: what came before the announcement is discarded, a loss in it included |
| waitUntil() | 2 | the sampler's settling waits before a capture and a pace probe: the time the wait was entered, which it returns, matters only to the paced loop that reads it |
| watchdog:: | 1 | a watchdog that did not start is read back by watchdog:: |
| watchdog:: | 2 | as watchdog:: |
| xSemaphoreGive() | 4 | a give to a binary semaphore that may already be given, which a waiter takes once either way |
| xSemaphoreGiveFromISR() | 2 | as xSemaphoreGive(), from the ALERT and UART0 interrupts |
| xSemaphoreTake() | 6 | a take with no wait that forgets a stale give, or a bounded wait whose end the code reads from the data, not from the result |
D6. ESP-IDF configuration structs zero-initialized (withdrawn in FW-14; no rule; adopted headers)
No site is left, and the number is kept so that D7 keeps its own; D4, the one recursive function (8.2.10), went in FW-21 with the recursion, and its number is not reused either. The number after D7 was the maintenance operations' deviation, removed in FW-16 with the last of them; it is not reused, so the deviations FW-20 added start at D9. An ESP-IDF driver's configuration struct was value-initialized with = {} and then every field the firmware needed was assigned; its enums have no zero enumerator, which bugprone-invalid-enum-default-initialization reports, and each site carried a NOLINT. FW-10 removed rmt_
D7. Names fixed by others (no rule; naming)
app_main is the name ESP-IDF calls, RMTMEM (status_
D9. Static locals (6.7.1)
The firmware's objects have static storage, so that nothing is allocated and nothing needs a constructor order across files, and each lives inside the one function that hands out references to it, so that none is a global (6.7.2, "Held"). That is exactly what 6.7.1 forbids: a local variable of static storage, const and constexpr objects excepted (MathWorks' reading). The table is every one of them; scripts/
The static locals
| File | Function | Object | Why |
|---|---|---|---|
| flash_log.cpp | state | instance | each record log's state, one per flash_ |
| heap_ | state | instance | the heap hooks' counts and the census ring, written from any task or interrupt that allocates, so they exist before the first hook call (before app_main()) |
| i2c_bus.cpp | state | instance | the own I2C master's state: the clock, the core it runs on and the transaction in flight |
| main.cpp | app_main | gCalibration | one of the six objects of the instrument (docs/ |
| main.cpp | app_main | gConsole | the console, which runs on the main task app_main() never leaves |
| main.cpp | app_main | gDevice | the INA228 driver |
| main.cpp | app_main | gPins | the pin map the boot runs, read before a pin is driven (FW-04) |
| main.cpp | app_main | gRelays | the relay bank |
| main.cpp | app_main | gRing | the TRACE ring, 4 MiB in PSRAM (EXT_ |
| main.cpp | app_main | gSampler | the sampler, its tasks' stacks and control blocks inside it |
| relay.cpp | detail:: | kept | the relays energized when the last reset came, kept across it in RTC memory (D11) |
| startup_ | state | instance | what ESP-IDF's startup is served before app_main() (D1, "What the review of 2026-11-24 took off"): the idle tasks' stacks and control blocks, handed out by the wrapped vApplicationGetIdleTaskMemory(); the IPC tasks' and the main task's static slots, created by the wrapped xTaskCreatePinnedToCore(); the flash lock's StaticQueue_t and, from ESP-IDF 6.1.1, the SPI1 flash API's two plain mutexes', made by the wrapped xQueueCreateMutex(); the mmap lock's two binary semaphores' StaticSemaphore_ |
| uart0.cpp | state | instance | the console's UART: its receive ring, its flags and its semaphore, written by its interrupt |
| watchdog.cpp | state | instance | the own watchdog's check-in mask, written by the console, the sampler and Core 0's idle hook |
D10. What C++17 does not have (4.1.1)
MISRA C++:2023 is written against C++17 and 4.1.1 asks a program to conform to it. The firmware is built as -std=gnu++26 (firmware/
What C++17 does not have
D11. The relay bank's reset record (4.1.1; 6.7.1 as D9)
relay::
D12. What 7.0.5's reading passes, to confirm against the owner's copy (7.0.5)
The gate ("Held") reads 7.0.5 as clang writes the conversions, and finds nothing in the image. Two things it passes, and one it does not read, are recorded here, because MathWorks' page lists no exception and does not say how its checker reads them; each is to confirm against the owner's copy of the standard:
- A narrow unsigned operand that meets a wider unsigned one (flags & kMask with flags a std::uint8_t and kMask a std::uint32_t). The language promotes the narrow operand to int first and then converts it to the unsigned type; clang writes the two steps as one conversion, unsigned to unsigned, and the gate reads no change of signedness. The value never passes through a negative int. This is the shape FW-23's std::uint32_t masks give every flag test and field read on a register value, d12.widened_
operands in "The counts" (held by tests/ firmware/ test_ misra_ rules.py); a reading that counts the intermediate promotion would report each, and the remedy would be an explicit static_ cast<std:: uint32_ t> on each narrow operand, or the narrow members widened at their declaration. - An integer literal is an operand like any other. A literal of type int that meets an unsigned operand is reported and was suffixed (318 of them), although its value is never negative; if the rule's text exempts a non-negative constant expression, those suffixes are harmless and stay.
- Not read: an enumeration's promotion (its underlying type is not looked up), and a conversion inside a macro's expansion, which for ESP-IDF's and FreeRTOS's macros is adopted code (RMT_
LL_ MAX_ LOOP_ COUNT_ PER_ BATCH, U0TXD_ GPIO_ NUM and the other macros the sources compare are cast where they are used).
D13. A callback's context cast from void* (8.2.6, required)
ESP-IDF's IPC call (esp_
| File | Function | Registered with | What the context is |
|---|---|---|---|
| ina228.cpp | Ina228Driver:: | esp_ | the BusRequest on Ina228Driver:: |
| main.cpp | bootOnSamplerCore() | esp_ | app_main()'s SamplerCoreBoot |
| pin_apply.cpp | onBusCore() | esp_ | the move's half pin_ |
| sampler.cpp | Sampler:: | interrupt:: | the Sampler whose ALERT line it is |
| sampler.cpp | Sampler:: | xTaskCreateStaticPinnedToCore() | the Sampler whose task it is |
Tool suppressions
Every place a static analyzer is told not to report, under firmware/ and in .cppcheck-suppress. scripts/
| File | Marker | Checks | Count | Why |
|---|---|---|---|---|
| .cppcheck-suppress | list | missingIncludeSystem | 1 | the standard and ESP-IDF headers are not given to cppcheck, which reads the host harness's fake ESP-IDF for the project's own includes only; an information check the run does not enable, kept as the firmware repository keeps it |
| .cppcheck-suppress | list | shadowFunction | 1 | a parameter named after the accessor of the value it carries (setProfile( Profile profile ) beside profile()) hides no variable: -Wshadow, which the compiler gates, and 6.4.1 are about variables |
| .cppcheck-suppress | list | unmatchedSuppression | 1 | an inline suppression that a later fix made unnecessary is not cppcheck's error; it is this table's, which fails a stale row |
| .cppcheck-suppress | list | useStlAlgorithm | 1 | a raw loop over a fixed table is kept where an algorithm would hide a bound or an early exit the code relies on |
| firmware/ | NOLINTBEGIN | readability-identifier-naming | 1 | the one-letter flag aliases D, R, C, N of Console:: |
| firmware/ | NOLINT | clang-analyzer-optin.performance.Padding | 1 | Console's members stay grouped by role, as the reference documents them, not sorted by alignment; the one static instance spends the padding (the quality kit's analyzer, from the kit 3 switch) |
| firmware/ | cppcheck-suppress | constParameterReference | 1 | a command handler that does not write its Call still has the table's Handler type |
| firmware/ | NOLINTNEXTLINE | bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming | 1 | _ |
| firmware/ | NOLINTNEXTLINE | bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming | 1 | its declaration |
| firmware/ | cppcheck-suppress | constParameterPointer | 2 | the heap hooks' parameters, whose signatures are ESP-IDF's |
| firmware/ | NOLINT | readability-identifier-naming | 1 | app_main, the name ESP-IDF calls (D7) |
| firmware/ | NOLINT | clang-analyzer-optin.performance.Padding | 2 | CaptureStats in the order FETCh:STATistics? reports it and Sampler's members grouped by role, not sorted by alignment, for a few bytes of static RAM |
| firmware/ | NOLINT | bugprone-branch-clone | 1 | two ways to a zero magnitude kept apart on purpose: a zero mantissa, at any exponent, and a value below the unit's resolution |
| firmware/ | NOLINTNEXTLINE | bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming | 7 | _ |
| firmware/ | NOLINTNEXTLINE | bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp,readability-identifier-naming | 7 | their declarations |
| firmware/ | NOLINTNEXTLINE | readability-identifier-naming | 1 | RMTMEM, the linker script's name for the RMT's RAM (D7) |
| firmware/ | NOLINTNEXTLINE | readability-identifier-naming | 1 | the host harness's definition of RMTMEM, the same name |
The counts
Every count this page states about the sources, read by a script and compared by a test: scripts/
| Key | What | Count |
|---|---|---|
| d3.arrays | C arrays declared: variables, members and parameters of array type (D3, 11.3.1), a ratchet | 48 |
| d3.decays | arrays that decay to a pointer as a call's or a construction's argument (7.11.2), the ratchet | 0 |
| d3.literal_ | string literals passed the same way, counted apart (D3) | 887 |
| d5.void_casts | calls whose result is cast to void (D5) | 91 |
| d12.widened_ | narrow unsigned operands converted in one step to a wider unsigned type (D12, scripts/ | 65 |
| d13.void_ | casts of a callback's void* context to an object pointer (D13, 8.2.6, scripts/ | 5 |
| src.sources | translation units of firmware/ | 23 |
| src.static_ | calls of xTaskCreateStaticPinnedToCore in firmware/src, each over static memory (21.6.1): the sampler's task, and the wrap that makes ESP-IDF's IPC and main tasks | 2 |
| src.lambdas | lambda expressions written in firmware/src, each naming what it captures (8.1.2, scripts/ | 6 |
The claim on the device: the bench session
The host session proves the firmware's own code against the harness's fakes, and the reachability gate what the image can call; the claim itself, allocs_
- host/.venv/
bin/ python -m pytest -q -W error tests/bench --run-bench --meter-port "$KLEIDOS_ METER_ PORT" --bench-lock <lock> --bench-long --bench-record <file> --bench-session-record <file>. The heap sweep (tests/ bench/ test_ heap_ sweep.py) reboots the meter through the carrier's auto-reset, waits for the power-on bit and reads DIAGnostic:HEAP?: armed=1, pre_ main_ allocs and pre_ main_ frees equal to D1's rows and its freed rows ([boot] of tests/ bench/ heap_ expectations.toml, which tests/ bench/ test_ bench_ support.py holds to the table), and allocs_ since_ main, frees_ since_ main, allocs_ after_ init and frees_ after_ init at 0. - Every command family of docs/scpi.md (SWEEP of tests/
bench/ bench_ support.py: the common commands with *TST?, SYSTem, STATus, SENSe with the charge reset, the ranges, SAMPle, FORMat and TRIGger, CONFigure, MEASure, READ and FETCh, a capture of each profile with a mark, the ring's RAW and SCALed dumps, two clock changes, the calibration reads, a calibration save that changes the record and writes it back, a null with its save, DIAGnostic with a scan and register reads, the relay orders, 500 SYSTem:STATus? and *RST), each followed by a DIAGnostic:HEAP? that must read the four since-main keys at 0 and the pre-main counts unchanged; the console's stack must keep 0.16.6's margin after it. - The rest of the suite on the same image: 20 calibration saves that change the record and a reboot (test_
calibration_ bench.py), three clock changes and every profile at its clock (test_ i2c_ bench.py), the watchdog's forced reset, a 600 s idle and a full TRACE ring with its dump (test_ watchdog_ bench.py), the console's line under load and a provoked overrun (test_ uart_ bench.py), the pin map applied, put back, moved and defaulted (test_ pins_ bench.py, 0.18.0) and the averaging override on and off (test_ averaging_ bench.py, 0.18.0), each reading the heap counts where it moves a state. - The session on one boot (test_
heap_ session.py, --bench-long): step 2's families again and a full TRACE ring with its whole RAW and SCALed dumps, with no reset in between; DIAGnostic:HEAP? at its end reads both since-main counts at 0 and the pre-main counts D1's. - The panel's bench test (host/
tests/ test_ panel_ bench.py --run-bench, host/ README.md): the same counts unmoved under kleidos-meter serve, a 10 s STATE capture whose every sample reached the live events (the rows the Server-Sent Events carried equal FETCh:STATistics?'s samples, with dropped=0), a null on the relay path and a TRACE ring decoded on the host; then, from 0.18.0, the same serve from its page in a headless Chromium (run_ page_ scenario): the Pins view drawing the live map, SDA moved to an unwired pin applied from the page and put back by the instrument with its sentence and 117, the live chart at 100 ms of smoothing on the meter's STATE samples, its readout's mean in view the capture's FETCh:STATistics? mean_na to the page's four digits, and a run recorded with the INA228's averaging on (AVG 16) named in its meta.json, the averaging off again. - The record (--bench-record, --bench-session-record): fw, elf, serial, the boot's four counts, each family's change in the since-main counts (every one 0), and anything unexpected.
The run of record: 0.18.0
Status: passed on 2026-11-26 but for one case, that case passing alone four times on the same image. Firmware 0.18.0, image meter, built through the Kleidos firmware repository's scripts/
- The flash. Uploaded over the integration's image, the calibration partition kept: the first boot read q=cal, src=default, *TST? 0, DIAGnostic:HEAP? all four counts 0, and kleidos-meter calibration verify answered applied before the run and at its end, so no restore was needed.
- The pin map first (test_
pins_ bench.py alone, before the suite): 9 of 9 in 96 s. - The suite (tests/bench --run-bench --bench-long): 71 cases; 70 passed in 37 min 51 s, among them the heap sweep (the boot's four counts 0, 0, 0 and 0, each of its 20 steps 0 allocations and 0 frees, no unexpected error), the pin map's (four wrong maps each put back with one 117 in 0.05 to 0.06 s; the DUT's current with GPIO7 driven high 42.47 µA, parked high 42.19 µA and parked low after a reboot 42.51 µA), the averaging override's (the null path's standard deviation 18.78, 4.89 and 2.59 µA at AVG 1, 16 and 64, pace_err_ppm 98 to 100, nothing dropped), the I2C bus at its three clocks, the line, the calibration saves, the watchdog's forced reset, the 600 s idle and the session on one boot (a full TRACE ring of 1,048,576 samples in 293.6 s, dropped=0 read_err=0 stale_edges=0, its RAW and SCALed dumps, 3,760,443 and 36,583,759 bytes, each whole at the first request, every count of the end 0 and every free figure as at the boot, stack_
console=5792). The one failure was test_ a_ relay_ moved_ off_ its_ wire_ fails_ its_ null_ path_ check_ and_ comes_ back[relay1]: with Relay 1 stored on GPIO16, after the meter's reboot, the DUT's current read 21.83 µA against 43.02 µA before the move, 43.15 µA moved and 42.45 µA back, outside the 10 µA the test allows. The same test passed in the pin map's run before the suite (39.49 µA after the reboot) and in three runs of that file after it (43.69, 43.58 and 43.33 µA), and the suite's own case for GPIO7 parked low after a reboot read 42.51 µA, so Relay 1's input held released under GPIO7's pull-down there; why one 8 s capture read half the DUT's current was not found (the DUT's own draw, or Relay 1 under the pull-down at that boot, are the candidates), and nothing in the firmware's answers differed. - The panel (host/
tests/ test_ panel_ bench.py --run-bench --bench-shots, kleidos-meter serve on the same image, 9 of 9 in 60 s): HEALTH and NULL_RELAY done; a 10 s STATE capture of 8,732 samples, all 8,732 as rows over Server-Sent Events; a TRACE ring of 11,063 samples decoded on the host and equal to the instrument's SCALed dump; then the page in a headless Chromium: the Pins view drew the default map the instrument reported; SDA moved to GPIO18 was applied from the page and put back by the instrument ("Reverted: the INA228 did not answer on the map's SDA, SCL and address. The last good map is back.", 117); the live chart at 100 ms of smoothing on an 8 s STATE capture gave in its readout a mean in view of 43.24 µA against FETCh:STATistics?'s mean_ na=43242.86; a run recorded with the INA228's averaging on named it in its meta.json (state=on count=16 conversion_ us=1052 period_ us=18432), and the averaging was off again after it; the page's self-test read "0: every part passes."; the six heap counts 0 at the start and at the end; the verdict applied at both. Its images of the Live, Pins and Calibration and health views are the bench images of “On the bench” in the panel's guide. - The state it was left in. *TST? 0 and SYSTem:ERRor:ALL? 0,"No error"; SYSTem:PINS? the default map (src=default verified=1) with nothing staged, SENSe:AVERage? 0, FORMat? TEXT, ROUTe:STATe? path=shunt, DIAGnostic:HEAP? allocs_
since_ main=0 frees_ since_ main=0, the calibration applied.
The candidate's run: 0.18.0 (FW-09)
Status: passed on 2026-11-26, the heap session on its second run, on FW-09's candidate image, before the review of that day changed the firmware. Firmware 0.18.0, image meter, built through the Kleidos firmware repository's scripts/
- The flash. Uploaded over FW-08's image, the calibration partition kept: the first boot read q=cal, src=default, *TST? 0, DIAGnostic:HEAP? all four counts 0, and kleidos-meter calibration verify answered applied before the run and at its end, so no restore was needed.
- The suite (tests/bench --run-bench --bench-long): 69 cases; 68 passed in 46 min 50 s, among them the heap sweep (the boot's four counts 0, 0, 0 and 0, and each of its 20 steps 0 allocations and 0 frees, the pin map's family included, with no unexpected error), the pin map's seven (five wrong maps each put back with one 117, a relay moved and back, a stored map and DEFault), the averaging override's fifteen (STATE at AVG 16 and 64 on ALERT, 18,432 and 73,728 µs, pace_err_ppm 108 and 111, nothing dropped; the null path's standard deviation 18.88, 4.67 and 2.44 µA at AVG 1, 16 and 64), the I2C bus, the line, the calibration saves, the watchdog's forced reset, the 600 s idle and the full ring. The heap session failed on its dump: the full ring's SCALed dump (about 36.6 MB) did not arrive whole in three attempts (twice no block within 300 s, once a block whose CRC-32 did not match), while the host ran the repository's test run and its hooks and other builds beside it ("A damaged dump is the line's", docs/
testing.md); no heap count had moved. - The session (test_
heap_ session.py, run again alone on the same image with the host otherwise quiet: passed in 7 min 9 s). On one boot: every step of the sweep, a full TRACE ring (1,048,576 samples in 293.6 s, dropped=0 read_err=0 stale_edges=0) and its RAW (3,758,332 bytes) and SCALed (36,620,260 bytes) dumps, each whole at the first request, 500 SYSTem:STATus? and *RST ended at armed=1 allocs_ after_ init=0 frees_ after_ init=0 maint_ allocs=0 maint_frees=0 pre_ main_ allocs=0 pre_ main_ frees=0 allocs_ since_ main=0 frees_ since_ main=0, every free figure as at the boot (free_ internal=337700 min_ free_ internal=337700 largest_ internal=270324 free_spiram=0), stack_ console=5792 (the floor is 5,160), DIAGnostic:WATChdog? stalls=0 and SYSTem:HEALth? reset=poweron on the same boot. - The panel (host/
tests/ test_ panel_ bench.py --run-bench --bench-shots, kleidos-meter serve on the same image, 9 of 9 in 60 s): HEALTH and NULL_RELAY done; a 10 s STATE capture of 8,747 samples, all 8,747 as rows over Server-Sent Events; a TRACE ring of 10,981 samples decoded on the host and equal to the instrument's SCALed dump; then the page in a headless Chromium: the Pins view drew the default map the instrument reported (src=default); SDA moved to GPIO18 was applied from the page and put back by the instrument ("Reverted: the INA228 did not answer on the map's SDA, SCL and address. The last good map is back.", 117), the live map and *TST? 0 as before; the live chart at 100 ms of smoothing on an 8 s STATE capture gave in its readout a mean in view of 43.05 µA against FETCh:STATistics?'s mean_ na=43051.157; a run recorded with the INA228's averaging on named it in its meta.json (state=on count=16 conversion_ us=1052 period_ us=18432), and the averaging was off again after it; the page's self-test read "0: every part passes."; the six heap counts 0 at the start and at the end; the verdict applied at both. Its images of the Live, Pins and Calibration and health views were kept for the panel's pages, as bench images of that date and elf=. - The state it was left in. *TST? 0 and SYSTem:ERRor:ALL? 0,"No error"; SYSTem:PINS? the default map (src=default verified=1) with nothing staged, SENSe:AVERage? 0, FORMat? TEXT, ROUTe:STATe? path=shunt, DIAGnostic:HEAP? allocs_
since_ main=0 frees_ since_ main=0, the calibration applied.
The run of record: 0.17.0
Status: passed on 2026-11-24. Firmware 0.17.0, image meter, a clean build (firmware/.pio/
- The flash. The image was uploaded over the previous one, the calibration partition kept: the first boot read q=cal, kleidos-meter calibration verify answered applied before the run and again at its end, and DIAGnostic:HEAP? read pre_
main_ allocs=0 pre_ main_ frees=0 allocs_ since_ main=0 frees_ since_ main=0. - The suite (tests/bench --run-bench --bench-long, the record in --bench-record and --bench-session-record): 46 of 46 cases passed in 42 min 39 s, no case skipped: the suite's own support, the calibration saves and the reboot, the heap sweep (the boot's four counts 0, 0, 0 and 0, every one of its 19 steps 0 allocations and 0 frees, the end's four counts 0, and no unexpected error), the I2C bus, the line, the watchdog's forced reset, the 600 s idle, the full ring and the session below.
- The session (test_
heap_ session.py, in the same run). On one boot: every step of the sweep, a full TRACE ring (1,048,576 samples in 293.6 s, dropped=0 read_err=0 stale_edges=0) and its RAW (3,773,552 bytes) and SCALed (36,566,991 bytes) dumps, 500 SYSTem:STATus? and *RST ended at armed=1 allocs_ after_ init=0 frees_ after_ init=0 maint_ allocs=0 maint_frees=0 pre_ main_ allocs=0 pre_ main_ frees=0 allocs_ since_ main=0 frees_ since_ main=0, with every free figure as at the boot (free_ internal=338084 min_ free_ internal=338084 largest_ internal=270324 free_spiram=0), stack_ console=5840 (the floor is 5,160), DIAGnostic:WATChdog? stalls=0 and SYSTem:HEALth? reset=poweron on the same boot. pre_ main_ allocs and pre_ main_ frees are D1's rows, none. The SCALed dump was asked for three times: twice no block arrived within 300 s, the third came whole (docs/ testing.md, "A damaged dump is the line's"); no heap count moved. - The panel (host/
tests/ test_ panel_ bench.py --run-bench, kleidos-meter serve on the same image, 9 of 9 in 34 s): HEALTH and NULL_RELAY done; a 10 s STATE capture of 8,745 samples, all 8,745 as rows over Server-Sent Events, equal to FETCh:STATistics?'s samples; a TRACE ring of 11,000 samples decoded on the host; the six heap counts 0 at the start and at the end; the verdict applied at both. - The state it was left in. *TST? 0 and SYSTem:ERRor:ALL? 0,"No error"; FORMat? TEXT, ROUTe:STATe? path=shunt, the calibration applied.
The bench transcripts of docs/scpi.md, docs/usage.md, docs/panel.md and docs/
Earlier sessions of record: the 0.7.0 keys
Until FW-07 the device reported only the steady-state keys, counted from a quarter of a second after the boot, and until FW-16 two operations, a calibration save and (until FW-14) an I²C clock change, were maintenance, counted apart in maint_allocs and maint_frees under a deviation FW-16 retired with the last of them. The claim then read "heap-free from the end of the boot, but for the maintenance operations", and this was its procedure, on a freshly booted meter with a DUT drawing a few milliamps through the shunt:
- Wait a second after the power-on bit appears, then DIAGnostic:HEAP?: armed=1 and all four counts 0.
- Each profile captured and closed (SENSe:PROFile STATE, SLEEP, TRACE, then BURST at SYSTem:COMMunicate:I2C:FREQuency 1000000, each INITiate, a few seconds, ABORt, FETCh:STATistics?); a full TRACE ring and its whole TRACe:DATA? dump; a MEASure:CURRent?; ROUTe:NULLpath ON, CALibration:ZERO 10, ABORt, CALibration:ZERO:RESult? (stored=1 makes one save), ROUTe:NULLpath OFF; SENSe:CURRent:RANGe:INDex 1 and back to 0; every relay order; 500 SYSTem:STATus?.
- DIAGnostic:HEAP? again: allocs_
after_ init=0 frees_ after_ init=0. maint_allocs and maint_frees are whatever the save and the clock changes cost, and are recorded beside the result with min_ free_ internal.
Status: passed on 2026-11-20. Firmware 0.8.0, image meter, built from 5e7b0c0 (tag v0.8.0), ELF SHA-256 7a0defadeefb8b768fc58dfc4a39a7e19d817c545c6dc7c6a2dea3d67bc2d8ee (SYSTem:INFormation? elf=7a0defadeefb8b76), instrument KM-0000000000, its calibration applied by kleidos-meter calibration verify before the session and after it.
- The boot. The meter was rebooted through the carrier's auto-reset (RTS asserted for 100 ms with DTR released, docs/
carrier-board.md §7); the next *ESR? answered 1.08 s later with the power-on bit set, and one second after it DIAGnostic:HEAP? read armed=1 allocs_ after_ init=0 frees_ after_ init=0 maint_ allocs=0 maint_frees=0. - Step 2, as written. STATE, SLEEP, TRACE and BURST (at SYSTem:COMMunicate:I2C:FREQuency 1000000, set back to 400000 after it) each captured for 4 to 5 s and closed with ABORt and FETCh:STATistics?; a STATE capture with ROUTe:RELay3 ON,LIVE, ROUTe:RELay3 OFF,LIVE and a TRACe:MARK in it; a full TRACE ring (1,048,576 samples over 293.6 s) and its whole TRACe:DATA? (SCALed, 36,654,290 bytes in 222 s); MEASure:CURRent?; ROUTe:NULLpath ON, CALibration:ZERO 10, 11 s, ABORt, CALibration:ZERO:RESult? (stored=1), ROUTe:NULLpath OFF; SENSe:CURRent:RANGe:INDex 1 and back to 0; the relay orders ROUTe:BYPass ON and OFF with and without FORCe, ROUTe:LEAD OPEN and CLOSe (the bare OPEN on path=shunt refused with 109, then given with FORCe), ROUTe:NULLpath ON and OFF again, ROUTe:RELay3 and ROUTe:RELay4 ON and OFF, and ROUTe:RELay1 ON (refused, -114); 500 SYSTem:STATus?.
- The result. The last DIAGnostic:HEAP?: allocs_
after_ init=0 frees_ after_ init=0 maint_ allocs=15 maint_ frees=15, free_ internal=338663 min_ free_ internal=302284 largest_ internal=241664 free_ spiram=4187740, every byte figure the same as at the first reading (the low-water mark is the boot's). The maintenance count is the two maintenance operations of the time: the two I2C clock changes at two allocations and two frees each (maint_ allocs=2 maint_frees=2 after the first, 4 after the second) and the null window's one save at 11 of each. No allocation outside them: the claim holds. - One departure from the setting. The DUT, a T-Deck also on its USB supply, drew about 12 to 17 µA through the shunt rather than a few milliamps, so ROUTe:NULLpath ON answered check=unverified (README.md, "The relays: a null without hands"); the null was stored all the same, and every code path of the procedure ran. The range 0 null it stored is session state and is taken again, as calibration/
README.md says, before a measurement relies on it.
Again with 0.9.0 (2026-11-20, ELF 9f812041835d2a89, the pacing session of docs/
What allocates, and where: the census of 2026-11-22
The counts by phase say how much; the census build says where (firmware/
| Phase | From | Allocations | Frees | Bytes | What |
|---|---|---|---|---|---|
| before app_main() | ESP-IDF | 39 | 4 | 50,855 | the interrupt allocator's records (12, 4 freed), the IPC tasks (4), the main task (2), the idle tasks' stacks and control blocks (4), pthread's and the flash and RSA locks (6), PSRAM's heap registration and its 32 KiB DMA reserve (3), VFS (2), the task watchdog (2), the C library, a pthread key, the RTC interrupt and mbedTLS's PSA init (1 each) |
| since | led::blankAll, blankOne | 35 | 22 | 1,936 | the RMT channel, its transaction queue, encoder, group, interrupt and the C library's lazy locks it takes, created and deleted to write the LED's off frame |
| since | app_main | 19 | 7 | 2,336 | nvs_ |
| since | Console:: | 9 | 0 | 2,444 | uart_ |
| since | Ina228Driver:: | 11 | 0 | 1,344 | i2c_ |
| since | CalibrationStore:: | 2 | 0 | 40 | nvs_open()'s handle |
| since | Sampler:: | 2 | 0 | 32 | the task watchdog's two subscriptions |
| since | Sampler:: | 1 | 0 | 392 | gpio_ |
| since | ESP-IDF | 0 | 2 | 0 | the idle task freeing the main task's stack and control block once app_main() returned (until FW-17) |
The before app_main() row is FW-07's; from FW-18 it was 16 allocations and 4 frees, 17,380 B, one row each in D1's residue table, and the census build of FW-18's commit held 20 events, all of them before app_main(); from the review of 2026-11-24 it is 1 allocation, the C library's environ, and the census holds that one event. FW-09 took the Sampler::
The per-site table (75 rows on this image, each with its file and line in ESP-IDF 6.0.3 and the wrapper it went through) is the script's output, reproduced from any census build of a commit; D1 above and "How the allocations left" below are written from it and from the census of the maintenance operations (FW-08). After the boot, until FW-16, the sweep's command families allocated only in the maintenance operations, the deviation FW-16 retired: 21 or 22 allocations and as many frees for two calibration saves that change the stored record, 10 to 12 of each for the null window's save; until FW-14 also 4 and 4 for two I2C clock changes. From FW-16 no family allocates or frees anything (tests/
How the allocations left: FW-07 to the review of 2026-11-24
The record of what each work package took off, before app_main() and after it, from the census of 2026-11-22 to the residue D1 lists. Nothing here is still allocated.
What the move to ESP-IDF 6.1.1 added
ESP-IDF 6.1 moved the SPI1 flash API's locks into its startup on every target but the ESP32: esp_
| Site | Objects | Now |
|---|---|---|
| _lock_init() from esp_ | 2 | _ |
| flash_ | 2 | _ |
flash_
What the review of 2026-11-24 took off
FW-18 recorded sixteen rows and said the fifteen past R1 had no remedy; two of its reasons were wrong (the flash lock's handle is whatever xQueueCreateMutex() returns, which a wrap of the callee serves, and the system interrupts' handlers and arguments are parameters of esp_
| Was | Census of FW-18 | Site | Bytes | Now |
|---|---|---|---|---|
| R2 | 1 | spi_ | 84 | _ |
| R3 to R6 | 2 to 5 | esp_ | 8,392 | _ |
| R9, R10 | 9, 10 | esp_ | 8,804 | the same wrap, its main slot |
| R7, R8, R11 to R16 | 6, 7, 11, 12, 14, 15, 17, 18 | esp_ | 96 | _ |
| R1 | 0 (of the review's first commit) | esp_ | 4 | _ |
ESP-IDF's own xTaskCreatePinnedToCore(), xQueueCreateMutex() and esp_
What FW-18 took off
Fifteen allocations, 37,868 bytes, by configuration first and by a wrap or an own driver where no option exists (the census build of FW-17's commit, read on the meter on 2026-11-23, against FW-18's):
- PSRAM in the heap (3: its region record, 36 B, and the 32 KiB internal DMA reserve with its record, 32,768 and 36 B). CONFIG_
SPIRAM_ USE_ MEMMAP maps PSRAM without registering it as a heap; the TRACE ring, PSRAM's one user, is placed at link time in .ext_ram.bss, which ESP-IDF zeroes at boot whatever the access method (esp_ psram_ bss_ init()). On the meter (2026-11-23, against FW-17's image 1103c514a1c75d83): largest_ internal 237,556 to 270,324 bytes (+32,768, the reserve), min_ free_ internal 300,304 to 337,084 (+36,780: the reserve was taken out of the heap and then added back as a region of its own, so the boot's low-water mark sat 32 KiB lower), free_internal 332,323 to 337,108 (+4,785: the reserve was counted as free before, though only internal and DMA requests could have it), and free_spiram 4,192,124 to 0. - PSA's initialization (5: two mutexes of 8 and 84 B each and the key slots' 1,408 B). Nothing in the image uses PSA, mbedTLS's startup hook calls psa_
crypto_ init() regardless, and no option leaves the hook out; the image is linked with -Wl,--wrap=psa_ crypto_ init onto _ _ wrap_ psa_ crypto_ init() (firmware/ src/ startup_ memory.h), which answers PSA_SUCCESS and initializes nothing, and PSA's code leaves the image with its only caller. scripts/ check_ heap_ objects.py --elf fails an image that links a psa_ or mbedtls_ function. - The idle tasks' memory (4: two stacks of 1,596 B and two control blocks of 100 B). ESP-IDF's vApplicationGetIdleTaskMemory() takes them from the heap and has no option; -Wl,--wrap=vApplicationGetIdleTaskMemory hands FreeRTOS two static slots of the same size in internal RAM instead (startup_
memory.h). - The brownout interrupt (3: rtc_
isr_ register()'s record, 20 B, and the allocator's handle and descriptor, 8 and 16 B). ESP-IDF armed the detector with an interrupt because the promptless CONFIG_ SPI_ FLASH_ BROWNOUT_ RESET selects one, to reset an XMC flash chip; the meter's flash is a BoyaMicro part (manufacturer 0x68). CONFIG_ ESP_ BROWNOUT_ DET=n leaves ESP-IDF's handling out and firmware/ src/ brownout.h arms the detector as ESP-IDF does without the interrupt, at the same level, right after app_main() releases the relays, with nothing allocated. - Not needed: VFS and mbedTLS's hardware options. The VFS's two allocations (esp_
vfs_ register_ fs_ common(), 63 B) and mbedTLS's RSA DS lock (esp_ rsa_ ds_ conn_ lock(), 84 B) were in FW-07's census and left with FW-16's component list (the vfs component is out of the build, which tests/ firmware/ test_ meter_ sdkconfig_ reaches_ the_ build.py holds, and sdkconfig.defaults turns its I/O off should it return); FW-17's census held neither, so no mbedTLS option was changed.
What left D1 before FW-18
Until FW-17 ESP-IDF also allocated on the firmware's behalf after app_main()'s first line, while the instrument booted. The figures are the census of 2026-11-22 (above: 0.16.6's image at FW-07's commit, ESP-IDF 6.0.3): 39 allocations and 4 frees before app_main()'s first line, 79 and 31 from it to the settled boot; from FW-09, which took the GPIO ISR service off (below), 76 and 31, or 75 and 30 when NVS has one page fewer to load in full (the bench, 2026-11-22); from FW-10, which took the RMT driver off (below), 52 and 8 at every boot of 2026-11-22, with one such page load; from FW-11, which took ESP-IDF's task watchdog off (below), 35 and 4 before app_main() and 50 and 8 from it, at every boot and every watchdog reset on the bench of 2026-11-22; from FW-12, which took ESP-IDF's UART driver off (below), 35 and 4 before and 35 and 8 from it; from FW-14, which took ESP-IDF's I2C master off (below), 35 and 4 before and 23 and 8 from it; from FW-16, which took NVS off (below), 31 and 4 before and 0 allocations and 2 frees from it (DIAGnostic:HEAP? on the meter, 2026-11-23, ELF f30fed2a5e870da3, at the first boot, after the registry's restore, through the bench suite's sweep and its 20 saves); and from FW-17, which keeps the main task as the console, 31 and 4 before and 0 allocations and 0 frees from it (DIAGnostic:HEAP? on the meter, 2026-11-23, ELF 41f60a8bc5d49b06: at the boot, after every command family of the bench suite's sweep, after the watchdog's forced reset, and after a full TRACE ring and its whole RAW dump). Since app_main()'s first line nothing allocates and nothing frees, the boot included: the allow-list the source and object gates hold is empty and the host harness has none (tests/
No longer an event either: the idle task freeing the main task's stack and control block once app_main() returned (2 frees, until FW-17), which is why the steady-state count started a quarter of a second after the boot rather than at app_main()'s first line. app_main() now runs the boot and then the console's loop on the main task and never returns (firmware/
No longer on the list either: nvs_
No longer on the list: gpio_
No longer on the list either: rmt_
No longer on the list either: esp_
No longer on the list either: uart_
No longer on the list either: i2c_
Before app_main(), until FW-18 (39 allocations, 4 frees, 50,855 B at FW-07's census; 35, 4 and 50,799 B at FW-11's, which took off the task watchdog's two and two of the allocator's records; 31 and 4 from FW-16, unsplit): the interrupt allocator's records (12, 4 freed; 10 from FW-11), the IPC tasks (4, 8,392 B), the main task (2, 4,196 B; from FW-17 its stack is the console's 8,192 B, so about 12,300 B, and the console's static 8 KiB stack is gone), the idle tasks' stacks and control blocks (4, 3,392 B), pthread's mutexes and the flash and RSA locks (6, 352 B), PSRAM's heap registration and its 32 KiB DMA reserve (3, 32,840 B), VFS (2, 63 B), the task watchdog's init and first entry (2, 32 B, until FW-11), the C library (4 B), a pthread key (12 B), the RTC interrupt (20 B) and mbedTLS's PSA init (1,408 B). The census holds no allocation of esp_timer's (this entry named one until FW-08).
Not checkable with the tools at hand
Most of the declaration, lifetime, template and side-effect rules need a whole-program analyzer or a certified checker. They are neither claimed nor denied here; a rule moves into "Held" only with the gate or the reading that holds it.