From 2c87d43b51686413a5585c46f886d2baddd70132 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Tue, 26 Nov 2024 21:10:07 +0100 Subject: [PATCH] fix(core): fix option bytes settings for U5G models [no changelog] --- core/embed/util/option_bytes/stm32u5/option_bytes.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/embed/util/option_bytes/stm32u5/option_bytes.c b/core/embed/util/option_bytes/stm32u5/option_bytes.c index a797a77dfe..1798cb5be2 100644 --- a/core/embed/util/option_bytes/stm32u5/option_bytes.c +++ b/core/embed/util/option_bytes/stm32u5/option_bytes.c @@ -51,24 +51,23 @@ #define WRP_DEFAULT_VALUE 0xFF00FFFF #define SEC_WM1R1_DEFAULT_VALUE 0xFF00FF00 #define SEC_WM1R2_DEFAULT_VALUE 0x7F007F00 -#define SEC_AREA_1_PAGE_START 0 -#define HDP_AREA_1_PAGE_END 1 -#define SEC_AREA_1_PAGE_END 0x07 #define SEC_AREA_2_PAGE_START 0xFF #define SEC_AREA_2_PAGE_END 0x00 #elif defined STM32U585xx #define WRP_DEFAULT_VALUE 0xFF80FFFF #define SEC_WM1R1_DEFAULT_VALUE 0xFF80FF80 #define SEC_WM1R2_DEFAULT_VALUE 0x7F807F80 -#define SEC_AREA_1_PAGE_START 0 -#define HDP_AREA_1_PAGE_END 1 -#define SEC_AREA_1_PAGE_END 0x07 #define SEC_AREA_2_PAGE_START 0x7F #define SEC_AREA_2_PAGE_END 0x00 #else #error Unknown MCU #endif +_Static_assert(SECRET_SECTOR_START == 0, "secret sector start must be 0"); +#define SEC_AREA_1_PAGE_START SECRET_SECTOR_START +#define HDP_AREA_1_PAGE_END SECRET_SECTOR_END +#define SEC_AREA_1_PAGE_END BOARDLOADER_SECTOR_END + #define WRP_LOCKED_VALUE \ ((WRP_DEFAULT_VALUE & \ ~(FLASH_WRP1AR_UNLOCK_Msk | FLASH_WRP1AR_WRP1A_PSTRT_Msk | \