Skip to content

Commit

Permalink
cmake: Merged n times arch_x86_Y libs into soc_x86 and arch_x86
Browse files Browse the repository at this point in the history
Fixes: zephyrproject-rtos#8441

This commit merges the multiple sub libraries under soc_x86 and
arch_x86, e.g. arch_x86_Y_Z into a single arch_x86 libraries.

It also moves arch related stray files from libzephyr.a and places them
inside the arch_${ARCH} library, see zephyrproject-rtos#8826.

Signed-off-by: Torsten Rasmussen <[email protected]>
  • Loading branch information
tejlmand committed Dec 6, 2018
1 parent c66dffa commit f1797ee
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 58 deletions.
16 changes: 1 addition & 15 deletions arch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,4 @@ target_link_libraries(arch_${ARCH} PUBLIC zephyr_interface)
target_link_libraries(zephyr_app_linking INTERFACE arch_${ARCH})

add_subdirectory(common)

if( ( ${ARCH} STREQUAL arm ) OR
( ${ARCH} STREQUAL arc ) OR
( ${ARCH} STREQUAL posix ) OR
( ${ARCH} STREQUAL riscv32 ) OR
( ${ARCH} STREQUAL xtensa ) OR
( ${ARCH} STREQUAL nios2 )
)
include_relative(${ARCH}/CMakeLists.txt)
else()
# Not updated archs
add_subdirectory(${ARCH})
# To ensure a file is always present in arch not updated yet.
target_sources(arch_${ARCH} PRIVATE $ENV{ZEPHYR_BASE}/misc/empty_file.c)
endif()
include_relative(${ARCH}/CMakeLists.txt)
2 changes: 1 addition & 1 deletion arch/x86/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ add_custom_command(
)

# Must be last so that soc/ can override default exception handlers
add_subdirectory(core)
include_relative(core/CMakeLists.txt)

get_property(OUTPUT_ARCH GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH)
get_property(OUTPUT_FORMAT GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT)
Expand Down
43 changes: 23 additions & 20 deletions arch/x86/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
zephyr_library()

if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
# We rely on GAS for assembling, so don't use the integrated assembler
Expand All @@ -7,25 +6,29 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--divide>)
endif()

zephyr_library_sources(
cache.c
cache_s.S
cpuhalt.c
crt0.S
excstub.S
intstub.S
irq_manage.c
swap.S
sys_fatal_error_handler.c
thread.c
)
# Last since we declare default exception handlers here
zephyr_list(SOURCES
OUTPUT PRIVATE_SOURCES
cache.c
cache_s.S
cpuhalt.c
crt0.S
excstub.S
intstub.S
irq_manage.c
swap.S
sys_fatal_error_handler.c
thread.c
IFDEF:${CONFIG_DISABLE_SSBD} spec_ctrl.c
IFDEF:${CONFIG_FP_SHARING} float.c
IFDEF:${CONFIG_X86_USERSPACE} userspace.S
IF_KCONFIG irq_offload.c
IF_KCONFIG x86_mmu.c
IF_KCONFIG reboot_rst_cnt.c
)

zephyr_library_sources_if_kconfig( irq_offload.c)
zephyr_library_sources_if_kconfig( x86_mmu.c)
zephyr_library_sources_if_kconfig( reboot_rst_cnt.c)
zephyr_library_sources_ifdef(CONFIG_DISABLE_SSBD spec_ctrl.c)
zephyr_library_sources_ifdef(CONFIG_FP_SHARING float.c)
zephyr_library_sources_ifdef(CONFIG_X86_USERSPACE userspace.S)
target_sources(arch_x86 PRIVATE ${PRIVATE_SOURCES})

# Last since we declare default exception handlers here
zephyr_library_sources(fatal.c)
target_sources(arch_x86 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/fatal.c)

2 changes: 1 addition & 1 deletion arch/x86/core/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void init_cache_line_size(void)
#define init_cache_line_size() do { } while ((0))
#endif

static int init_cache(struct device *unused)
int init_cache(struct device *unused)
{
ARG_UNUSED(unused);

Expand Down
5 changes: 2 additions & 3 deletions soc/x86/apollo_lake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
zephyr_library()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
target_include_directories(soc_x86 PRIVATE ${ZEPHYR_BASE}/drivers)

zephyr_cc_option(-march=silvermont)
zephyr_cc_option_fallback(-march=atom -mtune=silvermont)

zephyr_library_sources(soc.c)
target_sources(soc_x86 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/soc.c)
5 changes: 2 additions & 3 deletions soc/x86/atom/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
zephyr_library()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
target_include_directories(soc_x86 PRIVATE ${ZEPHYR_BASE}/drivers)

zephyr_cc_option(-march=atom)
zephyr_cc_option_fallback(-mtune=atom -mtune=generic)

zephyr_library_sources(soc.c)
target_sources(soc_x86 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/soc.c)
5 changes: 2 additions & 3 deletions soc/x86/ia32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
zephyr_library()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
target_include_directories(soc_x86 PRIVATE ${ZEPHYR_BASE}/drivers)

zephyr_cc_option(-march=pentium)

if(CONFIG_X86_IAMCU)
zephyr_cc_option(-msoft-float)
endif()

zephyr_library_sources(soc.c)
target_sources(soc_x86 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/soc.c)
4 changes: 3 additions & 1 deletion soc/x86/intel_quark/quark_d2000/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
target_include_directories(soc_x86 PRIVATE ${ZEPHYR_BASE}/drivers)

zephyr_compile_definitions_ifdef(
CONFIG_SOC_QUARK_D2000
Expand All @@ -7,3 +7,5 @@ zephyr_compile_definitions_ifdef(
)

zephyr_cc_option(-march=lakemont -mtune=lakemont -msoft-float)

target_sources(soc_x86 PRIVATE ${ZEPHYR_BASE}/misc/empty_file.c)
25 changes: 17 additions & 8 deletions soc/x86/intel_quark/quark_se/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
target_include_directories(soc_x86 PRIVATE ${ZEPHYR_BASE}/drivers)

zephyr_compile_definitions_ifdef(
CONFIG_SOC_QUARK_SE_C1000
Expand All @@ -8,10 +8,19 @@ zephyr_compile_definitions_ifdef(

zephyr_cc_option(-march=lakemont -mtune=lakemont -msoft-float)

zephyr_sources(
soc.c
soc_config.c
eoi.c
power.c
soc_power.S
)
if(CONFIG_X86_IAMCU)
set_property(GLOBAL APPEND PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__IAMCU)
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-iamcu")
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "iamcu:intel")
endif()

zephyr_list(SOURCES
OUTPUT PRIVATE_SOURCES
soc.c
soc_config.c
eoi.c
power.c
soc_power.S
)

target_sources(soc_x86 PRIVATE ${PRIVATE_SOURCES})
5 changes: 2 additions & 3 deletions soc/x86/intel_quark/quark_x1000/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
target_include_directories(soc_x86 PRIVATE ${ZEPHYR_BASE}/drivers)

zephyr_cc_option(-march=lakemont -mtune=lakemont -msoft-float)

zephyr_sources(soc.c)
target_sources(soc_x86 PRIVATE ${CMAKE_CURRENT_LIST_DIR}/soc.c)

0 comments on commit f1797ee

Please sign in to comment.