From 2e77f5da253ade1f09117203353ec4ecd4e76a9f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 11 Mar 2026 11:23:28 -1000 Subject: [PATCH] Add comment explaining why version is uint32_t Co-Authored-By: J. Nick Koston --- esphome/components/esp32/crash_handler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/esp32/crash_handler.cpp b/esphome/components/esp32/crash_handler.cpp index af4dc538ca..70129d87ff 100644 --- a/esphome/components/esp32/crash_handler.cpp +++ b/esphome/components/esp32/crash_handler.cpp @@ -30,6 +30,8 @@ static inline bool IRAM_ATTR is_code_addr(uint32_t addr) { // Validated by magic marker. Static linkage since it's only used within this file. // Version field is first so future firmware can always identify the struct layout. // Magic is second to validate the data. Remaining fields can change between versions. +// Version is uint32_t because it would be padded to 4 bytes anyway before the next +// uint32_t field, so we use the full width rather than wasting 3 bytes of padding. static constexpr uint32_t CRASH_DATA_VERSION = 1; struct RawCrashData { uint32_t version;