1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00

chore(core): add storage flash area size checks

[no changelog]
This commit is contained in:
tychovrahe 2024-11-05 08:27:34 +01:00 committed by TychoVrahe
parent 5c101ab800
commit cd06b5f600
2 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "irq.h"
#include "mpu.h"
#include "sizedefs.h"
#include "stm32f4xx_ll_cortex.h"
@ -74,6 +75,10 @@ mpu_driver_t g_mpu_driver = {
#define KERNEL_CCMRAM_FB_START (KERNEL_CCMRAM_START - KERNEL_FRAMEBUFFER_SIZE)
_Static_assert(NORCOW_SECTOR_SIZE == STORAGE_1_MAXSIZE, "norcow misconfigured");
_Static_assert(NORCOW_SECTOR_SIZE == STORAGE_2_MAXSIZE, "norcow misconfigured");
_Static_assert(NORCOW_SECTOR_SIZE == SIZE_64K, "norcow misconfigured");
static void mpu_init_fixed_regions(void) {
// Regions #0 to #4 are fixed for all targets

View File

@ -124,6 +124,8 @@ static void mpu_set_attributes(void) {
}
#define STORAGE_SIZE NORCOW_SECTOR_SIZE* STORAGE_AREAS_COUNT
_Static_assert(NORCOW_SECTOR_SIZE == STORAGE_1_MAXSIZE, "norcow misconfigured");
_Static_assert(NORCOW_SECTOR_SIZE == STORAGE_2_MAXSIZE, "norcow misconfigured");
#if defined STM32U5A9xx
#define SRAM_SIZE (SRAM1_SIZE + SRAM2_SIZE + SRAM3_SIZE + SRAM5_SIZE)