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:
parent
bcca26260b
commit
318ee971c5
8 changed files with 15 additions and 10 deletions
|
@ -167,6 +167,12 @@ config LINKER_SORT_BY_ALIGNMENT
|
||||||
in decreasing size of symbols. This helps to minimize
|
in decreasing size of symbols. This helps to minimize
|
||||||
padding between symbols.
|
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
|
config HAS_SRAM_OFFSET
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
|
|
|
@ -14,8 +14,7 @@ CONFIG_MAIN_STACK_SIZE=640
|
||||||
CONFIG_IDLE_STACK_SIZE=200
|
CONFIG_IDLE_STACK_SIZE=200
|
||||||
CONFIG_ISR_STACK_SIZE=512
|
CONFIG_ISR_STACK_SIZE=512
|
||||||
# Prevent Interrupt Vector Table in RAM
|
# Prevent Interrupt Vector Table in RAM
|
||||||
CONFIG_IS_BOOTLOADER=y
|
CONFIG_SRAM_VECTOR_TABLE=n
|
||||||
CONFIG_BOOTLOADER_SRAM_SIZE=8
|
|
||||||
|
|
||||||
# Serial Drivers
|
# Serial Drivers
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
|
@ -13,8 +13,7 @@ CONFIG_IDLE_STACK_SIZE=150
|
||||||
CONFIG_ISR_STACK_SIZE=256
|
CONFIG_ISR_STACK_SIZE=256
|
||||||
CONFIG_LOG_BUFFER_SIZE=256
|
CONFIG_LOG_BUFFER_SIZE=256
|
||||||
# Prevent Interrupt Vector Table in RAM
|
# Prevent Interrupt Vector Table in RAM
|
||||||
CONFIG_IS_BOOTLOADER=y
|
CONFIG_SRAM_VECTOR_TABLE=n
|
||||||
CONFIG_BOOTLOADER_SRAM_SIZE=4
|
|
||||||
|
|
||||||
# Serial Drivers
|
# Serial Drivers
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
|
@ -14,8 +14,7 @@ CONFIG_MAIN_STACK_SIZE=640
|
||||||
CONFIG_IDLE_STACK_SIZE=200
|
CONFIG_IDLE_STACK_SIZE=200
|
||||||
CONFIG_ISR_STACK_SIZE=512
|
CONFIG_ISR_STACK_SIZE=512
|
||||||
# Prevent Interrupt Vector Table in RAM
|
# Prevent Interrupt Vector Table in RAM
|
||||||
CONFIG_IS_BOOTLOADER=y
|
CONFIG_SRAM_VECTOR_TABLE=n
|
||||||
CONFIG_BOOTLOADER_SRAM_SIZE=4
|
|
||||||
|
|
||||||
# Serial Drivers
|
# Serial Drivers
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
|
@ -14,8 +14,7 @@ CONFIG_MAIN_STACK_SIZE=640
|
||||||
CONFIG_IDLE_STACK_SIZE=200
|
CONFIG_IDLE_STACK_SIZE=200
|
||||||
CONFIG_ISR_STACK_SIZE=512
|
CONFIG_ISR_STACK_SIZE=512
|
||||||
# Prevent Interrupt Vector Table in RAM
|
# Prevent Interrupt Vector Table in RAM
|
||||||
CONFIG_IS_BOOTLOADER=y
|
CONFIG_SRAM_VECTOR_TABLE=n
|
||||||
CONFIG_BOOTLOADER_SRAM_SIZE=8
|
|
||||||
|
|
||||||
# Serial Drivers
|
# Serial Drivers
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
|
@ -254,7 +254,7 @@ SECTIONS
|
||||||
. = ALIGN(_region_min_align);
|
. = ALIGN(_region_min_align);
|
||||||
_image_ram_start = .;
|
_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 */
|
/* Must be first in ramable region */
|
||||||
SECTION_PROLOGUE(.st_stm32f0x_vt,(NOLOAD),)
|
SECTION_PROLOGUE(.st_stm32f0x_vt,(NOLOAD),)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,4 +12,7 @@ source "soc/arm/st_stm32/stm32f0/Kconfig.defconfig.stm32f0*"
|
||||||
config SOC_SERIES
|
config SOC_SERIES
|
||||||
default "stm32f0"
|
default "stm32f0"
|
||||||
|
|
||||||
|
config SRAM_VECTOR_TABLE
|
||||||
|
default y
|
||||||
|
|
||||||
endif # SOC_SERIES_STM32F0X
|
endif # SOC_SERIES_STM32F0X
|
||||||
|
|
|
@ -47,7 +47,7 @@ void relocate_vector_table(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT)
|
#if defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT)
|
||||||
_vector_table_pointer = _vector_start;
|
_vector_table_pointer = _vector_start;
|
||||||
#elif !defined(CONFIG_IS_BOOTLOADER)
|
#elif defined(CONFIG_SRAM_VECTOR_TABLE)
|
||||||
extern char _ram_vector_start[];
|
extern char _ram_vector_start[];
|
||||||
|
|
||||||
size_t vector_size = (size_t)_vector_end - (size_t)_vector_start;
|
size_t vector_size = (size_t)_vector_end - (size_t)_vector_start;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue