Skip to content

Commit 12f8f76

Browse files
SebastianBoeAnas Nashif
authored andcommitted
Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make Zephyr easy to use for application developers working on different platforms with different development environment needs. Simplified, this change retains Kconfig as-is, and replaces all Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild offers is replaced by a set of CMake extentions. These extentions have either provided simple one-to-one translations of KBuild features or introduced new concepts that replace KBuild concepts. This is a breaking change for existing test infrastructure and build scripts that are maintained out-of-tree. But for FW itself, no porting should be necessary. For users that just want to continue their work with minimal disruption the following should suffice: Install CMake 3.8.2+ Port any out-of-tree Makefiles to CMake. Learn the absolute minimum about the new command line interface: $ cd samples/hello_world $ mkdir build && cd build $ cmake -DBOARD=nrf52_pca10040 .. $ cd build $ make PR: zephyrproject-rtos#4692 docs: http://docs.zephyrproject.org/getting_started/getting_started.html Signed-off-by: Sebastian Boe <[email protected]>
1 parent 8bffcda commit 12f8f76

File tree

644 files changed

+7815
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

644 files changed

+7815
-0
lines changed

CMakeLists.txt

Lines changed: 731 additions & 0 deletions
Large diffs are not rendered by default.

arch/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(common)
2+
add_subdirectory(${ARCH})

arch/arc/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Enable debug support in mdb
2+
# Dwarf version 2 can be recognized by mdb
3+
# The default dwarf version in gdb is not recognized by mdb
4+
zephyr_cc_option(-g3 -gdwarf-2)
5+
6+
# Without this (poorly named) option, compiler may generate undefined
7+
# references to abort().
8+
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63691
9+
zephyr_cc_option(-fno-delete-null-pointer-checks)
10+
11+
zephyr_cc_option_ifdef (CONFIG_LTO -flto)
12+
13+
add_subdirectory(soc/${SOC_PATH})
14+
add_subdirectory(core)

arch/arc/core/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
zephyr_sources(
2+
thread.c
3+
thread_entry_wrapper.S
4+
cpu_idle.S
5+
fast_irq.S
6+
fatal.c
7+
fault.c
8+
fault_s.S
9+
irq_manage.c
10+
cache.c
11+
timestamp.c
12+
isr_wrapper.S
13+
regular_irq.S
14+
swap.S
15+
sys_fatal_error_handler.c
16+
prep_c.c
17+
reset.S
18+
vector_table.c
19+
)
20+
21+
zephyr_sources_if_kconfig(irq_offload.c)
22+
zephyr_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_CUSTOM atomic.c)
23+
add_subdirectory_ifdef(CONFIG_CPU_HAS_MPU mpu)

arch/arc/core/mpu/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
zephyr_sources_if_kconfig(arc_core_mpu.c)
2+
zephyr_sources_if_kconfig(arc_mpu.c)

arch/arc/soc/em11d/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
2+
3+
zephyr_cc_option(-mcpu=em4_fpuda -mno-sdata -mdiv-rem -mswap -mnorm)
4+
zephyr_cc_option(-mmpy-option=6 -mbarrel-shifter)
5+
zephyr_cc_option(--param l1-cache-size=16384)
6+
zephyr_cc_option(--param l1-cache-line-size=32)
7+
zephyr_cc_option_ifdef(CONFIG_CODE_DENSITY -mcode-density)
8+
zephyr_cc_option_ifdef(CONFIG_FLOAT -mfpu=fpuda_all)
9+
10+
11+
zephyr_sources(
12+
soc.c
13+
soc_config.c
14+
)

arch/arc/soc/em7d/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
2+
3+
zephyr_cc_option(-mcpu=-mcpu=em4_dmips -mno-sdata)
4+
zephyr_cc_option(-mdiv-rem -mswap -mnorm)
5+
zephyr_cc_option(-mmpy-option=6 -mbarrel-shifter)
6+
zephyr_cc_option(--param l1-cache-size=16384)
7+
zephyr_cc_option(--param l1-cache-line-size=32)
8+
9+
zephyr_cc_option_ifdef(CONFIG_CODE_DENSITY -mcode-density)
10+
11+
if(CONFIG_BOARD_EM_STARTERKIT_R23)
12+
message(FATAL "em7d from em starterkit 2.3 is not supported")
13+
endif()
14+
15+
16+
zephyr_sources(
17+
soc.c
18+
soc_config.c
19+
)
20+
21+
zephyr_source_ifdef(CONFIG_ARC_MPU_ENABLE arc_mpu_regions.c)

arch/arc/soc/em9d/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
2+
3+
zephyr_cc_option(-mcpu=em4_fpus -mno-sdata -mdiv-rem -mswap -mnorm)
4+
zephyr_cc_option(-mdiv-rem -mswap -mnorm)
5+
zephyr_cc_option(-mmpy-option=6 -mbarrel-shifter)
6+
7+
zephyr_cc_option_ifdef(CONFIG_CODE_DENSITY -mcode-density)
8+
zephyr_cc_option_ifdef(CONFIG_FLOAT -mfpu=fpuda_all)
9+
10+
11+
zephyr_sources(
12+
soc.c
13+
soc_config.c
14+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers)
2+
zephyr_include_directories(${PROJECT_SOURCE_DIR}/arch/x86/soc/intel_quark)
3+
4+
zephyr_cc_option(-mcpu=quarkse_em -mno-sdata)
5+
6+
zephyr_compile_definitions_ifdef(
7+
CONFIG_SOC_QUARK_SE_C1000_SS
8+
QM_SENSOR=1
9+
SOC_SERIES=quark_se
10+
)
11+
12+
zephyr_sources(
13+
soc.c
14+
soc_config.c
15+
power.c
16+
soc_power.S
17+
)

arch/arm/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
zephyr_cc_option_ifdef(CONFIG_LTO -flto)
2+
3+
set(ARCH_FOR_cortex-m0 armv6-m )
4+
set(ARCH_FOR_cortex-m0plus armv6-m )
5+
set(ARCH_FOR_cortex-m3 armv7-m )
6+
set(ARCH_FOR_cortex-m4 armv7e-m )
7+
set(ARCH_FOR_cortex-m23 armv8-m.base)
8+
set(ARCH_FOR_cortex-m33 armv8-m.main)
9+
10+
if(${ARCH_FOR_${GCC_M_CPU}})
11+
set(ARCH_FLAG -march=${ARCH_FOR_${GCC_M_CPU}})
12+
endif()
13+
14+
zephyr_compile_options(
15+
-mabi=aapcs
16+
${TOOLCHAIN_C_FLAGS}
17+
${ARCH_FLAG}
18+
)
19+
20+
add_subdirectory(soc)
21+
add_subdirectory(core)

0 commit comments

Comments
 (0)