Skip to content

Commit

Permalink
fixup! chore(core): refactore trustzone initialization
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
cepetr committed Nov 14, 2023
1 parent 1a9be83 commit 8ceb837
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions core/embed/boardloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,14 @@ int main(void) {
delete_secrets();
NVIC_SystemReset();
}

trustzone_init_boardloader();
#endif

#ifdef STM32F4
clear_otg_hs_memory();
#endif

#ifdef STM32U5
trustzone_init_boardloader();
#endif

mpu_config_boardloader();

#ifdef USE_SDRAM
Expand Down
10 changes: 5 additions & 5 deletions core/embed/trezorhal/stm32u5/trustzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifdef BOARDLOADER

// Configure ARMCortex-M33 SCB and FPU security
static void trustzone_configure_arm() {
static void trustzone_configure_arm(void) {
// Enable FPU in both secure and non-secure modes
SCB->NSACR |= SCB_NSACR_CP10_Msk | SCB_NSACR_CP11_Msk;

Expand All @@ -37,8 +37,8 @@ static void trustzone_configure_arm() {
}

// Configure SRAM security
static void trustzone_configure_sram() {
MPCBB_ConfigTypeDef mpcbb = {};
static void trustzone_configure_sram(void) {
MPCBB_ConfigTypeDef mpcbb = {0};

// No exceptions on illegal access
mpcbb.SecureRWIllegalMode = GTZC_MPCBB_SRWILADIS_DISABLE;
Expand Down Expand Up @@ -66,8 +66,8 @@ static void trustzone_configure_sram() {
}

// Configure FLASH security
static void trustzone_configure_flash() {
FLASH_BBAttributesTypeDef flash_bb = {};
static void trustzone_configure_flash(void) {
FLASH_BBAttributesTypeDef flash_bb = {0};

// Set all blocks as secured
for (int index = 0; index < FLASH_BLOCKBASED_NB_REG; index++) {
Expand Down

0 comments on commit 8ceb837

Please sign in to comment.