mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-25 18:28:47 +00:00
refactor(core): prevent incomplete mpu driver build
[no changelog]
This commit is contained in:
parent
8a9de0ebec
commit
adf9872988
@ -96,7 +96,7 @@ static inline void mpu_enable(void) {
|
||||
static void mpu_init_fixed_regions(void) {
|
||||
// Regions #0 to #4 are fixed for all targets
|
||||
|
||||
#ifdef BOARDLOADER
|
||||
#if defined(BOARDLOADER)
|
||||
// clang-format off
|
||||
// Code in the Flash Bank #1 (Unprivileged, Read-Only, Executable)
|
||||
// Subregion: 48KB = 64KB except 2/8 at end
|
||||
@ -113,8 +113,7 @@ static void mpu_init_fixed_regions(void) {
|
||||
// Subregion: 192KB = 256KB except 2/8 at end
|
||||
SET_REGION( 4, SRAM_BASE, SIZE_256KB, 0xC0, SRAM, FULL_ACCESS );
|
||||
// clang-format on
|
||||
#endif
|
||||
#ifdef BOOTLOADER
|
||||
#elif defined(BOOTLOADER)
|
||||
// clang-format off
|
||||
// Bootloader code in the Flash Bank #1 (Unprivileged, Read-Only, Executable)
|
||||
// Subregion: 128KB = 1024KB except 2/8 at start
|
||||
@ -131,8 +130,7 @@ static void mpu_init_fixed_regions(void) {
|
||||
// Subregion: 192KB = 256KB except 2/8 at end
|
||||
SET_REGION( 4, SRAM_BASE, SIZE_256KB, 0xC0, SRAM, FULL_ACCESS );
|
||||
// clang-format on
|
||||
#endif
|
||||
#ifdef KERNEL
|
||||
#elif defined(KERNEL)
|
||||
// clang-format off
|
||||
// Code in the Flash Bank #1 (Unprivileged, Read-Only, Executable)
|
||||
// Subregion: 768KB = 1024KB except 2/8 at start
|
||||
@ -149,8 +147,7 @@ static void mpu_init_fixed_regions(void) {
|
||||
// SubRegion: 8KB at the beginning + 16KB at the end of 64KB CCMRAM
|
||||
SET_REGION( 4, CCMDATARAM_BASE, SIZE_64KB, 0x3E, SRAM, PRIV_RW );
|
||||
// clang-format on
|
||||
#endif
|
||||
#ifdef FIRMWARE
|
||||
#elif defined(FIRMWARE)
|
||||
// clang-format off
|
||||
// Code in the Flash Bank #1 (Unprivileged, Read-Only, Executable)
|
||||
// Subregion: 768KB = 1024KB except 2/8 at start
|
||||
@ -165,8 +162,7 @@ static void mpu_init_fixed_regions(void) {
|
||||
SET_REGION( 3, SRAM_BASE, SIZE_256KB, 0xC0, SRAM, FULL_ACCESS );
|
||||
DIS_REGION( 4 );
|
||||
// clang-format on
|
||||
#endif
|
||||
#ifdef TREZOR_PRODTEST
|
||||
#elif defined(TREZOR_PRODTEST)
|
||||
// clang-format off
|
||||
// Code in the Flash Bank #1 (Unprivileged, Read-Only, Executable)
|
||||
// Subregion: 768KB = 1024KB except 2/8 at start
|
||||
@ -183,6 +179,8 @@ static void mpu_init_fixed_regions(void) {
|
||||
// (used in production test to invalidate the firmware)
|
||||
SET_REGION( 4, FIRMWARE_START, SIZE_1KB, 0x00, FLASH_DATA, PRIV_RW_URO );
|
||||
// clang-format on
|
||||
#else
|
||||
#error "Unknown build target"
|
||||
#endif
|
||||
|
||||
// Regions #5 to #7 are banked
|
||||
|
@ -203,16 +203,14 @@ static void mpu_init_fixed_regions(void) {
|
||||
SET_REGION( 2, BOOTLOADER_START, BOOTLOADER_MAXSIZE, FLASH_DATA, YES, NO );
|
||||
SET_REGION( 3, FIRMWARE_START, FIRMWARE_MAXSIZE, FLASH_DATA, YES, NO );
|
||||
SET_REGION( 4, AUX1_RAM_START, AUX1_RAM_SIZE, SRAM, YES, NO );
|
||||
#endif
|
||||
#if defined(BOOTLOADER)
|
||||
#elif defined(BOOTLOADER)
|
||||
// REGION ADDRESS SIZE TYPE WRITE UNPRIV
|
||||
SET_REGION( 0, BOOTLOADER_START, BOOTLOADER_MAXSIZE, FLASH_CODE, NO, NO );
|
||||
SET_REGION( 1, MAIN_RAM_START, MAIN_RAM_SIZE, SRAM, YES, NO );
|
||||
SET_REGION( 2, FIRMWARE_START, FIRMWARE_MAXSIZE, FLASH_DATA, YES, NO );
|
||||
DIS_REGION( 3 );
|
||||
SET_REGION( 4, AUX1_RAM_START, AUX1_RAM_SIZE , SRAM, YES, NO );
|
||||
#endif
|
||||
#if defined(KERNEL)
|
||||
#elif defined(KERNEL)
|
||||
// REGION ADDRESS SIZE TYPE WRITE UNPRIV
|
||||
SET_REGRUN( 0, KERNEL_FLASH_START, KERNEL_FLASH_SIZE, FLASH_CODE, NO, NO ); // Kernel Code
|
||||
SET_REGION( 1, MAIN_RAM_START, MAIN_RAM_SIZE, SRAM, YES, NO ); // Kernel RAM
|
||||
@ -223,21 +221,22 @@ static void mpu_init_fixed_regions(void) {
|
||||
#else
|
||||
DIS_REGION( 4 );
|
||||
#endif
|
||||
#endif
|
||||
#if defined(FIRMWARE)
|
||||
|
||||
#elif defined(FIRMWARE)
|
||||
// REGION ADDRESS SIZE TYPE WRITE UNPRIV
|
||||
SET_REGION( 0, FIRMWARE_START, FIRMWARE_MAXSIZE, FLASH_CODE, NO, NO );
|
||||
SET_REGION( 1, MAIN_RAM_START, MAIN_RAM_SIZE, SRAM, YES, NO );
|
||||
DIS_REGION( 2 );
|
||||
DIS_REGION( 3 );
|
||||
SET_REGION( 4, AUX1_RAM_START, AUX1_RAM_SIZE, SRAM, YES, NO );
|
||||
#endif
|
||||
#if defined(TREZOR_PRODTEST)
|
||||
#elif defined(TREZOR_PRODTEST)
|
||||
SET_REGION( 0, FIRMWARE_START, 1024, FLASH_DATA, YES, NO );
|
||||
SET_REGION( 1, FIRMWARE_START + 1024, FIRMWARE_MAXSIZE - 1024, FLASH_CODE, NO, NO );
|
||||
SET_REGION( 2, MAIN_RAM_START, MAIN_RAM_SIZE, SRAM, YES, NO );
|
||||
DIS_REGION( 3 );
|
||||
SET_REGION( 4, AUX1_RAM_START, AUX1_RAM_SIZE, SRAM, YES, NO );
|
||||
#else
|
||||
#error "Unknown build target"
|
||||
#endif
|
||||
|
||||
// Regions #5 to #7 are banked
|
||||
|
Loading…
Reference in New Issue
Block a user