From a3100be4b226982c0c4aa162139617be23198c66 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 19 Jul 2024 18:56:36 +0300 Subject: [PATCH] stm32/boards: Swap FMC banks on ARDUINO_GIGA and ARDUINO_PORTENTA_H7. Swap FMC banks to remap the SDRAM bank1 address to 0x60000000. Arduino's M4 firmware uses address 0x60000000 by default. When the elf loader tries to load that it will fail because by default NOR/PSRAM is mapped at that address, not SDRAM bank1. (Note that the region at 0xC0000000 has an XN attribute by default, so switching the M4 firmware address will not work.) Signed-off-by: iabdalkader --- ports/stm32/boards/ARDUINO_GIGA/mpconfigboard.h | 1 + ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h | 1 + 2 files changed, 2 insertions(+) diff --git a/ports/stm32/boards/ARDUINO_GIGA/mpconfigboard.h b/ports/stm32/boards/ARDUINO_GIGA/mpconfigboard.h index b278fa005b..d09a074402 100644 --- a/ports/stm32/boards/ARDUINO_GIGA/mpconfigboard.h +++ b/ports/stm32/boards/ARDUINO_GIGA/mpconfigboard.h @@ -226,6 +226,7 @@ extern struct _spi_bdev_t spi_bdev; #define MICROPY_HW_SDRAM_SIZE (64 / 8 * 1024 * 1024) // 64 Mbit #define MICROPY_HW_SDRAM_STARTUP_TEST (1) #define MICROPY_HW_SDRAM_TEST_FAIL_ON_ERROR (true) +#define MICROPY_HW_FMC_SWAP_BANKS (1) // Timing configuration for 200MHz/2=100MHz (10ns) #define MICROPY_HW_SDRAM_CLOCK_PERIOD 2 diff --git a/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h b/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h index ace63e016b..3a012446b4 100644 --- a/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h +++ b/ports/stm32/boards/ARDUINO_PORTENTA_H7/mpconfigboard.h @@ -240,6 +240,7 @@ extern struct _spi_bdev_t spi_bdev; #define MICROPY_HW_SDRAM_SIZE (64 / 8 * 1024 * 1024) // 64 Mbit #define MICROPY_HW_SDRAM_STARTUP_TEST (1) #define MICROPY_HW_SDRAM_TEST_FAIL_ON_ERROR (true) +#define MICROPY_HW_FMC_SWAP_BANKS (1) // Timing configuration for 200MHz/2=100MHz (10ns) #define MICROPY_HW_SDRAM_CLOCK_PERIOD 2