forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout 2. Fix cmake build break 3. Update all new file license 4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose) ------------------ How to test From within nuttx/. Configure: cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja (or full path in custom board) : cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja This uses ninja generator (install with sudo apt install ninja-build). To build: $ cmake --build build menuconfig: $ cmake --build build -t menuconfig -------------------------- 2. cmake/build: reformat the cmake style by cmake-format https://github.com/cheshirekow/cmake_format $ pip install cmakelang $ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done $ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done Co-authored-by: Matias N <[email protected]> Signed-off-by: chao an <[email protected]>
- Loading branch information
1 parent
558fa50
commit 6ee9ec7
Showing
317 changed files
with
17,032 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# ############################################################################## | ||
# arch/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
# Declare arch library. In contrast to other user/kernel pairs built in KERNEL | ||
# mode, on arch/ the "user" portion uses a different set of sources than the | ||
# kernel portion. To keep things simple the naming k<lib> is not used. Instead, | ||
# the "user" portion is named "arch_interface". | ||
|
||
nuttx_add_kernel_library(arch) | ||
target_include_directories(arch PRIVATE ${CMAKE_SOURCE_DIR}/sched) | ||
|
||
if(NOT CONFIG_BUILD_FLAT) | ||
nuttx_add_system_library(arch_interface) | ||
target_include_directories(arch_interface PRIVATE ${CMAKE_SOURCE_DIR}/sched) | ||
endif() | ||
|
||
# TODO: move this higher up ifeq ($(CONFIG_SCHED_INSTRUMENTATION_SYSCALL),y) | ||
# EXTRALINKCMDS += @$(TOPDIR)/syscall/syscall_wraps.ldcmd endif | ||
|
||
# include corresponding arch subdirectory | ||
add_subdirectory(${CONFIG_ARCH}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ############################################################################## | ||
# arch/arm/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
|
||
nuttx_add_subdirectory() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ############################################################################## | ||
# arch/arm/src/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
|
||
add_subdirectory(common) | ||
add_subdirectory(${ARCH_SUBDIR}) | ||
add_subdirectory(${NUTTX_CHIP_ABS_DIR} EXCLUDE_FROM_ALL exclude_chip) | ||
|
||
# Include directories (before system ones) as PUBLIC so that it can be exposed | ||
# to libboard | ||
target_include_directories(arch BEFORE PUBLIC ${NUTTX_CHIP_ABS_DIR} common | ||
${ARCH_SUBDIR}) | ||
|
||
if(NOT CONFIG_BUILD_FLAT) | ||
target_include_directories(arch_interface BEFORE PUBLIC ${NUTTX_CHIP_ABS_DIR} | ||
common ${ARCH_SUBDIR}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# ############################################################################## | ||
# arch/arm/src/armv7-a/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
|
||
# The vector table is the "head" object, i.e., the one that must forced into the | ||
# link in order to draw in all of the other components | ||
|
||
set(SRCS arm_vectortab.S) | ||
|
||
# Common assembly language files | ||
|
||
list(APPEND SRCS arm_cpuhead.S arm_vectoraddrexcptn.S arm_vectors.S | ||
arm_saveusercontext.S) | ||
|
||
# Common C source files | ||
|
||
list( | ||
APPEND | ||
SRCS | ||
arm_cache.c | ||
arm_cpuinfo.c | ||
arm_dataabort.c | ||
arm_doirq.c | ||
arm_gicv2.c | ||
arm_gicv2_dump.c | ||
arm_initialstate.c | ||
arm_mmu.c | ||
arm_prefetchabort.c | ||
arm_schedulesigaction.c | ||
arm_sigdeliver.c | ||
arm_syscall.c | ||
arm_tcbinfo.c | ||
arm_undefinedinsn.c | ||
arm_perf.c | ||
cp15_cacheops.c) | ||
|
||
if(CONFIG_ARMV7A_HAVE_PTM) | ||
list(APPEND SRCS arm_timer.c) | ||
endif() | ||
|
||
if(CONFIG_ARMV7A_L2CC_PL310) | ||
list(APPEND SRCS arm_l2cc_pl310.c) | ||
endif() | ||
|
||
if(CONFIG_PAGING) | ||
list( | ||
APPEND | ||
SRCS | ||
arm_allocpage.c | ||
arm_checkmapping.c | ||
arm_pginitialize.c | ||
arm_va2pte.c | ||
arm_pghead.S) | ||
else() | ||
list(APPEND SRCS arm_head.S) | ||
endif() | ||
|
||
if(CONFIG_ARCH_ADDRENV) | ||
list(APPEND SRCS arm_addrenv.c arm_addrenv_utils.c arm_addrenv_perms.c | ||
arm_pgalloc.c) | ||
if(CONFIG_ARCH_STACK_DYNAMIC) | ||
list(APPEND SRCS arm_addrenv_ustack.c) | ||
endif() | ||
if(CONFIG_ARCH_KERNEL_STACK) | ||
list(APPEND SRCS arm_addrenv_kstack.c) | ||
endif() | ||
if(CONFIG_ARCH_VMA_MAPPING) | ||
list(APPEND SRCS arm_addrenv_shm.c) | ||
endif() | ||
endif() | ||
|
||
if(CONFIG_MM_PGALLOC) | ||
list(APPEND SRCS arm_physpgaddr.c) | ||
if(CONFIG_ARCH_PGPOOL_MAPPING) | ||
list(APPEND SRCS arm_virtpgaddr.c) | ||
endif() | ||
endif() | ||
|
||
if(CONFIG_ARCH_FPU) | ||
list(APPEND SRCS arm_fpucmp.c arm_fpuconfig.S) | ||
endif() | ||
|
||
if(CONFIG_SMP) | ||
list( | ||
APPEND | ||
SRCS | ||
arm_cpuindex.c | ||
arm_cpustart.c | ||
arm_cpupause.c | ||
arm_cpuidlestack.c | ||
arm_scu.c) | ||
endif() | ||
|
||
target_sources(arch PRIVATE ${SRCS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# ############################################################################## | ||
# arch/arm/src/armv7-m/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
|
||
# TODO: do not use config to detect this | ||
|
||
set(SRCS | ||
arm_exception.S | ||
arm_saveusercontext.S | ||
arm_busfault.c | ||
arm_cache.c | ||
arm_cpuinfo.c | ||
arm_doirq.c | ||
arm_hardfault.c | ||
arm_initialstate.c | ||
arm_itm.c | ||
arm_memfault.c | ||
arm_perf.c | ||
arm_schedulesigaction.c | ||
arm_sigdeliver.c | ||
arm_svcall.c | ||
arm_systemreset.c | ||
arm_tcbinfo.c | ||
arm_trigger_irq.c | ||
arm_usagefault.c | ||
arm_vectors.c) | ||
|
||
if(CONFIG_ARMV7M_SYSTICK) | ||
list(APPEND SRCS arm_systick.c) | ||
endif() | ||
|
||
if(CONFIG_ARMV7M_ITMSYSLOG) | ||
list(APPEND SRCS arm_itm_syslog.c) | ||
endif() | ||
|
||
if(CONFIG_ARMV7M_STACKCHECK) | ||
list(APPEND SRCS arm_stackcheck.c) | ||
endif() | ||
|
||
if(CONFIG_ARCH_FPU) | ||
list(APPEND SRCS arm_fpuconfig.c arm_fpucmp.c) | ||
endif() | ||
|
||
if(CONFIG_ARCH_RAMVECTORS) | ||
list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c) | ||
endif() | ||
|
||
if(CONFIG_ARM_MPU OR CONFIG_ARM_MPU_EARLY_RESET) | ||
list(APPEND SRCS arm_mpu.c) | ||
endif() | ||
|
||
target_sources(arch PRIVATE ${SRCS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ############################################################################## | ||
# arch/arm/src/armv8-m/CMakeLists.txt | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with this work for | ||
# additional information regarding copyright ownership. The ASF licenses this | ||
# file to you under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
# ############################################################################## | ||
|
||
set(SRCS | ||
arm_exception.S | ||
arm_saveusercontext.S | ||
arm_busfault.c | ||
arm_cache.c | ||
arm_cpuinfo.c | ||
arm_doirq.c | ||
arm_hardfault.c | ||
arm_initialstate.c | ||
arm_itm.c | ||
arm_memfault.c | ||
arm_perf.c | ||
arm_sau.c | ||
arm_schedulesigaction.c | ||
arm_securefault.c | ||
arm_secure_irq.c | ||
arm_sigdeliver.c | ||
arm_svcall.c | ||
arm_systemreset.c | ||
arm_tcbinfo.c | ||
arm_trigger_irq.c | ||
arm_usagefault.c | ||
arm_vectors.c) | ||
|
||
if(CONFIG_ARMV8M_SYSTICK) | ||
list(APPEND SRCS arm_systick.c) | ||
endif() | ||
|
||
if(CONFIG_ARMV8M_ITMSYSLOG) | ||
list(APPEND SRCS arm_itm_syslog.c) | ||
endif() | ||
|
||
if(CONFIG_ARMV8M_STACKCHECK) | ||
list(APPEND SRCS arm_stackcheck.c) | ||
endif() | ||
|
||
if(CONFIG_ARCH_FPU) | ||
list(APPEND SRCS arm_fpuconfig.c arm_fpucmp.c) | ||
endif() | ||
|
||
if(CONFIG_ARCH_RAMVECTORS) | ||
list(APPEND SRCS arm_ramvec_initialize.c arm_ramvec_attach.c) | ||
endif() | ||
|
||
if(CONFIG_ARM_MPU OR CONFIG_ARM_MPU_EARLY_RESET) | ||
list(APPEND SRCS arm_mpu.c) | ||
endif() | ||
|
||
target_sources(arch PRIVATE ${SRCS}) |
Oops, something went wrong.