boards: stm32f0: explicit RAM vector table control

Add a new Kconfig symbol that explicitly controls whether the vector
table should be placed in RAM. This eliminates the side effect of
`IS_BOOTLOADER` controlling vector table location. Making the condition
a positive assertion also allows the config to be used in CMakeLists
conditions (`zephyr_linker_sources_ifdef()`, etc).

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2021-04-17 20:04:33 +10:00 committed by Ioannis Glaropoulos
parent bcca26260b
commit 318ee971c5
8 changed files with 15 additions and 10 deletions

View file

@ -167,6 +167,12 @@ config LINKER_SORT_BY_ALIGNMENT
in decreasing size of symbols. This helps to minimize
padding between symbols.
config SRAM_VECTOR_TABLE
bool "Place the vector table in SRAM instead of flash"
help
The option specifies that the vector table should be placed at the
start of SRAM instead of the start of flash.
config HAS_SRAM_OFFSET
bool
help

View file

@ -14,8 +14,7 @@ CONFIG_MAIN_STACK_SIZE=640
CONFIG_IDLE_STACK_SIZE=200
CONFIG_ISR_STACK_SIZE=512
# Prevent Interrupt Vector Table in RAM
CONFIG_IS_BOOTLOADER=y
CONFIG_BOOTLOADER_SRAM_SIZE=8
CONFIG_SRAM_VECTOR_TABLE=n
# Serial Drivers
CONFIG_SERIAL=y

View file

@ -13,8 +13,7 @@ CONFIG_IDLE_STACK_SIZE=150
CONFIG_ISR_STACK_SIZE=256
CONFIG_LOG_BUFFER_SIZE=256
# Prevent Interrupt Vector Table in RAM
CONFIG_IS_BOOTLOADER=y
CONFIG_BOOTLOADER_SRAM_SIZE=4
CONFIG_SRAM_VECTOR_TABLE=n
# Serial Drivers
CONFIG_SERIAL=y

View file

@ -14,8 +14,7 @@ CONFIG_MAIN_STACK_SIZE=640
CONFIG_IDLE_STACK_SIZE=200
CONFIG_ISR_STACK_SIZE=512
# Prevent Interrupt Vector Table in RAM
CONFIG_IS_BOOTLOADER=y
CONFIG_BOOTLOADER_SRAM_SIZE=4
CONFIG_SRAM_VECTOR_TABLE=n
# Serial Drivers
CONFIG_SERIAL=y

View file

@ -14,8 +14,7 @@ CONFIG_MAIN_STACK_SIZE=640
CONFIG_IDLE_STACK_SIZE=200
CONFIG_ISR_STACK_SIZE=512
# Prevent Interrupt Vector Table in RAM
CONFIG_IS_BOOTLOADER=y
CONFIG_BOOTLOADER_SRAM_SIZE=8
CONFIG_SRAM_VECTOR_TABLE=n
# Serial Drivers
CONFIG_SERIAL=y

View file

@ -254,7 +254,7 @@ SECTIONS
. = ALIGN(_region_min_align);
_image_ram_start = .;
#if defined(CONFIG_SOC_SERIES_STM32F0X) && !defined(CONFIG_IS_BOOTLOADER)
#if defined(CONFIG_SOC_SERIES_STM32F0X) && defined(CONFIG_SRAM_VECTOR_TABLE)
/* Must be first in ramable region */
SECTION_PROLOGUE(.st_stm32f0x_vt,(NOLOAD),)
{

View file

@ -12,4 +12,7 @@ source "soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f0*"
config SOC_SERIES
default "stm32f0"
config SRAM_VECTOR_TABLE
default y
endif # SOC_SERIES_STM32F0X

View file

@ -47,7 +47,7 @@ void relocate_vector_table(void)
{
#if defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT)
_vector_table_pointer = _vector_start;
#elif !defined(CONFIG_IS_BOOTLOADER)
#elif defined(CONFIG_SRAM_VECTOR_TABLE)
extern char _ram_vector_start[];
size_t vector_size = (size_t)_vector_end - (size_t)_vector_start;