Skip to content

Commit 8b07c99

Browse files
committed
arch: Simplify private header include path configuration.
When compiling the components under the arch directory, the compiler include paths for arch and kernel private headers need to be specified. This was previously done by adding 'zephyr_library_include_directories' to CMakeLists.txt file for every component under the arch directory, and this resulted in a significant amount of duplicate code. This commit uses the CMake 'include_directories' command in the root CMakeLists.txt to simplify specification of the private header include paths for all the arch components. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 3349f95 commit 8b07c99

File tree

15 files changed

+28
-73
lines changed

15 files changed

+28
-73
lines changed

arch/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22

33
add_definitions(-D__ZEPHYR_SUPERVISOR__)
44

5+
include_directories(
6+
${ZEPHYR_BASE}/kernel/include
7+
${ZEPHYR_BASE}/arch/${ARCH}/include
8+
)
9+
510
add_subdirectory(common)
611
add_subdirectory(${ARCH_DIR}/${ARCH} arch/${ARCH})

arch/arc/core/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,5 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S)
2828
zephyr_library_sources_ifdef(CONFIG_ARC_CONNECT arc_connect.c)
2929
zephyr_library_sources_ifdef(CONFIG_SMP arc_smp.c)
3030

31-
zephyr_library_include_directories(
32-
${ZEPHYR_BASE}/kernel/include
33-
${ZEPHYR_BASE}/arch/arc/include
34-
)
35-
3631
add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu)
3732
add_subdirectory_ifdef(CONFIG_ARC_SECURE_FIRMWARE secureshield)

arch/arc/core/mpu/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,3 @@ zephyr_library()
44

55
zephyr_library_sources_if_kconfig(arc_core_mpu.c)
66
zephyr_library_sources_if_kconfig(arc_mpu.c)
7-
8-
zephyr_library_include_directories(
9-
${ZEPHYR_BASE}/kernel/include
10-
${ZEPHYR_BASE}/arch/arc/include
11-
)

arch/arc/core/secureshield/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ zephyr_library_sources(
1010
arc_secure.S
1111
secure_sys_services.c
1212
)
13-
14-
zephyr_library_include_directories(
15-
${ZEPHYR_BASE}/kernel/include
16-
${ZEPHYR_BASE}/arch/arc/include
17-
)

arch/arm/core/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ zephyr_library_sources(
2020
prep_c.c
2121
)
2222

23-
zephyr_library_include_directories(
24-
${ZEPHYR_BASE}/kernel/include
25-
${ZEPHYR_BASE}/arch/arm/include
26-
)
27-
2823
zephyr_library_sources_ifdef(CONFIG_GEN_SW_ISR_TABLE isr_wrapper.S)
2924
zephyr_library_sources_ifdef(CONFIG_CPLUSPLUS __aeabi_atexit.c)
3025
zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c)

arch/arm/core/cortex_m/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,3 @@ zephyr_linker_sources_ifdef(CONFIG_SW_VECTOR_RELAY
1515
RAM_SECTIONS
1616
vt_pointer_section.ld
1717
)
18-
19-
zephyr_library_include_directories(
20-
${ZEPHYR_BASE}/kernel/include
21-
${ZEPHYR_BASE}/arch/arm/include
22-
)
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
zephyr_sources(arm_core_cmse.c)
3+
zephyr_library()
4+
5+
zephyr_library_sources(arm_core_cmse.c)

arch/arm/core/cortex_m/tz/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ zephyr_link_libraries_ifdef(CONFIG_ARM_FIRMWARE_USES_SECURE_ENTRY_FUNCS
3232
${CMAKE_BINARY_DIR}/${CONFIG_ARM_ENTRY_VENEERS_LIB_NAME}
3333
)
3434

35-
zephyr_sources_ifdef(CONFIG_ARM_SECURE_FIRMWARE arm_core_tz.c)
35+
if(CONFIG_ARM_SECURE_FIRMWARE)
36+
zephyr_library()
37+
38+
zephyr_library_sources(arm_core_tz.c)
39+
endif()

