mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
setup: change mpu definition for bootloader, fix typo
This commit is contained in:
parent
91d9bd28c2
commit
6cda903a1d
@ -1,5 +1,5 @@
|
|||||||
/* STM32F205RG - 1024K Flash, 128K RAM */
|
/* STM32F205RG - 1024K Flash, 128K RAM */
|
||||||
/* program starts at 0x08010100 */
|
/* program starts at 0x08010400 */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
rom (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K
|
rom (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K
|
||||||
|
9
setup.c
9
setup.c
@ -153,6 +153,7 @@ void setupApp(void)
|
|||||||
#define MPU_RASR_SIZE_512KB (0x12UL << MPU_RASR_SIZE_LSB)
|
#define MPU_RASR_SIZE_512KB (0x12UL << MPU_RASR_SIZE_LSB)
|
||||||
#define MPU_RASR_SIZE_1MB (0x13UL << MPU_RASR_SIZE_LSB)
|
#define MPU_RASR_SIZE_1MB (0x13UL << MPU_RASR_SIZE_LSB)
|
||||||
#define MPU_RASR_SIZE_512MB (0x1CUL << MPU_RASR_SIZE_LSB)
|
#define MPU_RASR_SIZE_512MB (0x1CUL << MPU_RASR_SIZE_LSB)
|
||||||
|
#define MPU_RASR_SIZE_4GB (0x1FUL << MPU_RASR_SIZE_LSB)
|
||||||
|
|
||||||
// http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/BABDJJGF.html
|
// http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/BABDJJGF.html
|
||||||
#define MPU_RASR_ATTR_FLASH (MPU_RASR_ATTR_C)
|
#define MPU_RASR_ATTR_FLASH (MPU_RASR_ATTR_C)
|
||||||
@ -177,9 +178,10 @@ void mpu_config_bootloader(void)
|
|||||||
MPU_CTRL = 0;
|
MPU_CTRL = 0;
|
||||||
|
|
||||||
// Note: later entries overwrite previous ones
|
// Note: later entries overwrite previous ones
|
||||||
// Flash (0x08000000 - 0x0807FFFF, 1 MiB, read-write)
|
|
||||||
MPU_RBAR = FLASH_BASE | MPU_RBAR_VALID | (0 << MPU_RBAR_REGION_LSB);
|
// Everything (0x00000000 - 0xFFFFFFFF, 4 GiB, read-write)
|
||||||
MPU_RASR = MPU_RASR_ENABLE | MPU_RASR_ATTR_FLASH | MPU_RASR_SIZE_1MB | MPU_RASR_ATTR_AP_PRW_URW;
|
MPU_RBAR = 0 | MPU_RBAR_VALID | (0 << MPU_RBAR_REGION_LSB);
|
||||||
|
MPU_RASR = MPU_RASR_ENABLE | MPU_RASR_ATTR_FLASH | MPU_RASR_SIZE_4GB | MPU_RASR_ATTR_AP_PRW_URW;
|
||||||
|
|
||||||
// Flash (0x8007FE0 - 0x08007FFF, 32 B, no-access)
|
// Flash (0x8007FE0 - 0x08007FFF, 32 B, no-access)
|
||||||
MPU_RBAR = (FLASH_BASE + 0x7FE0) | MPU_RBAR_VALID | (1 << MPU_RBAR_REGION_LSB);
|
MPU_RBAR = (FLASH_BASE + 0x7FE0) | MPU_RBAR_VALID | (1 << MPU_RBAR_REGION_LSB);
|
||||||
@ -218,6 +220,7 @@ void mpu_config_firmware(void)
|
|||||||
MPU_CTRL = 0;
|
MPU_CTRL = 0;
|
||||||
|
|
||||||
// Note: later entries overwrite previous ones
|
// Note: later entries overwrite previous ones
|
||||||
|
|
||||||
// Flash (0x08000000 - 0x0807FFFF, 1 MiB, read-only)
|
// Flash (0x08000000 - 0x0807FFFF, 1 MiB, read-only)
|
||||||
MPU_RBAR = FLASH_BASE | MPU_RBAR_VALID | (0 << MPU_RBAR_REGION_LSB);
|
MPU_RBAR = FLASH_BASE | MPU_RBAR_VALID | (0 << MPU_RBAR_REGION_LSB);
|
||||||
MPU_RASR = MPU_RASR_ENABLE | MPU_RASR_ATTR_FLASH | MPU_RASR_SIZE_1MB | MPU_RASR_ATTR_AP_PRO_URO;
|
MPU_RASR = MPU_RASR_ENABLE | MPU_RASR_ATTR_FLASH | MPU_RASR_SIZE_1MB | MPU_RASR_ATTR_AP_PRO_URO;
|
||||||
|
Loading…
Reference in New Issue
Block a user