From 0c93800ec1d3b1a3b4d1fb7358f0acf864d4b385 Mon Sep 17 00:00:00 2001 From: Martin Luessi Date: Thu, 1 Jun 2023 08:50:09 -0700 Subject: [PATCH] AP_HAL_ChibiOS: Copy vector table to RAM if external flash is primary --- libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk | 4 ++++ libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 1 + 2 files changed, 5 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk b/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk index df4fcea197..893b358f54 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/chibios_board.mk @@ -264,6 +264,10 @@ endif # Define ASM defines here UADEFS = +ifeq ($(COPY_VECTORS_TO_RAM),yes) + UADEFS += -DCRT0_INIT_VECTORS=1 +endif + # List all user directories here UINCDIR = diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index e7703b7341..1f92219bbb 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -1363,6 +1363,7 @@ INCLUDE common_mixf.ld ''' % (flash_base, flash_length, ext_flash_base, ext_flash_length, ram0_start, ram0_len)) else: self.env_vars['HAS_EXTERNAL_FLASH_SECTIONS'] = 1 + self.build_flags.append('COPY_VECTORS_TO_RAM=yes') f.write('''/* generated ldscript.ld */ MEMORY {