AP_HAL_ChibiOS: Copy vector table to RAM if external flash is primary

This commit is contained in:
Martin Luessi 2023-06-01 08:50:09 -07:00 committed by Randy Mackay
parent 47615b14cc
commit 321e82c451
2 changed files with 18 additions and 1 deletions

View File

@ -250,6 +250,10 @@ endif
# Define ASM defines here # Define ASM defines here
UADEFS = UADEFS =
ifeq ($(COPY_VECTORS_TO_RAM),yes)
UADEFS += -DCRT0_INIT_VECTORS=1
endif
# List all user directories here # List all user directories here
UINCDIR = UINCDIR =

View File

@ -1292,12 +1292,25 @@ MEMORY
INCLUDE common.ld INCLUDE common.ld
''' % (flash_base, flash_length, ram0_start, ram0_len)) ''' % (flash_base, flash_length, ram0_start, ram0_len))
else: elif int_flash_primary:
if ext_flash_size > 32: if ext_flash_size > 32:
error("We only support 24bit addressing over external flash") error("We only support 24bit addressing over external flash")
env_vars['HAS_EXTERNAL_FLASH_SECTIONS'] = 1 env_vars['HAS_EXTERNAL_FLASH_SECTIONS'] = 1
f.write('''/* generated ldscript.ld */ f.write('''/* generated ldscript.ld */
MEMORY MEMORY
{
flash : org = 0x%08x, len = %uK
ext_flash : org = 0x%08x, len = %uK
ram0 : org = 0x%08x, len = %u
}
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
{ {
default_flash (rx) : org = 0x%08x, len = %uK default_flash (rx) : org = 0x%08x, len = %uK
instram : org = 0x%08x, len = %uK instram : org = 0x%08x, len = %uK