Changelog¶
What changed in each release of the driver. Entries under Breaking need source changes in code that used the affected API.
[Unreleased]¶
Changed¶
- The repository moved to kokeb-labs-drivers; URLs follow.
- The Hardware page draws the chip from the new
docs/hardware.yml: the SOIC-8 pinout with each pin's port hook, the block diagram of Figure 3-1, the SPI wiring of Figure 5-1 with WP on a GPIO, and the pin and parts tables, every fact with its datasheet section and page. Values the datasheet does not give (the decoupling capacitor and the WP pull-down) are marked as not confirmed. The hand-written pin table is gone. - The
hardware-lessons-review,new-driver-from-templateandverifyskills follow the template, andtools/preflight.shruns every local check before a push. The chip model's noise generator is parenthesised for the clang-tidy check that script now runs. - The
misra-review,cpp20-profileandnew-driver-from-templateskills anddocs/repo-setup.mdfollow the template: reading the MISRA report, the known tool misfires, enumeration ranges without a sentinel, and the settings tool.
[0.1.0] - 2026-11-09¶
Breaking¶
Read()andWrite()take astd::spaninstead of a pointer and a length:Read(uint16_t address, std::span<uint8_t> out, Verify)andWrite(uint16_t address, std::span<const uint8_t> data, Verify). Migration:Read(a, buf.data(), buf.size())becomesRead(a, buf)(astd::arrayor a C array converts to the span), andRead(a, p, n)becomesRead(a, std::span{p, n}). The null-pointer case is gone; an empty span is stillInvalidArgument.- A failed WP pin hook (
GpioSet()) is reported as the newError::Pin(21), the name the handbook gives a failed pin hook (KB-CPP-047), instead ofError::Bus, fromEnsureInitialized(),Write(),SetBlockProtection()andDeinitialize().Deinitialize()now returnsBusfor a failed WRDI andPinfor a failed park, instead ofBusfor both. When a step fails and parking WP fails too, any call returnsPin(WP may be left released) and logs it. A handler that mappedBusto "check the pin" mapsPinnow. - The port concept checks every hook's exact types and
noexcept: aTransfer()with a narrower length, aDelayUs()with a narrower parameter, or any hook withoutnoexcept, is now a compile error.Erroris[[nodiscard]], so a discardedValidate()result warns. GetConfig()can no longer be called on a temporary driver (const&overload only).
Added¶
- The chip's SPI requirements as
constexprvalues ininc/at25040b_spi_interface.hpp(handbook KB-CPP-123):kSpiMode(0, andkSpiModeAlternate3),kMsbFirst,kMaxClockHz,kMinCsHighNs,kCsSetupNs,kCsHoldNs,kDataSetupNs,kDataHoldNs,kContinuousWord, valid over the whole supply range, andBusTimingAt(supply_mv)with the faster limits from 2.5 V and 4.5 V (datasheet Table 4-3). The host, ESP32 and docs ports check their settings against them withstatic_assert; the ESP32 port also checks its clock, mode and t_CSS at start, sets the CS hold time from the clock and drives CS high before the bus comes up (at most 5 MHz with that port). ReadRawStatus(): one RDSR, no wait, no retry, no check (handbook KB-CPP-129).- Strict-dialect builds (KB-CPP20-001):
CMAKE_CXX_EXTENSIONS OFFand-pedantic-errorsin every folder that builds a target, theat25040b_header_checkstarget (each public header alone as ISO C++20, also in the Cortex-M cross-build) andexamples/esp32/main/at25040b_cxx20_check.cppinside ESP-IDF. tests/test_model.cpp: the chip model now carries its own register map and Table 6-4 from the datasheet and includes no driver header; the test cross-checks both maps at compile time (KB-TST-030).- Compile-fail tests for a narrowed
Transfer()length, aTransfer()withoutnoexceptand a narrowedDelayUs(). - From the template: the
cpp20-profile,misra-reviewandhardware-lessons-reviewskills and thesafety-revieweragent.
Changed¶
- MISRA C++:2023 conformance:
std::fillreplaces the discarded result ofstd::ranges::fill(Rule 0.1.2); the typed literals_u8,_u16and_u32(detail, out-of-range values do not compile) and explicit widening casts for constants and arguments of another type (Rule 7.0.6); both operands widened touint32_tin a bitwise OR of two bytes (Rule 7.0.5); precedence-clarifying parentheses (Rule 8.0.1); loop bounds held in aconstlocal, and the chunk and page loops that step their counter in the body written aswhile(Rule 9.5.1);default: break;in theToString(Error),CapacityBytes()andProtectedFrom()switches, with-Wswitch-enumin the test flags so a new enumerator still warns (Rule 9.4.2); the.ippinclude at the end ofat25040b.hppmarked as deviation MD-CPP-009 (Rule 19.0.3). No change in behaviour. - Follows the driver template's portable ownership: copyright belongs to
The driver-at25040b authors(LICENSE, every source header,driver.ymlauthors, the docs footer).tools/check_standalone.pyruns in the Handbook source checks job and keeps the code and docs about this chip only.AGENTS.mdfollows the template's structure; the issue and PR templates ask for the board, MCU and port in one field. - The port concepts match each hook's address against exactly one
noexceptsignature withdetail::ExactHook<Port, Sig>::Take(&Port::Hook)instead of probing it with a convertingdetail::Exactly<T>: no conversion operator is left. A misdeclared hook is still a compile error.kAlwaysFalsetakes a class and the enumeration helpers an enumeration (ClassType,Enumeration), each with a compile-fail test. - The bus helper checks every length against its buffer before it sends anything: a READ of 1 to 16 bytes, a WRITE
of 1 to 8 bytes inside one page, an address up to A8 (
InvalidArgumentotherwise; at compile time for a fixed-size span). The transfer buffers are members of the driver object, so the port never sees a caller's or a stack buffer (handbook KB-HW-019). The receive buffer is preset to MISO's idle level (0xFF) before each READ, so a port that reports success without filling it can never hand back an earlier transfer's bytes. The driver object grows by 36 bytes; the hot path is unchanged apart from these comparisons and buffer fills. - The read chunk,
kReadChunkBytes= 16, now states its design reason (buffer size, longest CS-low time on a shared bus, command overhead, two whole pages); see the Architecture page. - Include guards instead of
#pragma oncein every header (KB-CPP-019);uint32_tcasts before every~,<<,|,&and^on register values (KB-CPP20-021); BP1:BP0 through a typedField; the toggle error and the BP encoders are freeconstexprfunctions withstatic_asserts;withWriteAccess()is constrained; enumerator checks throughdetail::IsEnumerator;ToString()is a switch over every enumerator. - Template sync to
a4a1056:_config/.clang-tidy,ci-repo-checks.yml(handbook source checks pinned), skills.
Added¶
- First version of the driver for the Microchip (Atmel) AT25010B, AT25020B and AT25040B SPI serial EEPROMs, written on the Kokeb Labs driver template.
at25040b::AT25040B<Port>with the configuration in the constructor (no I/O) and one start-up call,EnsureInitialized(): the status read until idle and confirmed by a second read, then the write enable latch toggled (WREN, WEN = 1, WRDI, WEN = 0) with nothing programmed, so a floating, stuck-low or echoing MISO fails the check.Config::check_write_enable = falsefalls back to reading the first 8 bytes twice, for boards with WP tied low.Deinitialize()(WRDI, WP parked) followed byEnsureInitialized()probes again.Read()of any range in 16-byte transfers, each read twice and compared (Config::verify_reads);Write()of any range split at 8-byte pages, with WREN and a WEN check per page, the write cycle waited for (Config::write_timeout_us, default 10 ms), the latch checked again and each page read back (Config::verify_writes). A range in the block-protected part is refused before anything is sent.SetBlockProtection(),GetBlockProtection(),ReadStatus(),GetLastStatusByte();Config::variantfor the three sizes, with A8 in the opcode on the AT25040B.- The optional
GpioSet(CtrlPin::WriteProtect, ...)port hook: WP is released only for a write, a block-protection change and the identity check, and parked after, on success and failure. - Chip-specific errors from 16:
NoDevice,BusNoise,WriteProtected,BlockProtected,WriteMismatch. - Host tests over a protocol model of the three parts with the bus and board faults the datasheet's pin descriptions
allow, every transfer and WP pin write of every operation failed in turn, a libFuzzer target with corpus replay, the
host and ESP32 examples, three figures drawn from the code. Not verified on hardware; the bench checks are in
docs/limitations.md.
Changed¶
- CI runs fewer jobs, from the driver template: the host tests build GCC and Clang in one job; DCO, the org
standard, Markdown and YAML lint, the handbook rules, template drift and cppcheck are steps of one
Repository checksjob (ci-repo-checks.yml, replacingci-handbook.yml,ci-cpp-analysis.yml,ci-markdown-lint.ymlandci-yaml-lint.yml); cross-compile and host quality use ci-tools' one-job layouts. No check is dropped. The workflows have no manual (workflow_dispatch) trigger any more. - Read and write verification is opt-in and chosen per call:
Read()andWrite()take a last argument,at25040b::Verify(None, the default, orReadBack). By defaultRead()reads each 16-byte chunk once andWrite()reads no page back, so a call sends only what the datasheet needs plus the status reads that keep it off a busy chip.Verify::ReadBackrestores the double read (BusNoise) and the per-page read-back (WriteMismatch).Config::verify_reads,Config::verify_writesand their Kconfig optionsCONFIG_AT25040B_SKIP_READ_VERIFYandCONFIG_AT25040B_SKIP_WRITE_VERIFYare removed.Config::check_write_enablestays on by default: it runs once, inEnsureInitialized(), never on theRead()andWrite()path.