From f10b54a0812ddbb1654774df2c93b1ca568ceaf9 Mon Sep 17 00:00:00 2001 From: chao an Date: Thu, 13 Jul 2023 16:31:02 +0800 Subject: [PATCH] cmake: fix CMake build break Signed-off-by: chao an --- arch/sim/src/cmake/Toolchain.cmake | 94 ++++++++++++++++ arch/sim/src/sim/CMakeLists.txt | 52 ++++++--- boards/sim/sim/sim/src/CMakeLists.txt | 4 + drivers/misc/CMakeLists.txt | 20 ++++ drivers/motor/foc/CMakeLists.txt | 9 +- drivers/mtd/CMakeLists.txt | 33 ++++-- drivers/note/CMakeLists.txt | 16 ++- drivers/power/CMakeLists.txt | 151 +------------------------- drivers/power/battery/CMakeLists.txt | 89 +++++++++++++++ drivers/power/pm/CMakeLists.txt | 60 ++++++++++ drivers/power/relay/CMakeLists.txt | 33 ++++++ drivers/power/supply/CMakeLists.txt | 52 +++++++++ drivers/spi/CMakeLists.txt | 13 +++ fs/mmap/CMakeLists.txt | 6 +- fs/vfs/CMakeLists.txt | 22 ++-- libs/libc/pthread/CMakeLists.txt | 5 +- mm/kasan/CMakeLists.txt | 4 +- openamp/CMakeLists.txt | 2 +- openamp/libmetal.cmake | 2 + openamp/open-amp.cmake | 66 +++++++++-- sched/group/CMakeLists.txt | 6 +- 21 files changed, 527 insertions(+), 212 deletions(-) create mode 100644 drivers/power/battery/CMakeLists.txt create mode 100644 drivers/power/pm/CMakeLists.txt create mode 100644 drivers/power/relay/CMakeLists.txt create mode 100644 drivers/power/supply/CMakeLists.txt diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index b0e228a357c..14cff55a6fd 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -22,3 +22,97 @@ if(APPLE) find_program(CMAKE_C_ELF_COMPILER x86_64-elf-gcc) find_program(CMAKE_CXX_ELF_COMPILER x86_64-elf-g++) endif() + +if(WIN32) + return() +endif() + +add_compile_options(-fno-common) + +if(CONFIG_DEBUG_SYMBOLS) + add_compile_options(-g) +endif() + +if(CONFIG_SIM_M32) + add_compile_options(-m32) +endif() + +if(CONFIG_DEBUG_CUSTOMOPT) + add_compile_options(${CONFIG_DEBUG_OPTLEVEL}) +elseif(CONFIG_DEBUG_FULLOPT) + if(CONFIG_ARCH_TOOLCHAIN_CLANG) + add_compile_options(-Oz) + else() + add_compile_options(-Os) + endif() +endif() + +if(NOT CONFIG_DEBUG_NOOPT) + add_compile_options(-fno-strict-aliasing) +endif() + +if(CONFIG_FRAME_POINTER) + add_compile_options(-fno-omit-frame-pointer -fno-optimize-sibling-calls) +else() + add_compile_options(-fomit-frame-pointer) +endif() + +if(CONFIG_STACK_CANARIES) + add_compile_options(-fstack-protector-all) +endif() + +if(CONFIG_STACK_USAGE) + add_compile_options(-fstack-usage) +endif() + +if(CONFIG_ARCH_COVERAGE) + add_compile_options(-fprofile-generate -ftest-coverage) +endif() + +if(CONFIG_SIM_ASAN) + add_compile_options(-fsanitize=address) + add_compile_options(-fsanitize-address-use-after-scope) + add_compile_options(-fsanitize=pointer-compare) + add_compile_options(-fsanitize=pointer-subtract) +elseif(CONFIG_MM_KASAN_ALL) + add_compile_options(-fsanitize=kernel-address) +endif() + +if(CONFIG_SIM_UBSAN) + add_compile_options(-fsanitize=undefined) +else() + if(CONFIG_MM_UBSAN_ALL) + add_compile_options(${CONFIG_MM_UBSAN_OPTION}) + endif() + + if(CONFIG_MM_UBSAN_TRAP_ON_ERROR) + add_compile_options(-fsanitize-undefined-trap-on-error) + endif() +endif() + +set(ARCHCFLAGS "-Wstrict-prototypes") +set(ARCHCXXFLAGS "-nostdinc++") + +if(CONFIG_CXX_EXCEPTION) + string(APPEND ARCHCXXFLAGS " -fno-exceptions -fcheck-new") +endif() + +if(CONFIG_CXX_RTTI) + string(APPEND ARCHCXXFLAGS " -fno-rtti") +endif() + +if(NOT "${CMAKE_C_FLAGS}" STREQUAL "") + string(REGEX MATCH "${ARCHCFLAGS}" EXISTS_FLAGS "${CMAKE_C_FLAGS}") +endif() + +if(NOT EXISTS_FLAGS) + set(CMAKE_ASM_FLAGS + "${CMAKE_ASM_FLAGS}${ARCHCFLAGS}" + CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS}${ARCHCFLAGS}" + CACHE STRING "" FORCE) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS}${ARCHCXXFLAGS}" + CACHE STRING "" FORCE) +endif() diff --git a/arch/sim/src/sim/CMakeLists.txt b/arch/sim/src/sim/CMakeLists.txt index 989e11fa2c1..0babbd8e9d7 100644 --- a/arch/sim/src/sim/CMakeLists.txt +++ b/arch/sim/src/sim/CMakeLists.txt @@ -71,7 +71,7 @@ if(CONFIG_SCHED_BACKTRACE) list(APPEND SRCS sim_backtrace.c) endif() -if(CONFIG_ARCH_HAVE_FORK AND CONFIG_SCHED_WAITPID) +if(CONFIG_ARCH_HAVE_FORK) list(APPEND SRCS sim_fork.c) endif() @@ -111,9 +111,11 @@ if(CONFIG_RPTUN) endif() if(CONFIG_SIM_SOUND_ALSA) - list(APPEND SRCS sim_alsa.c) + list(APPEND SRCS posix/sim_alsa.c) + list(APPEND SRCS posix/sim_offload.c) list(APPEND STDLIBS asound) list(APPEND STDLIBS mad) + list(APPEND STDLIBS mp3lame) endif() # host sources ############################################################### @@ -127,6 +129,12 @@ list( sim_hosttime.c sim_hostuart.c) +if(CONFIG_SIM_CAMERA_V4L2) + list(APPEND HOSTSRCS sim_host_v4l2.c) + list(APPEND SRCS sim_camera.c) + list(APPEND STDLIBS v4l2) +endif() + if(CONFIG_SPINLOCK) list(APPEND HOSTSRCS sim_testset.c) endif() @@ -149,6 +157,10 @@ if(CONFIG_SIM_X11FB) elseif(CONFIG_SIM_BUTTONS) list(APPEND HOSTSRCS sim_x11eventloop.c) endif() + + if(CONFIG_SIM_KEYBOARD) + list(APPEND SRCS sim_keyboard.c) + endif() endif() if(CONFIG_SIM_NETDEV_TAP) @@ -168,31 +180,37 @@ elseif(CONFIG_SIM_NETDEV_VPNKIT) list(APPEND HOSTSRCS sim_vpnkit.c vpnkit/protocol.c vpnkit/negotiate.c) endif() -if(CONFIG_SIM_HCISOCKET) - list(APPEND HOSTSRCS sim_hcisocket_host.c) - list(APPEND SRCS sim_hcisocket.c) -endif() - if(CONFIG_SIM_NETUSRSOCK) - list(APPEND HOSTSRCS sim_usrsock_host.c) + list(APPEND HOSTSRCS sim_hostusrsock.c) list(APPEND SRCS sim_usrsock.c) endif() -if(CONFIG_SIM_BTUART) - list(APPEND HOSTSRCS sim_hcisocket_host.c) - list(APPEND SRCS sim_btuart.c) -endif() - -if(CONFIG_I2C_RESET) - list(APPEND HOST_DEFINITIONS CONFIG_I2C_RESET=1) +if(CONFIG_SIM_HCISOCKET) + list(APPEND HOSTSRCS sim_hosthcisocket.c) + list(APPEND SRCS sim_hcisocket.c) endif() if(CONFIG_SIM_I2CBUS_LINUX) - list(APPEND HOSTSRCS sim_i2cbuslinux.c) + list(APPEND HOSTSRCS sim_linuxi2c.c) endif() if(CONFIG_SIM_SPI_LINUX) - list(APPEND HOSTSRCS sim_spilinux.c) + list(APPEND HOSTSRCS sim_linuxspi.c) +endif() + +if(CONFIG_SIM_USB_DEV) + list(APPEND SRCS sim_usbdev.c) + if(CONFIG_SIM_USB_RAW_GADGET) + list(APPEND HOSTSRCS sim_rawgadget.c) + endif() +endif() + +if(CONFIG_SIM_USB_HOST) + list(APPEND SRCS sim_usbhost.c) + if(CONFIG_SIM_LIBUSB) + list(APPEND HOSTSRCS sim_libusb.c) + list(APPEND STDLIBS usb-1.0) + endif() endif() if(CONFIG_SIM_HOSTFS) diff --git a/boards/sim/sim/sim/src/CMakeLists.txt b/boards/sim/sim/sim/src/CMakeLists.txt index 51a1cb393b2..a984ba7af3a 100644 --- a/boards/sim/sim/sim/src/CMakeLists.txt +++ b/boards/sim/sim/sim/src/CMakeLists.txt @@ -56,6 +56,10 @@ if(CONFIG_MOTOR_FOC_DUMMY) list(APPEND SRCS sim_foc.c) endif() +if(CONFIG_USBDEV_COMPOSITE) + list(APPEND SRCS sim_composite.c) +endif() + target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/gnu-elf.ld") diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index f4f027b0252..f4debb2d737 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -31,6 +31,10 @@ if(CONFIG_DEV_ZERO) list(APPEND SRCS dev_zero.c) endif() +if(CONFIG_DEV_ASCII) + list(APPEND SRCS dev_ascii.c) +endif() + if(CONFIG_LWL_CONSOLE) list(APPEND SRCS lwl_console.c) endif() @@ -48,4 +52,20 @@ elseif(CONFIG_DRVR_READAHEAD) list(APPEND SRCS rwbuffer.c) endif() +if(CONFIG_DEV_RPMSG) + list(APPEND SRCS rpmsgdev.c) +endif() + +if(CONFIG_DEV_RPMSG_SERVER) + list(APPEND SRCS rpmsgdev_server.c) +endif() + +if(CONFIG_BLK_RPMSG) + list(APPEND SRCS rpmsgblk.c) +endif() + +if(CONFIG_BLK_RPMSG_SERVER) + list(APPEND SRCS rpmsgblk_server.c) +endif() + target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/motor/foc/CMakeLists.txt b/drivers/motor/foc/CMakeLists.txt index f77e50b5053..9f5c8f323b5 100644 --- a/drivers/motor/foc/CMakeLists.txt +++ b/drivers/motor/foc/CMakeLists.txt @@ -17,6 +17,13 @@ # the License. # # ############################################################################## + if(CONFIG_MOTOR_FOC) - target_sources(drivers PRIVATE foc_dev.c) + set(SRCS foc_dev.c) + if(CONFIG_MOTOR_FOC_DUMMY) + list(APPEND SRCS foc_dummy.c) + endif() + + target_include_directories(drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_sources(drivers PRIVATE ${SRCS}) endif() diff --git a/drivers/mtd/CMakeLists.txt b/drivers/mtd/CMakeLists.txt index 201bfc97759..bf8307ffdf3 100644 --- a/drivers/mtd/CMakeLists.txt +++ b/drivers/mtd/CMakeLists.txt @@ -21,7 +21,13 @@ # ############################################################################## if(CONFIG_MTD) - set(SRCS ftl.c mtd_config.c) + set(SRCS ftl.c) + + if(CONFIG_MTD_CONFIG_FAIL_SAFE) + list(APPEND SRCS mtd_config_fs.c) + elseif(CONFIG_MTD_CONFIG) + list(APPEND SRCS mtd_config.c) + endif() if(CONFIG_MTD_PARTITION) list(APPEND SRCS mtd_partition.c) @@ -33,10 +39,8 @@ if(CONFIG_MTD) if(CONFIG_MTD_WRBUFFER) list(APPEND SRCS mtd_rwbuffer.c) - else() - if(CONFIG_MTD_READAHEAD) - list(APPEND SRCS mtd_rwbuffer.c) - endif() + elseif(CONFIG_MTD_READAHEAD) + list(APPEND SRCS mtd_rwbuffer.c) endif() if(CONFIG_MTD_PROGMEM) @@ -52,7 +56,6 @@ if(CONFIG_MTD) mtd_nandscheme.c mtd_nandmodel.c mtd_modeltab.c) - if(CONFIG_MTD_NAND_SWECC) list(APPEND SRCS mtd_nandecc.c hamming.c) endif() @@ -66,6 +69,18 @@ if(CONFIG_MTD) list(APPEND SRCS filemtd.c) endif() + if(CONFIG_NULLMTD) + list(APPEND SRCS nullmtd.c) + endif() + + if(CONFIG_RPMSGMTD) + list(APPEND SRCS rpmsgmtd.c) + endif() + + if(CONFIG_RPMSGMTD_SERVER) + list(APPEND SRCS rpmsgmtd_server.c) + endif() + if(CONFIG_MTD_AT24XX) list(APPEND SRCS at24xx.c) endif() @@ -142,10 +157,8 @@ if(CONFIG_MTD) list(APPEND SRCS is25xp.c) endif() - if(CONFIG_MTD_SMART) - if(CONFIG_FS_SMARTFS) - list(APPEND SRCS smart.c) - endif() + if(CONFIG_MTD_SMART AND CONFIG_FS_SMARTFS) + list(APPEND SRCS smart.c) endif() target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/note/CMakeLists.txt b/drivers/note/CMakeLists.txt index 5215e75ef56..e2651cd9813 100644 --- a/drivers/note/CMakeLists.txt +++ b/drivers/note/CMakeLists.txt @@ -19,16 +19,26 @@ # ############################################################################## set(SRCS) -if(CONFIG_DRIVER_NOTE) +if(CONFIG_DRIVERS_NOTE) list(APPEND SRCS note_driver.c) + list(APPEND SRCS note_initialize.c) endif() -if(CONFIG_DRIVER_NOTERAM) +if(CONFIG_DRIVERS_NOTERAM) list(APPEND SRCS noteram_driver.c) endif() -if(CONFIG_DRIVER_NOTECTL) +if(CONFIG_DRIVERS_NOTELOG) + list(APPEND SRCS notelog_driver.c) +endif() + +if(CONFIG_DRIVERS_NOTECTL) list(APPEND SRCS notectl_driver.c) endif() +if(CONFIG_DRIVERS_NOTESNAP) + list(APPEND SRCS notesnap_driver.c) +endif() + target_sources(drivers PRIVATE ${SRCS}) +target_include_directories(drivers PRIVATE ${NUTTX_DIR}/sched) diff --git a/drivers/power/CMakeLists.txt b/drivers/power/CMakeLists.txt index e841ddf71aa..c52c4fdce35 100644 --- a/drivers/power/CMakeLists.txt +++ b/drivers/power/CMakeLists.txt @@ -20,153 +20,4 @@ # Include power management sources -set(SRCS) - -if(CONFIG_PM) - - list( - APPEND - SRCS - pm_initialize.c - pm_activity.c - pm_changestate.c - pm_checkstate.c - pm_register.c - pm_unregister.c - pm_autoupdate.c - pm_governor.c - pm_lock.c) - - if(CONFIG_PM_PROCFS) - list(APPEND SRCS pm_procfs.c) - endif() - - # Governor implementations - - if(CONFIG_PM_GOVERNOR_ACTIVITY) - - list(APPEND SRCS activity_governor.c) - - endif() - - if(CONFIG_PM_GOVERNOR_GREEDY) - - list(APPEND SRCS greedy_governor.c) - - endif() - -endif() - -# Add switched-mode power supply support - -if(CONFIG_DRIVERS_SMPS) - - list(APPEND SRCS smps.c) - -endif() - -# Add powerled support - -if(CONFIG_DRIVERS_POWERLED) - - list(APPEND SRCS powerled.c) - -endif() - -if(CONFIG_REGULATOR) - - list(APPEND SRCS regulator.c) - -endif() - -if(CONFIG_REGULATOR_RPMSG) - - list(APPEND SRCS regulator_rpmsg.c) - -endif() - -if(CONFIG_REGULATOR_GPIO) - - list(APPEND SRCS regulator_gpio.c) - -endif() - -# Add battery charger drivers - -if(CONFIG_BATTERY_CHARGER) - - list(APPEND SRCS battery_charger.c) - - # Add the MCP73871 battery charger driver - - if(CONFIG_MCP73871) - list(APPEND SRCS mcp73871.c) - endif() - - # Add I2C-based battery charger drivers - - if(CONFIG_I2C) - - # Add the BQ2425x I2C-based battery charger driver - - if(CONFIG_I2C_BQ2425X) - list(APPEND SRCS bq2425x.c) - endif() - - # Add the BQ2429x I2C-based battery charger driver - - if(CONFIG_I2C_BQ2429X) - list(APPEND SRCS bq2429x.c) - endif() - - # Add the axp202 I2C-based battery charger driver - - if(CONFIG_I2C_AXP202) - list(APPEND SRCS axp202.c) - endif() - - endif() - -endif() - -# Add battery gauge drivers - -if(CONFIG_BATTERY_GAUGE) - - list(APPEND SRCS battery_gauge.c) - - # Add I2C-based battery gauge drivers - - if(CONFIG_I2C) - - # Add the MAX1704x I2C-based battery gauge driver - - if(CONFIG_I2C_MAX1704X) - list(APPEND SRCS max1704x.c) - endif() - - # Add the bq27426 I2C-based battery gauge driver - - if(CONFIG_BQ27426) - list(APPEND SRCS bq27426.c) - endif() - - endif() - -endif() - -# Add battery monitor drivers - -if(CONFIG_BATTERY_MONITOR) - list(APPEND SRCS battery_monitor.c) - # Add I2C-based battery monitor drivers - - if(CONFIG_I2C) - # Add the BQ769x0 I2C-based battery monitor driver - if(CONFIG_I2C_BQ769X0) - list(APPEND SRCS bq769x0.c) - endif() - endif() -endif() - -target_sources(drivers PRIVATE ${SRCS}) +nuttx_add_subdirectory() diff --git a/drivers/power/battery/CMakeLists.txt b/drivers/power/battery/CMakeLists.txt new file mode 100644 index 00000000000..b782fd502b4 --- /dev/null +++ b/drivers/power/battery/CMakeLists.txt @@ -0,0 +1,89 @@ +# ############################################################################## +# drivers/power/battery/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. +# +# ############################################################################## + +# Include power management sources + +set(SRCS) + +# Add battery charger drivers + +if(CONFIG_BATTERY_CHARGER) + + list(APPEND SRCS battery_charger.c) + + # Add the MCP73871 battery charger driver + + if(CONFIG_MCP73871) + list(APPEND SRCS mcp73871.c) + endif() + + # Add the BQ2425x I2C-based battery charger driver + + if(CONFIG_I2C_BQ2425X) + list(APPEND SRCS bq2425x.c) + endif() + + # Add the BQ2429x I2C-based battery charger driver + + if(CONFIG_I2C_BQ2429X) + list(APPEND SRCS bq2429x.c) + endif() + + # Add the axp202 I2C-based battery charger driver + + if(CONFIG_I2C_AXP202) + list(APPEND SRCS axp202.c) + endif() + +endif() + +# Add battery gauge drivers + +if(CONFIG_BATTERY_GAUGE) + + list(APPEND SRCS battery_gauge.c) + + # Add the MAX1704x I2C-based battery gauge driver + + if(CONFIG_I2C_MAX1704X) + list(APPEND SRCS max1704x.c) + endif() + + # Add the bq27426 I2C-based battery gauge driver + + if(CONFIG_BQ27426) + list(APPEND SRCS bq27426.c) + endif() + +endif() + +# Add battery monitor drivers + +if(CONFIG_BATTERY_MONITOR) + list(APPEND SRCS battery_monitor.c) + # Add I2C-based battery monitor drivers + + # Add the BQ769x0 I2C-based battery monitor driver + if(CONFIG_I2C_BQ769X0) + list(APPEND SRCS bq769x0.c) + endif() +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/power/pm/CMakeLists.txt b/drivers/power/pm/CMakeLists.txt new file mode 100644 index 00000000000..94df6762aaf --- /dev/null +++ b/drivers/power/pm/CMakeLists.txt @@ -0,0 +1,60 @@ +# ############################################################################## +# drivers/power/pm/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. +# +# ############################################################################## + +# Include power management sources + +set(SRCS) + +if(CONFIG_PM) + + list( + APPEND + SRCS + pm_initialize.c + pm_activity.c + pm_changestate.c + pm_checkstate.c + pm_register.c + pm_unregister.c + pm_autoupdate.c + pm_governor.c + pm_lock.c) + + if(CONFIG_PM_PROCFS) + list(APPEND SRCS pm_procfs.c) + endif() + + # Governor implementations + + if(CONFIG_PM_GOVERNOR_ACTIVITY) + + list(APPEND SRCS activity_governor.c) + + endif() + + if(CONFIG_PM_GOVERNOR_GREEDY) + + list(APPEND SRCS greedy_governor.c) + + endif() + +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/power/relay/CMakeLists.txt b/drivers/power/relay/CMakeLists.txt new file mode 100644 index 00000000000..b21047a387b --- /dev/null +++ b/drivers/power/relay/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# drivers/power/relay/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. +# +# ############################################################################## + +# Include power management sources + +set(SRCS) + +if(CONFIG_RELAY) + list(APPEND SRCS relay.c) +endif() + +if(CONFIG_RELAY_GPIO) + list(APPEND SRCS relay_gpio.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/power/supply/CMakeLists.txt b/drivers/power/supply/CMakeLists.txt new file mode 100644 index 00000000000..2c2b1a76c54 --- /dev/null +++ b/drivers/power/supply/CMakeLists.txt @@ -0,0 +1,52 @@ +# ############################################################################## +# drivers/power/supply/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. +# +# ############################################################################## + +# Include power management sources + +set(SRCS) + +# Add powerled support + +if(CONFIG_DRIVERS_POWERLED) + list(APPEND SRCS powerled.c) +endif() + +if(CONFIG_DRIVERS_SMPS) + list(APPEND SRCS smps.c) +endif() + +if(CONFIG_REGULATOR) + list(APPEND SRCS regulator.c) + + if(CONFIG_REGULATOR_GPIO) + list(APPEND SRCS regulator_gpio.c) + endif() + + if(CONFIG_REGULATOR_RPMSG) + list(APPEND SRCS regulator_rpmsg.c) + endif() + + if(CONFIG_REGULATOR_ACT8945A) + list(APPEND SRCS act8945a.c) + endif() + +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/spi/CMakeLists.txt b/drivers/spi/CMakeLists.txt index 15e066bbae3..e5464894207 100644 --- a/drivers/spi/CMakeLists.txt +++ b/drivers/spi/CMakeLists.txt @@ -29,11 +29,24 @@ if(CONFIG_SPI) endif() endif() + if(CONFIG_SPI_SLAVE_DRIVER) + list(APPEND SRCS spi_slave_driver.c) + endif() + # Include the selected SPI drivers if(CONFIG_SPI_BITBANG) list(APPEND SRCS spi_bitbang.c) endif() + if(CONFIG_SPI_FLASH) + list(APPEND SRCS spi_flash.c) + endif() + + if(CONFIG_QSPI_FLASH) + list(APPEND SRCS qspi_flash.c) + endif() + target_sources(drivers PRIVATE ${SRCS}) + target_include_directories(drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) endif() diff --git a/fs/mmap/CMakeLists.txt b/fs/mmap/CMakeLists.txt index 527f828db5b..44177035531 100644 --- a/fs/mmap/CMakeLists.txt +++ b/fs/mmap/CMakeLists.txt @@ -18,10 +18,14 @@ # # ############################################################################## -set(SRCS fs_mmap.c fs_munmap.c) +set(SRCS fs_mmap.c fs_munmap.c fs_mmisc.c) if(CONFIG_FS_RAMMAP) list(APPEND SRCS fs_rammap.c) endif() +if(CONFIG_FS_ANONMAP) + list(APPEND SRCS fs_anonmap.c) +endif() + target_sources(fs PRIVATE ${SRCS}) diff --git a/fs/vfs/CMakeLists.txt b/fs/vfs/CMakeLists.txt index 283bee92a83..6e4bb967edf 100644 --- a/fs/vfs/CMakeLists.txt +++ b/fs/vfs/CMakeLists.txt @@ -21,12 +21,11 @@ set(SRCS fs_chstat.c fs_close.c - fs_dir.c - fs_dup2.c fs_dup.c + fs_dup2.c + fs_fcntl.c fs_epoll.c fs_fchstat.c - fs_fcntl.c fs_fstat.c fs_fstatfs.c fs_ioctl.c @@ -44,16 +43,15 @@ set(SRCS fs_stat.c fs_statfs.c fs_unlink.c - fs_write.c) + fs_write.c + fs_dir.c + fs_fsync.c + fs_truncate.c) # Certain interfaces are not available if there is no mountpoint support -if(NOT CONFIG_DISABLE_MOUNTPOINT) - list(APPEND SRCS fs_fsync.c fs_truncate.c) -endif() - if(NOT "${CONFIG_PSEUDOFS_SOFTLINKS}" STREQUAL "0") - list(APPEND SRCS fs_symlink.c fs_readlink.c) + list(APPEND SRCS fs_link.c fs_symlink.c fs_readlink.c) endif() # Stream support @@ -74,4 +72,10 @@ if(CONFIG_TIMER_FD) list(APPEND SRCS fs_timerfd.c) endif() +# Support for signalfd + +if(CONFIG_SIGNAL_FD) + list(APPEND SRCS fs_signalfd.c) +endif() + target_sources(fs PRIVATE ${SRCS}) diff --git a/libs/libc/pthread/CMakeLists.txt b/libs/libc/pthread/CMakeLists.txt index 53951789491..c6d8a923318 100644 --- a/libs/libc/pthread/CMakeLists.txt +++ b/libs/libc/pthread/CMakeLists.txt @@ -92,7 +92,8 @@ if(NOT CONFIG_DISABLE_PTHREAD) pthread_rwlock_wrlock.c pthread_setcancelstate.c pthread_setcanceltype.c - pthread_testcancel.c) + pthread_testcancel.c + pthread_getcpuclockid.c) if(CONFIG_SMP) list(APPEND SRCS pthread_attr_getaffinity.c pthread_attr_setaffinity.c) @@ -102,7 +103,7 @@ if(NOT CONFIG_DISABLE_PTHREAD) list(APPEND SRCS pthread_spinlock.c) endif() - if(CONFIG_PTHREAD_CLEANUP) + if(NOT CONFIG_PTHREAD_CLEANUP_STACKSIZE EQUAL 0) list(APPEND SRCS pthread_cleanup.c) endif() endif() diff --git a/mm/kasan/CMakeLists.txt b/mm/kasan/CMakeLists.txt index 3ccf404de7c..47fe790d789 100644 --- a/mm/kasan/CMakeLists.txt +++ b/mm/kasan/CMakeLists.txt @@ -19,5 +19,7 @@ # ############################################################################## if(CONFIG_MM_KASAN) target_sources(mm PRIVATE kasan.c) - target_compile_options(kasan PRIVATE -fno-sanitize=kernel-address) + set_source_files_properties(kasan.c PROPERTIES COMPILE_FLAGS + -fno-sanitize=kernel-address) + set_source_files_properties(kasan.c PROPERTIES COMPILE_FLAGS -fno-lto) endif() diff --git a/openamp/CMakeLists.txt b/openamp/CMakeLists.txt index 808cd85b615..782f807ff78 100644 --- a/openamp/CMakeLists.txt +++ b/openamp/CMakeLists.txt @@ -19,7 +19,7 @@ # ############################################################################## if(CONFIG_OPENAMP) - set(OPENAMP_VERSION 2022.04.0) + set(OPENAMP_VERSION 2022.10.0) include(libmetal.cmake) include(open-amp.cmake) diff --git a/openamp/libmetal.cmake b/openamp/libmetal.cmake index 6f584398598..60cf7fd0098 100644 --- a/openamp/libmetal.cmake +++ b/openamp/libmetal.cmake @@ -47,6 +47,8 @@ if("${CONFIG_ARCH}" STREQUAL "sim") set(LIBMETAL_ARCH x86_64) elseif("${CONFIG_ARCH}" STREQUAL "risc-v") set(LIBMETAL_ARCH riscv) +elseif("${CONFIG_ARCH}" STREQUAL "arm64") + set(LIBMETAL_ARCH aarch64) else() set(LIBMETAL_ARCH ${CONFIG_ARCH}) endif() diff --git a/openamp/open-amp.cmake b/openamp/open-amp.cmake index 8d1bbe5fba0..74227e3b524 100644 --- a/openamp/open-amp.cmake +++ b/openamp/open-amp.cmake @@ -50,51 +50,79 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp/.git) COMMAND touch ${CMAKE_CURRENT_LIST_DIR}/.openamp_patch COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0001-openamp-add-ns_unbind_notify-support.patch + ${CMAKE_CURRENT_LIST_DIR}/0001-ns-acknowledge-the-received-creation-message.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0002-ns-acknowledge-the-received-creation-message.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-Negotiate-individual-buffer-size-dynamically.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0003-Negotiate-individual-buffer-size-dynamically.patch + ${CMAKE_CURRENT_LIST_DIR}/0003-rpmsg-wait-endpoint-ready-in-rpmsg_send-and-rpmsg_se.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0004-rpmsg-wait-endpoint-ready-in-rpmsg_send-and-rpmsg_se.patch + ${CMAKE_CURRENT_LIST_DIR}/0004-openamp-add-new-ops-notify_wait-support.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0005-openamp-add-new-ops-notify_wait-support.patch + ${CMAKE_CURRENT_LIST_DIR}/0005-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0006-openamp-divide-shram-to-TX-shram-RX-shram-by-config-.patch + ${CMAKE_CURRENT_LIST_DIR}/0006-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0007-openamp-don-t-need-check-status-when-get_tx_payload.patch + ${CMAKE_CURRENT_LIST_DIR}/0007-openamp-avoid-double-calling-ns_bound-when-each-othe.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0008-openamp-add-available_idx-to-dump.patch > + ${CMAKE_CURRENT_LIST_DIR}/0008-remoteproc-make-all-elf_-functions-static-except-elf.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0009-openamp-firstly-take-all-buffer-from-shram-pool.patch + ${CMAKE_CURRENT_LIST_DIR}/0009-Fix-warn-declaration-of-vring_rsc-shadows-a-previous.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0010-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch + ${CMAKE_CURRENT_LIST_DIR}/0010-rptun-fix-rptun-don-t-wait-issue-when-get-tx-patyloa.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0011-openamp-avoid-double-calling-ns_bound-when-each-othe.patch + ${CMAKE_CURRENT_LIST_DIR}/0011-rpmsg-fix-rpmsg_virtio_get_tx_buffer-no-idx-return.patch > /dev/null || (exit 0) COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0012-remoteproc-make-all-elf_-functions-static-except-elf.patch + ${CMAKE_CURRENT_LIST_DIR}/0012-rpmsg-add-new-API-rpdev_release_tx-rx_buffer.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0013-openamp-add-error-log-when-ept-cb-return-error.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0014-rpmsg-add-cache-flash-when-hold-rx-buffer.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0015-rpmsg-do-cache_invalidate-when-real-data-returned.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0016-openamp-add-new-API-rpmsg_virtio_get_rxbuffer_size.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0017-virtio-follow-virtio-1.2-spec-add-more-virtio-status.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0018-virtio-decoupling-the-transport-layer-and-virtio-dev.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0019-virtio.h-add-version-in-device-id-table.patch > /dev/null || (exit 0) DEPENDS open-amp) add_custom_target(openamp_patch @@ -103,6 +131,20 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp/.git) endif() nuttx_add_kernel_library(openamp) + +if (CONFIG_OPENAMP_CACHE) + target_compile_options(openamp PRIVATE -DVIRTIO_CACHED_BUFFERS) + target_compile_options(openamp PRIVATE -DVIRTIO_CACHED_VRINGS) +endif() + +if (CONFIG_OPENAMP_RPMSG_DEBUG) + target_compile_options(openamp PRIVATE -DRPMSG_DEBUG) +endif() + +if (CONFIG_OPENAMP_VQUEUE_DEBUG) + target_compile_options(openamp PRIVATE -DVQUEUE_DEBUG) +endif() + target_sources( openamp PRIVATE open-amp/lib/remoteproc/elf_loader.c diff --git a/sched/group/CMakeLists.txt b/sched/group/CMakeLists.txt index 03b1ac816c0..e9958ad24b3 100644 --- a/sched/group/CMakeLists.txt +++ b/sched/group/CMakeLists.txt @@ -43,10 +43,6 @@ if(CONFIG_SCHED_USER_IDENTITY) list(APPEND SRCS group_setuid.c group_setgid.c group_getuid.c group_getgid.c) endif() -if(CONFIG_ARCH_ADDRENV) - list(APPEND SRCS group_addrenv.c) -endif() - if(CONFIG_SIG_SIGSTOP_ACTION) list(APPEND SRCS group_suspendchildren.c group_continue.c) endif() @@ -55,7 +51,7 @@ if(CONFIG_BINFMT_LOADABLE) list(APPEND SRCS group_exitinfo.c) endif() -if(NOT CONFIG_BUILD_FLAT) +if(CONFIG_MM_KERNEL_HEAP) list(APPEND SRCS group_malloc.c group_realloc.c group_zalloc.c group_free.c) endif()