Skip to content

Commit

Permalink
WIP - add tables local declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
rakons committed Dec 15, 2023
1 parent 1ac9b00 commit 99649d8
Show file tree
Hide file tree
Showing 12 changed files with 757 additions and 284 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1226,10 +1226,11 @@ if(CONFIG_GEN_ISR_TABLES)
# isr_tables.c is generated from ${ZEPHYR_LINK_STAGE_EXECUTABLE} by
# gen_isr_tables.py
add_custom_command(
OUTPUT isr_tables.c
OUTPUT isr_tables.c isr_tables_vt.ld isr_tables_swi.ld
COMMAND ${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/build/gen_isr_tables.py
--output-source isr_tables.c
--linker-output-files isr_tables_vt.ld isr_tables_swi.ld
--kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
--intlist-section .intList
--intlist-section intList
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ else()
zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld)
zephyr_linker_sources(ROM_START SORT_KEY 0x1vectors cortex_m/vector_table_pad.ld)
endif()

if(CONFIG_GEN_SW_ISR_TABLE)
if(CONFIG_DYNAMIC_INTERRUPTS)
zephyr_linker_sources(RWDATA swi_tables.ld)
else()
zephyr_linker_sources(RODATA swi_tables.ld)
endif()
endif()
8 changes: 8 additions & 0 deletions arch/arm/core/swi_tables.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#if LINKER_ZEPHYR_FINAL
INCLUDE zephyr/isr_tables_swi.ld
#endif
4 changes: 4 additions & 0 deletions arch/arm/core/vector_table.ld
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ KEEP(*(".exc_vector_table.*"))

KEEP(*(.vectors))

#if LINKER_ZEPHYR_FINAL
INCLUDE zephyr/isr_tables_vt.ld
#endif

_vector_end = .;
8 changes: 8 additions & 0 deletions arch/arm64/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
endif()

add_subdirectory_ifdef(CONFIG_XEN xen)

if(CONFIG_GEN_SW_ISR_TABLE)
if(CONFIG_DYNAMIC_INTERRUPTS)
zephyr_linker_sources(RWDATA swi_tables.ld)
else()
zephyr_linker_sources(RODATA swi_tables.ld)
endif()
endif()
8 changes: 8 additions & 0 deletions arch/arm64/core/swi_tables.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#if LINKER_ZEPHYR_FINAL
INCLUDE zephyr/isr_tables_swi.ld
#endif
10 changes: 10 additions & 0 deletions arch/common/isr_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
struct int_list_header {
uint32_t table_size;
uint32_t offset;
#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION)
uint32_t swi_table_entry_size;
uint32_t shared_isr_table_entry_size;
uint32_t shared_isr_client_num_offset;
#endif /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */
};

/* These values are not included in the resulting binary, but instead form the
Expand All @@ -24,6 +29,11 @@ struct int_list_header {
Z_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = {
.table_size = IRQ_TABLE_SIZE,
.offset = CONFIG_GEN_IRQ_START_VECTOR,
#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION)
.swi_table_entry_size = sizeof(struct _isr_table_entry),
.shared_isr_table_entry_size = sizeof(struct z_shared_isr_table_entry),
.shared_isr_client_num_offset = offsetof(struct z_shared_isr_table_entry, client_num),
#endif /* IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION) */
};

/* These are placeholder tables. They will be replaced by the real tables
Expand Down
3 changes: 3 additions & 0 deletions include/zephyr/arch/arm64/scripts/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ SECTIONS

KEEP(*(.vectors))

#if LINKER_ZEPHYR_FINAL
INCLUDE zephyr/isr_tables_vt.ld
#endif
_vector_end = .;

*(.text)
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/sw_isr_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ struct _isr_list_sname {

#ifdef CONFIG_SHARED_INTERRUPTS
struct z_shared_isr_client {
void (*isr)(const void *arg);
const void *arg;
void (*isr)(const void *arg);
};

struct z_shared_isr_table_entry {
Expand Down
Loading

0 comments on commit 99649d8

Please sign in to comment.