From 506f15c381aa05c6d18ffb3457be6f1963bb38c4 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Thu, 8 Nov 2018 14:44:31 -0800 Subject: [PATCH] interrupts: simplify position of sw ISR table We now place the linker directives for the SW ISR table in the common linker scripts, instead of repeating it everywhere. The table will be placed in RAM if dynamic interrupts are enabled. A dedicated section is used, as this data must not move in between build phases. Signed-off-by: Andrew Boie --- include/arch/arc/v2/linker.ld | 3 --- include/arch/arm/cortex_m/scripts/linker.ld | 3 --- include/arch/nios2/linker.ld | 3 --- include/arch/riscv32/common/linker.ld | 3 --- include/arch/riscv32/pulpino/linker.ld | 3 --- include/linker/common-ram.ld | 7 +++++++ include/linker/common-rom.ld | 6 ++++++ scripts/sanitycheck | 5 +++-- soc/xtensa/D_108mini/linker.ld | 1 - soc/xtensa/D_212GP/linker.ld | 1 - soc/xtensa/D_233L/linker.ld | 1 - soc/xtensa/XRC_D2PM_5swIrq/linker.ld | 1 - soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld | 1 - soc/xtensa/esp32/linker.ld | 1 - soc/xtensa/hifi2_std/linker.ld | 1 - soc/xtensa/hifi3_bd5/linker.ld | 1 - soc/xtensa/hifi3_bd5_call0/linker.ld | 1 - soc/xtensa/hifi4_bd7/linker.ld | 1 - soc/xtensa/hifi_mini/linker.ld | 1 - soc/xtensa/hifi_mini_4swIrq/linker.ld | 1 - soc/xtensa/intel_s1000/linker.ld | 1 - soc/xtensa/sample_controller/linker.ld | 1 - 22 files changed, 16 insertions(+), 31 deletions(-) diff --git a/include/arch/arc/v2/linker.ld b/include/arch/arc/v2/linker.ld index 2d3efaa304a..ab82a0317db 100644 --- a/include/arch/arc/v2/linker.ld +++ b/include/arch/arc/v2/linker.ld @@ -88,9 +88,6 @@ SECTIONS { KEEP(*(".exc_vector_table.*")) KEEP(*(IRQ_VECTOR_TABLE)) -#ifdef CONFIG_GEN_SW_ISR_TABLE - KEEP(*(SW_ISR_TABLE)) -#endif *(.text) *(".text.*") *(.gnu.linkonce.t.*) diff --git a/include/arch/arm/cortex_m/scripts/linker.ld b/include/arch/arm/cortex_m/scripts/linker.ld index 635e26ca234..86ad08cbfc6 100644 --- a/include/arch/arm/cortex_m/scripts/linker.ld +++ b/include/arch/arm/cortex_m/scripts/linker.ld @@ -141,9 +141,6 @@ SECTIONS KEEP(*(.kinetis_flash_config)) KEEP(*(".kinetis_flash_config.*")) -#ifdef CONFIG_GEN_SW_ISR_TABLE - KEEP(*(SW_ISR_TABLE)) -#endif _vector_end = .; _image_text_start = .; *(.text) diff --git a/include/arch/nios2/linker.ld b/include/arch/nios2/linker.ld index 138aabbbe4a..06b61b39e6c 100644 --- a/include/arch/nios2/linker.ld +++ b/include/arch/nios2/linker.ld @@ -189,9 +189,6 @@ SECTIONS SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) { -#ifdef CONFIG_GEN_SW_ISR_TABLE - KEEP(*(SW_ISR_TABLE)) -#endif *(.data) *(".data.*") diff --git a/include/arch/riscv32/common/linker.ld b/include/arch/riscv32/common/linker.ld index c1e154ed37d..f345abb43c6 100644 --- a/include/arch/riscv32/common/linker.ld +++ b/include/arch/riscv32/common/linker.ld @@ -87,9 +87,6 @@ SECTIONS SECTION_PROLOGUE(_TEXT_SECTION_NAME,,) { . = ALIGN(4); -#ifdef CONFIG_GEN_SW_ISR_TABLE - KEEP(*(SW_ISR_TABLE)) -#endif KEEP(*(.openocd_debug)) KEEP(*(".openocd_debug.*")) diff --git a/include/arch/riscv32/pulpino/linker.ld b/include/arch/riscv32/pulpino/linker.ld index 2f4960b0244..0f031307f7f 100644 --- a/include/arch/riscv32/pulpino/linker.ld +++ b/include/arch/riscv32/pulpino/linker.ld @@ -102,9 +102,6 @@ SECTIONS SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) { . = ALIGN(4); -#ifdef CONFIG_GEN_SW_ISR_TABLE - KEEP(*(SW_ISR_TABLE)) -#endif *(.rodata) *(".rodata.*") *(.gnu.linkonce.r.*) diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index e5db37e0370..d95653ea58b 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -3,6 +3,13 @@ DEVICE_INIT_SECTIONS() } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) +#if defined(CONFIG_GEN_ISR_TABLES) && defined(CONFIG_DYNAMIC_INTERRUPTS) + SECTION_DATA_PROLOGUE(sw_isr_table, (OPTIONAL),) + { + *(SW_ISR_TABLE) + } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) +#endif + /* verify we don't have rogue .init_ initlevel sections */ SECTION_DATA_PROLOGUE(initlevel_error, (OPTIONAL), ) { diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld index c4e6174ef00..53f275fd820 100644 --- a/include/linker/common-rom.ld +++ b/include/linker/common-rom.ld @@ -1,3 +1,9 @@ +#if defined(CONFIG_GEN_ISR_TABLES) && !defined(CONFIG_DYNAMIC_INTERRUPTS) + SECTION_PROLOGUE(sw_isr_table, (OPTIONAL),) + { + *(SW_ISR_TABLE) + } GROUP_LINK_IN(ROMABLE_REGION) +#endif #ifdef CONFIG_CPLUSPLUS SECTION_PROLOGUE(_CTOR_SECTION_NAME,,) { diff --git a/scripts/sanitycheck b/scripts/sanitycheck index 67053d63100..3f2ff65d681 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -646,7 +646,7 @@ class SizeCalculator: rw_sections = ["datas", "initlevel", "_k_task_list", "_k_event_list", "_k_memory_pool", "exceptions", "initshell", "_static_thread_area", "_k_timer_area", "_k_work_area", - "_k_mem_slab_area", "_k_mem_pool_area", + "_k_mem_slab_area", "_k_mem_pool_area", "sw_isr_table", "_k_sem_area", "_k_mutex_area", "_k_alert_area", "_k_fifo_area", "_k_lifo_area", "_k_stack_area", "_k_msgq_area", "_k_mbox_area", "_k_pipe_area", @@ -660,7 +660,8 @@ class SizeCalculator: "priv_stacks_noinit"] # These get copied into RAM only on non-XIP ro_sections = ["text", "ctors", "init_array", "reset", "object_access", - "rodata", "devconfig", "net_l2", "vector", "_bt_settings_area"] + "rodata", "devconfig", "net_l2", "vector", "sw_isr_table", + "_bt_settings_area"] def __init__(self, filename, extra_sections): """Constructor diff --git a/soc/xtensa/D_108mini/linker.ld b/soc/xtensa/D_108mini/linker.ld index 896462fb2f2..f84e77dd660 100644 --- a/soc/xtensa/D_108mini/linker.ld +++ b/soc/xtensa/D_108mini/linker.ld @@ -521,7 +521,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/D_212GP/linker.ld b/soc/xtensa/D_212GP/linker.ld index 9060766d29f..412e87bd651 100644 --- a/soc/xtensa/D_212GP/linker.ld +++ b/soc/xtensa/D_212GP/linker.ld @@ -527,7 +527,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/D_233L/linker.ld b/soc/xtensa/D_233L/linker.ld index 681f8fe2fc9..2f826603014 100644 --- a/soc/xtensa/D_233L/linker.ld +++ b/soc/xtensa/D_233L/linker.ld @@ -403,7 +403,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/XRC_D2PM_5swIrq/linker.ld b/soc/xtensa/XRC_D2PM_5swIrq/linker.ld index 0bde2ef63f2..e3d50e85337 100644 --- a/soc/xtensa/XRC_D2PM_5swIrq/linker.ld +++ b/soc/xtensa/XRC_D2PM_5swIrq/linker.ld @@ -531,7 +531,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld b/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld index 0c8899b15f5..a84451ed6b8 100644 --- a/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld +++ b/soc/xtensa/XRC_FUSION_AON_ALL_LM/linker.ld @@ -359,7 +359,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/esp32/linker.ld b/soc/xtensa/esp32/linker.ld index 291255b52bb..7928e8c6559 100644 --- a/soc/xtensa/esp32/linker.ld +++ b/soc/xtensa/esp32/linker.ld @@ -169,7 +169,6 @@ SECTIONS *(.gnu.linkonce.s2.*) KEEP(*(.jcr)) *(.dram1 .dram1.*) - KEEP(*(SW_ISR_TABLE)) _data_end = ABSOLUTE(.); . = ALIGN(4); } GROUP_LINK_IN(RAMABLE_REGION) diff --git a/soc/xtensa/hifi2_std/linker.ld b/soc/xtensa/hifi2_std/linker.ld index 4df129b5e79..ab0ae15d4bc 100644 --- a/soc/xtensa/hifi2_std/linker.ld +++ b/soc/xtensa/hifi2_std/linker.ld @@ -531,7 +531,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/hifi3_bd5/linker.ld b/soc/xtensa/hifi3_bd5/linker.ld index 25fb3297471..9fdc38bcb7f 100644 --- a/soc/xtensa/hifi3_bd5/linker.ld +++ b/soc/xtensa/hifi3_bd5/linker.ld @@ -307,7 +307,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/hifi3_bd5_call0/linker.ld b/soc/xtensa/hifi3_bd5_call0/linker.ld index 25fb3297471..9fdc38bcb7f 100644 --- a/soc/xtensa/hifi3_bd5_call0/linker.ld +++ b/soc/xtensa/hifi3_bd5_call0/linker.ld @@ -307,7 +307,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/hifi4_bd7/linker.ld b/soc/xtensa/hifi4_bd7/linker.ld index cefb8196640..3ba732c0943 100644 --- a/soc/xtensa/hifi4_bd7/linker.ld +++ b/soc/xtensa/hifi4_bd7/linker.ld @@ -354,7 +354,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/hifi_mini/linker.ld b/soc/xtensa/hifi_mini/linker.ld index 5578de67364..729fddbd8d4 100644 --- a/soc/xtensa/hifi_mini/linker.ld +++ b/soc/xtensa/hifi_mini/linker.ld @@ -197,7 +197,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/hifi_mini_4swIrq/linker.ld b/soc/xtensa/hifi_mini_4swIrq/linker.ld index a18f6279b14..811614d6af9 100644 --- a/soc/xtensa/hifi_mini_4swIrq/linker.ld +++ b/soc/xtensa/hifi_mini_4swIrq/linker.ld @@ -197,7 +197,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/intel_s1000/linker.ld b/soc/xtensa/intel_s1000/linker.ld index 217c99b25d0..28670ea95f8 100644 --- a/soc/xtensa/intel_s1000/linker.ld +++ b/soc/xtensa/intel_s1000/linker.ld @@ -371,7 +371,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1) diff --git a/soc/xtensa/sample_controller/linker.ld b/soc/xtensa/sample_controller/linker.ld index 896462fb2f2..f84e77dd660 100644 --- a/soc/xtensa/sample_controller/linker.ld +++ b/soc/xtensa/sample_controller/linker.ld @@ -521,7 +521,6 @@ SECTIONS _data_start = ABSOLUTE(.); *(.data) *(.data.*) - KEEP(*(SW_ISR_TABLE)) *(.gnu.linkonce.d.*) KEEP(*(.gnu.linkonce.d.*personality*)) *(.data1)