From 9f4ea2122a346040d3a82b90e8eaaf63f44b23ce Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 17 Jan 2020 18:35:09 -0800 Subject: [PATCH] teensy fixes --- ports/mimxrt10xx/boards/teensy40/flash_config.c | 2 +- ports/mimxrt10xx/supervisor/port.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/mimxrt10xx/boards/teensy40/flash_config.c b/ports/mimxrt10xx/boards/teensy40/flash_config.c index a0661280b8..c281d4541e 100644 --- a/ports/mimxrt10xx/boards/teensy40/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy40/flash_config.c @@ -68,7 +68,7 @@ const flexspi_nor_config_t qspiflash_config = { .deviceType = kFlexSpiDeviceType_SerialNOR, .sflashPadType = kSerialFlash_4Pads, .serialClkFreq = kFlexSpiSerialClk_60MHz, // 03 - .sflashA1Size = 0x00200000, + .sflashA1Size = FLASH_SIZE, .lookupTable = { // FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index 555b783597..e141bc6b8e 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -162,10 +162,10 @@ void SystemInitHook(void) { // we can ignore 1/8th size chunks. So, we ignore the last 1MB using the subregion. uint32_t remainder = (1u << (region_size + 1)) - filesystem_size; uint32_t subregion_size = (1u << (region_size + 1)) / 8; - uint16_t subregion_mask = 0xff00 >> (remainder / subregion_size); + uint8_t subregion_mask = (0xff00 >> (remainder / subregion_size)) & 0xff; MPU->RBAR = ARM_MPU_RBAR(11, 0x60100000U); - MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, (uint8_t) subregion_mask, region_size); + MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, subregion_mask, region_size); // This the ITCM. Set it to read-only because we've loaded everything already and it's easy to // accidentally write the wrong value to 0x00000000 (aka NULL).