From 0b9643c279d53eff40667cf17453b7ee1dbddd52 Mon Sep 17 00:00:00 2001 From: AVee Date: Fri, 3 May 2024 21:04:34 +0200 Subject: [PATCH] Only limit App partitions to 16MB, allow others to be bigger. The bootloader will crash when starting from an app partition which exceeds 16MB, but larger sizes are fine for data partitions. Fixes #34 --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 175352a..6812d29 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -285,7 +285,7 @@ impl PartitionTable { pub fn validate(&self) -> Result<(), Error> { use self::partition::{APP_PARTITION_ALIGNMENT, DATA_PARTITION_ALIGNMENT}; - const MAX_PART_SIZE: u32 = 0x100_0000; // 16MB + const MAX_APP_PART_SIZE: u32 = 0x100_0000; // 16MB const OTADATA_SIZE: u32 = 0x2000; // 8kB // There must be at least one partition with type 'app' @@ -317,9 +317,9 @@ impl PartitionTable { return Err(Error::UnalignedPartition); } - // Partitions cannot exceed 16MB; see: + // App partitions cannot exceed 16MB; see: // https://github.com/espressif/esp-idf/blob/c212305/components/bootloader_support/src/esp_image_format.c#L158-L161 - if partition.size() > MAX_PART_SIZE { + if partition.ty() == Type::App && partition.size() > MAX_APP_PART_SIZE { return Err(Error::PartitionTooLarge(partition.name())); } }