arch/arm/core/cortex_r/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,3 @@ zephyr_library_sources(
99
reboot.c
1010
stacks.c
1111
)
12-
13-
zephyr_library_include_directories(
14-
${ZEPHYR_BASE}/kernel/include
15-
${ZEPHYR_BASE}/arch/arm/include
16-
)

arch/common/CMakeLists.txt

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_GEN_ISR_TABLES OR CONFIG_EXECUTION_BENCHMARKING)
4+
zephyr_library()
5+
6+
zephyr_library_sources_ifdef(
7+
CONFIG_GEN_ISR_TABLES
8+
isr_tables.c
9+
sw_isr_common.c
10+
)
11+
12+
zephyr_library_sources_ifdef(
13+
CONFIG_EXECUTION_BENCHMARKING
14+
timing_info_bench.c
15+
)
16+
endif()
17+
318
# Put functions and data in their own binary sections so that ld can
419
# garbage collect them
520
zephyr_cc_option(-ffunction-sections -fdata-sections)
621

7-
zephyr_sources_ifdef(
8-
CONFIG_GEN_ISR_TABLES
9-
isr_tables.c
10-
sw_isr_common.c
11-
)
12-
13-
zephyr_sources_ifdef(
14-
CONFIG_EXECUTION_BENCHMARKING
15-
timing_info_bench.c
16-
)
17-
1822
zephyr_linker_sources_ifdef(CONFIG_GEN_ISR_TABLES
1923
SECTIONS
2024
isr_tables.ld
@@ -29,8 +33,3 @@ zephyr_linker_sources_ifdef(CONFIG_NOCACHE_MEMORY
2933
RAM_SECTIONS
3034
nocache.ld
3135
)
32-
33-
zephyr_library_include_directories(
34-
${ZEPHYR_BASE}/kernel/include
35-
${ZEPHYR_BASE}/arch/${ARCH}/include
36-
)

arch/nios2/core/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@ zephyr_library_sources(
1616
)
1717

1818
zephyr_library_sources_if_kconfig(irq_offload.c)
19-
20-
zephyr_library_include_directories(
21-
${ZEPHYR_BASE}/kernel/include
22-
${ZEPHYR_BASE}/arch/nios2/include
23-
)

arch/riscv/core/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,3 @@ zephyr_library_sources(
1414
)
1515

1616
zephyr_library_sources_if_kconfig(irq_offload.c)
17-
18-
zephyr_library_include_directories(
19-
${ZEPHYR_BASE}/kernel/include
20-
${ZEPHYR_BASE}/arch/riscv/include
21-
)

arch/x86/core/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ zephyr_library_sources_if_kconfig(x86_mmu.c)
1919

2020
zephyr_library_sources_ifdef(CONFIG_X86_VERY_EARLY_CONSOLE early_serial.c)
2121

22-
zephyr_library_include_directories(
23-
${ZEPHYR_BASE}/kernel/include
24-
${ZEPHYR_BASE}/arch/x86/include
25-
)
26-
2722
if(CONFIG_X86_64)
2823
include(intel64.cmake)
2924
else()

arch/xtensa/core/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,4 @@ zephyr_library_sources_ifndef(CONFIG_ATOMIC_OPERATIONS_C atomic.S)
1616
zephyr_library_sources_ifdef(CONFIG_XTENSA_USE_CORE_CRT1 crt1.S)
1717
zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c)
1818

19-
zephyr_library_include_directories(
20-
${ZEPHYR_BASE}/kernel/include
21-
${ZEPHYR_BASE}/arch/xtensa/include
22-
)
23-
2419
add_subdirectory(startup)

arch/xtensa/core/startup/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,4 @@ if(CONFIG_XTENSA_RESET_VECTOR)
1414
memerror-vector.S
1515
memctl_default.S
1616
)
17-
18-
zephyr_library_include_directories(
19-
${ZEPHYR_BASE}/kernel/include
20-
${ZEPHYR_BASE}/arch/xtensa/include
21-
)
2217
endif()

0 commit comments

Comments
 (0)