From 69093d74cd701cf1576cc857e5fd00ba26a08382 Mon Sep 17 00:00:00 2001 From: Kasper Lund Date: Wed, 12 Jun 2024 12:56:41 +0200 Subject: [PATCH] Always reserve at least 1kb for configs on ESP32 (#2402) --- tools/firmware.toit | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/firmware.toit b/tools/firmware.toit index b486aaea9..245451ac8 100644 --- a/tools/firmware.toit +++ b/tools/firmware.toit @@ -1175,6 +1175,15 @@ extract-binary-content -> ByteArray extension += config-size extension += config-encoded + // If the encoded config is small, we make sure to reserve + // more space so the config area is guaranteed to be useful + // for slightly larger configs without changing the free + // size in the header. Usually, the padding we do after this + // is more than enough, but we want a guarantee to have some + // space available. + reserved := 1024 - config-encoded.size + if reserved > 0: extension += ByteArray reserved + // This is a pretty serious padding up. We do it to guarantee // that segments that follow this one do not change their // alignment within the individual flash pages, which seems