diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..01d6c6989f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,697 @@ +# ############################################################################## +# 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. +# +# ############################################################################## + +# ~~~ +# Instructions: +# - Run CMake from the user project directory: +# cmake -S -B -DBOARD_CONFIG= +# - NuttX will look for the nuttx-apps repository from its parent folder +# i.e., ../nuttx-apps. +# - A custom directory can be specified with -DNUTTX_APPS_DIR=. +# - Build the user project with: +# cmake --build +# ~~~ + +# Request a version available on latest Ubuntu LTS (20.04) + +cmake_minimum_required(VERSION 3.16) + +# Handle newer CMake versions correctly by setting policies + +if(POLICY CMP0115) + # do not auto-guess extension in target_sources() + cmake_policy(SET CMP0115 NEW) +endif() + +# Basic CMake configuration ################################################## + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_EXTENSIONS OFF) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Setup build type (Debug Release RelWithDebInfo MinSizeRel Coverage). Default +# to minimum size release + +# Use nuttx optimization configuration options, workaround for cmake build type +# TODO Integration the build type with CMAKE + +# if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING +# "Build type" FORCE) endif() set_property(CACHE CMAKE_BUILD_TYPE PROPERTY +# STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel") + +# Process board config & directory locations ################################# + +set(NUTTX_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +if(NOT DEFINED BOARD_CONFIG) + message(FATAL_ERROR "Please define configuration with BOARD_CONFIG") +endif() + +if(EXISTS ${BOARD_CONFIG} AND EXISTS ${BOARD_CONFIG}/defconfig) + get_filename_component(NUTTX_BOARD_ABS_DIR ${BOARD_CONFIG} ABSOLUTE BASE_DIR + ${NUTTX_DIR}) + + string(REPLACE "/" ";" CONFIG_ARRAY ${NUTTX_BOARD_ABS_DIR}) + + list(LENGTH CONFIG_ARRAY CONFIG_ARRAY_LENGTH) + + if(${CONFIG_ARRAY_LENGTH} LESS 4) + message(FATAL_ERROR "Please define correct board config : ${BOARD_CONFIG}") + endif() + + math(EXPR NUTTX_CONFIG_INDEX "${CONFIG_ARRAY_LENGTH} - 1") + math(EXPR NUTTX_BOARD_INDEX "${CONFIG_ARRAY_LENGTH} - 3") + list(GET CONFIG_ARRAY ${NUTTX_BOARD_INDEX} NUTTX_BOARD) + list(GET CONFIG_ARRAY ${NUTTX_CONFIG_INDEX} NUTTX_CONFIG) + + string(REGEX REPLACE "(.*)/(.*)/${NUTTX_CONFIG}" "\\1" NUTTX_BOARD_DIR + ${NUTTX_BOARD_ABS_DIR}) + set(NUTTX_DEFCONFIG ${BOARD_CONFIG}/defconfig) +else() + if(BOARD_CONFIG MATCHES "/") + set(MATCH_REGEX "/") + else() + set(MATCH_REGEX ":") + endif() + + string(REPLACE ${MATCH_REGEX} ";" CONFIG_ARRAY ${BOARD_CONFIG}) + + list(LENGTH CONFIG_ARRAY CONFIG_ARRAY_LENGTH) + + if(${CONFIG_ARRAY_LENGTH} LESS 2) + message(FATAL_ERROR "Please define correct board config : ${BOARD_CONFIG}") + endif() + + list(GET CONFIG_ARRAY 0 NUTTX_BOARD) + list(GET CONFIG_ARRAY 1 NUTTX_CONFIG) + + file( + GLOB NUTTX_BOARD_DIR + LIST_DIRECTORIES true + "${NUTTX_DIR}/boards/*/*/${NUTTX_BOARD}") + + if(EXISTS ${NUTTX_BOARD_DIR}/configs/${NUTTX_CONFIG}/defconfig) + set(NUTTX_DEFCONFIG ${NUTTX_BOARD_DIR}/configs/${NUTTX_CONFIG}/defconfig) + endif() +endif() + +if("${NUTTX_CONFIG}" STREQUAL "") + message(FATAL_ERROR "Please define correct board config : ${NUTTX_CONFIG}") +endif() + +if(NOT EXISTS "${NUTTX_DEFCONFIG}") + message(FATAL_ERROR "No config file found at ${NUTTX_DEFCONFIG}") +endif() + +# Generate inital .config ################################################### +# This is needed right before any other configure step so that we can source +# Kconfig variables into CMake variables + +# The following commands need these variables to be passed via environment + +include(nuttx_kconfig) +nuttx_export_kconfig_by_value(${NUTTX_DEFCONFIG} "CONFIG_APPS_DIR") + +if(NOT CONFIG_APPS_DIR) + if(EXISTS "${NUTTX_DIR}/../apps") + set(NUTTX_APPS_DIR "${NUTTX_DIR}/../apps") + elseif(EXISTS "${NUTTX_DIR}/../nuttx-apps") + set(NUTTX_APPS_DIR "${NUTTX_DIR}/../nuttx-apps") + else() + message( + WARNING + "apps/nuttx-apps directory is not found, use dummy directory instead") + set(NUTTX_APPS_DIR "${NUTTX_DIR}/dummy") + endif() +else() + set(NUTTX_APPS_DIR ${CONFIG_APPS_DIR}) + set(CONFIG_APPS_DIR) +endif() + +if(NOT EXISTS "${NUTTX_APPS_DIR}") + message(FATAL_ERROR "Application directory ${NUTTX_APPS_DIR} is not found") +endif() + +get_filename_component(apps_dir ${NUTTX_APPS_DIR} NAME) +set(NUTTX_APPS_BINDIR "${CMAKE_BINARY_DIR}/${apps_dir}") + +# Support not having application directory + +if("${apps_dir}" STREQUAL "dummy") + file(MAKE_DIRECTORY ${NUTTX_APPS_BINDIR}) + file(TOUCH ${NUTTX_APPS_BINDIR}/Kconfig) +endif() + +set(ENV{PYTHONPYCACHEPREFIX} ${CMAKE_BINARY_DIR}) +set(ENV{APPSDIR} ${NUTTX_APPS_DIR}) # TODO: support not having apps/ +set(ENV{APPSBINDIR} ${NUTTX_APPS_BINDIR}) # TODO: support not having apps/ +set(ENV{BINDIR} ${CMAKE_BINARY_DIR}) # TODO: support not having apps/ +set(ENV{EXTERNALDIR} dummy) # TODO +set(ENV{DRIVERS_PLATFORM_DIR} dummy) # TODO + +set(ENV{HOST_LINUX} n) +set(ENV{HOST_MACOS} n) +set(ENV{HOST_WINDOWS} n) +set(ENV{HOST_OTHER} n) + +if(APPLE) + set(ENV{HOST_MACOS} y) +elseif(WIN32) + set(ENV{HOST_WINDOWS} y) +elseif(UNIX) + set(ENV{HOST_LINUX} y) + set(LINUX TRUE) +else() + set(ENV{HOST_OTHER} y) + set(OTHER_OS TRUE) +endif() + +include(nuttx_parse_function_args) +include(nuttx_add_subdirectory) +include(nuttx_create_symlink) + +# Add apps/ to the build (if present) + +if(NOT EXISTS ${NUTTX_APPS_BINDIR}/Kconfig) + add_subdirectory(${NUTTX_APPS_DIR} preapps) +endif() + +nuttx_export_kconfig(${NUTTX_DEFCONFIG}) + +if(CONFIG_ARCH_BOARD_CUSTOM) + get_filename_component(NUTTX_BOARD_DIR ${CONFIG_ARCH_BOARD_CUSTOM_DIR} + ABSOLUTE BASE_DIR ${NUTTX_DIR}) +endif() + +if("${NUTTX_BOARD_DIR}" STREQUAL "") + message(FATAL_ERROR "Please define correct board : ${NUTTX_BOARD_DIR}") +endif() + +if(NOT EXISTS "${NUTTX_BOARD_DIR}/CMakeLists.txt" + AND NOT EXISTS "${NUTTX_BOARD_DIR}/../common/CMakeLists.txt") + message(FATAL_ERROR "No CMakeList.txt found at ${NUTTX_BOARD_DIR}") +endif() + +# Custom board ################################################### + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/boards/dummy) +if(CONFIG_ARCH_BOARD_CUSTOM) + get_filename_component(NUTTX_BOARD_ABS_DIR ${CONFIG_ARCH_BOARD_CUSTOM_DIR} + ABSOLUTE BASE_DIR ${NUTTX_DIR}) +else() + set(NUTTX_BOARD_ABS_DIR ${NUTTX_BOARD_DIR}) + file(TOUCH ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig) + if(CONFIG_ARCH_BOARD_CUSTOM) + nuttx_create_symlink(${NUTTX_BOARD_ABS_DIR}/Kconfig + ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig) + else() + file(TOUCH ${CMAKE_BINARY_DIR}/boards/dummy/Kconfig) + endif() +endif() + +# board platfrom driver + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/drivers) + +if(EXISTS ${NUTTX_BOARD_ABS_DIR}/../drivers + AND EXISTS ${NUTTX_BOARD_ABS_DIR}/../drivers/Kconfig) + nuttx_create_symlink(${NUTTX_BOARD_ABS_DIR}/../drivers + ${CMAKE_BINARY_DIR}/drivers/platform) +else() + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/drivers/platform) + file(TOUCH ${CMAKE_BINARY_DIR}/drivers/platform/Kconfig) +endif() + +# Custom chip ################################################### + +if(CONFIG_ARCH_CHIP_CUSTOM) + get_filename_component(NUTTX_CHIP_ABS_DIR ${CONFIG_ARCH_CHIP_CUSTOM_DIR} + ABSOLUTE BASE_DIR ${NUTTX_DIR}) + set(NUTTX_CHIP_ABS_DIR ${NUTTX_CHIP_ABS_DIR}) +else() + set(NUTTX_CHIP_ABS_DIR + "${NUTTX_DIR}/arch/${CONFIG_ARCH}/src/${CONFIG_ARCH_CHIP}") +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/dummy) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/arch/dummy) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/dummy/Kconfig) + if(CONFIG_ARCH_CHIP_CUSTOM) + nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR}/Kconfig + ${CMAKE_BINARY_DIR}/arch/dummy/Kconfig) + else() + file(TOUCH ${CMAKE_BINARY_DIR}/arch/dummy/Kconfig) + endif() +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}/src) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}/src/chip) + nuttx_create_symlink(${NUTTX_CHIP_ABS_DIR} + ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}/src/chip) +endif() + +# Unsupport custom board/chips yet, workaround + +if(NOT EXISTS ${NUTTX_APPS_BINDIR}/platform/board/Kconfig) + file(MAKE_DIRECTORY ${NUTTX_APPS_BINDIR}/platform/board) + file(TOUCH ${NUTTX_APPS_BINDIR}/platform/board/Kconfig) +endif() + +# Copy board defconfig into main directory and expand TODO: do also for changes +# in board/config (by comparing stored defconfig to specified one) + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL + "${NUTTX_DEFCONFIG_SAVED}") + + message(STATUS "Initializing NuttX") + configure_file(${NUTTX_DEFCONFIG} defconfig COPYONLY) + configure_file(${NUTTX_DEFCONFIG} .config.compressed COPYONLY) + + set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config.compressed) + + # Do olddefconfig step to expand the abbreviated defconfig into normal config + execute_process( + COMMAND olddefconfig + OUTPUT_VARIABLE KCONFIG_OUTPUT + RESULT_VARIABLE KCONFIG_STATUS + WORKING_DIRECTORY ${NUTTX_DIR}) + + file(RENAME ${CMAKE_BINARY_DIR}/.config.compressed + ${CMAKE_BINARY_DIR}/.config) + set(ENV{KCONFIG_CONFIG} ${CMAKE_BINARY_DIR}/.config) + + # store original expanded .config + configure_file(${CMAKE_BINARY_DIR}/.config ${CMAKE_BINARY_DIR}/.config.orig + COPYONLY) + + if(KCONFIG_STATUS AND NOT KCONFIG_STATUS EQUAL 0) + message( + FATAL_ERROR + "Failed to initialize Kconfig configuration: ${KCONFIG_OUTPUT}") + endif() + + set(NUTTX_DEFCONFIG_SAVED + ${NUTTX_DEFCONFIG} + CACHE INTERNAL "Saved defconfig path" FORCE) + + # Print configuration choices + + message(STATUS " Board: ${NUTTX_BOARD}") + message(STATUS " Config: ${NUTTX_CONFIG}") + message(STATUS " Appdir: ${NUTTX_APPS_DIR}") +endif() + +# Include .cmake files ####################################################### + +# this exposes all Kconfig vars to CMake + +nuttx_export_kconfig(${CMAKE_BINARY_DIR}/.config) + +include(nuttx_generate_headers) +include(nuttx_generate_outputs) +include(nuttx_add_library) +include(nuttx_add_application) +include(nuttx_add_romfs) +include(nuttx_add_symtab) +include(nuttx_add_module) +include(menuconfig) + +include(ExternalProject) +include(FetchContent) + +set(FETCHCONTENT_QUIET OFF) + +# Setup toolchain ############################################################ + +# This needs to happen before project() when binaries are searched for + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/arch/${CONFIG_ARCH}/src/cmake) +set(CMAKE_TOOLCHAIN_FILE + "${CMAKE_SOURCE_DIR}/arch/${CONFIG_ARCH}/src/cmake/Toolchain.cmake") + +# Define project ############################################################# +# This triggers configuration + +project(NuttX LANGUAGES C CXX ASM) +if(WIN32) + enable_language(ASM_MASM) +endif() + +# Setup platform options (this needs to happen after project(), once the +# toolchain file has been processed) + +include(platform) + +# Setup main nuttx target #################################################### + +add_executable(nuttx) +add_dependencies(nuttx nuttx_context) + +if(WIN32) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT + nuttx) +endif() + +if(CONFIG_ARCH_SIM) + # Create separate sim_head OBJECT library built as part of NuttX kernel It + # must be separated to allow for linking against the rest of NuttX libraries + + add_library(sim_head OBJECT) + nuttx_add_library_internal(sim_head) + get_property( + definitions + TARGET nuttx + PROPERTY NUTTX_KERNEL_DEFINITIONS) + target_compile_definitions(sim_head PRIVATE ${definitions}) + + get_property( + options + TARGET nuttx + PROPERTY NUTTX_KERNEL_COMPILE_OPTIONS) + target_compile_options(sim_head PRIVATE ${options}) + + # We need the relocatable object to be first in the list of libraries to be + # linked against final nuttx binary + + if(NOT WIN32) + target_link_libraries(nuttx PRIVATE ${CMAKE_BINARY_DIR}/nuttx.rel) + endif() +else() + # These flags apply to source files not part of the library. In sim build this + # corresponds to "host" files, so we only do this on non-sim build + target_compile_definitions( + nuttx + PRIVATE $>) + target_compile_options( + nuttx PRIVATE $>) +endif() + +# Compiler options TODO: move elsewhere + +if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.9) + # force color for gcc > 4.9 + add_compile_options(-fdiagnostics-color=always) + endif() +endif() + +if(WIN32) + add_compile_options( + -W2 + -wd4116 # unnamed type definition in parentheses + -wd4146 # unary minus operator applied to unsigned type, result still + # unsigned + -wd4244 # 'argument' : conversion from 'type1' to 'type2', possible loss of + # data + -wd4305 # 'context' : truncation from 'type1' to 'type2' + ) +else() + add_compile_options( + # system wide warnings + -Wall + $<$:-Wstrict-prototypes> + -Wshadow + -Wundef + # system wide options + $<$:-nostdinc++> + $<$:-D__ASSEMBLY__>) +endif() + +if(NOT CONFIG_CXX_EXCEPTION) + add_compile_options($<$:-fno-exceptions> + $<$:-fcheck-new>) +endif() + +if(CONFIG_STACK_CANARIES) + add_compile_options(-fstack-protector-all) +endif() + +if(CONFIG_NDEBUG) + add_compile_options(-DNDEBUG) +endif() + +add_definitions(-D__NuttX__) + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_KERNEL_DEFINITIONS __KERNEL__) + +# Recurse subdirectories ##################################################### + +# Each subdirectory will generate a static library + +if(CONFIG_OPENAMP) + include_directories(${CMAKE_SOURCE_DIR}/openamp/open-amp/lib/include) +endif() + +add_subdirectory(openamp) +add_subdirectory(arch) +add_subdirectory(audio) +add_subdirectory(binfmt) +add_subdirectory(drivers) +add_subdirectory(fs) +add_subdirectory(graphics) +add_subdirectory(libs) +add_subdirectory(mm) +add_subdirectory(net) +add_subdirectory(sched) +add_subdirectory(syscall) +add_subdirectory(wireless) + +# This picks up the chosen board (as well as common board code) + +add_subdirectory(boards) + +# POSTBUILD -- Perform post build operations Some architectures require the use +# of special tools and special handling AFTER building the NuttX binary. +# Make.defs files for those architectures should override the following define +# with the correct operations for that platform + +if(TARGET nuttx_post_build) + add_custom_target(post_build ALL DEPENDS nuttx_post_build) +endif() + +# Add apps/ to the build (if present) + +if(EXISTS ${NUTTX_APPS_DIR}/CMakeLists.txt) + add_subdirectory(${NUTTX_APPS_DIR} apps) +else() + message( + STATUS "Application directory not found at ${NUTTX_APPS_DIR}, skipping") +endif() + +# Link step ################################################################## + +# Get linker script to use +get_property(ldscript GLOBAL PROPERTY LD_SCRIPT) + +# Perform link + +# Add empty source file to nuttx target since cmake requires at least one file +# and we will only be linking libraries + +if(CONFIG_HAVE_CXX) + file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/empty.cxx") + target_sources(nuttx PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/empty.cxx") +else() + file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/empty.c") + target_sources(nuttx PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/empty.c") +endif() + +# initialize manifest to hold all generated files +file(TOUCH ${CMAKE_BINARY_DIR}/nuttx.manifest) + +get_property(nuttx_kernel_libs GLOBAL PROPERTY NUTTX_KERNEL_LIBRARIES) +if(CONFIG_BUILD_FLAT) + get_property(nuttx_system_libs GLOBAL PROPERTY NUTTX_SYSTEM_LIBRARIES) +endif() +get_property(nuttx_apps_libs GLOBAL PROPERTY NUTTX_APPS_LIBRARIES) +get_property(nuttx_extra_libs GLOBAL PROPERTY NUTTX_EXTRA_LIBRARIES) + +set(nuttx_libs ${nuttx_kernel_libs} ${nuttx_system_libs} ${nuttx_apps_libs} + ${nuttx_extra_libs}) + +if(NOT CONFIG_ARCH_SIM) + # TODO: nostart/nodefault not applicable to nuttx toolchain + target_link_libraries( + nuttx PRIVATE ${NUTTX_EXTRA_FLAGS} -Wl,--script=${ldscript} + -Wl,--start-group ${nuttx_libs} -Wl,--end-group) + + # generate binary outputs in different formats (.bin, .hex, etc) + nuttx_generate_outputs(nuttx) + + if(CONFIG_UBOOT_UIMAGE) + add_custom_command( + OUTPUT uImage + COMMAND + ${MKIMAGE} -A ${CONFIG_ARCH} -O linux -C none -T kernel -a + ${CONFIG_UIMAGE_LOAD_ADDRESS} -e ${CONFIG_UIMAGE_ENTRY_POINT} -n nuttx + -d nuttx.bin uImage + DEPENDS nuttx) + add_custom_target(nuttx-uImage ALL DEPENDS uImage) + + # TODO: install? $(Q) if [ -w /tftpboot ] ; then \ cp -f uImage + # /tftpboot/uImage; \ fi + file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest uImage) + endif() +elseif(WIN32) + target_link_options(nuttx PUBLIC /SAFESEH:NO) + set(nuttx_libs_paths) + foreach(lib ${nuttx_libs}) + list(APPEND nuttx_libs_paths $) + endforeach() + + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/nuttx_all.lib + COMMAND ${CMAKE_AR} /OUT:${CMAKE_BINARY_DIR}/nuttx_all.lib + ${nuttx_libs_paths} + DEPENDS ${nuttx_libs} + VERBATIM) + add_custom_target(nuttx_all-lib DEPENDS ${CMAKE_BINARY_DIR}/nuttx_all.lib) + add_dependencies(nuttx nuttx_all-lib) + target_link_libraries(nuttx PRIVATE $ + ${CMAKE_BINARY_DIR}/nuttx_all.lib) +else() + # On sim platform the link step is a little different. NuttX is first built + # into a partially linked relocatable object nuttx.rel with no interface to + # host OS. Then, the names of symbols that conflict with libc symbols are + # renamed. The final nuttx binary is built by linking the host-specific + # objects with the relocatable binary. + + # C++ global objects are constructed before main get executed, but it isn't a + # good point for simulator because NuttX doesn't finish the kernel + # initialization yet. So we have to skip the standard facilities and do the + # construction by ourself. But how to achieve the goal? 1.Command linker + # generate the default script(-verbose) 2.Replace + # __init_array_start/__init_array_end with _sinit/_einit 3.Append + # __init_array_start = .; __init_array_end = .; Step 2 let nxtask_startup find + # objects need to construct Step 3 cheat the host there is no object to + # construct Note: the destructor can be fixed in the same way. + + if(NOT APPLE) + add_custom_command( + OUTPUT nuttx.ld + COMMAND + ${CMAKE_C_COMPILER} ${CMAKE_EXE_LINKER_FLAGS} + $<$:-m32> -Wl,-verbose 2> /dev/null > + nuttx-orig.ld || true + COMMAND + cat nuttx-orig.ld | sed -e '/====/,/====/!d\;//d' -e + 's/__executable_start/_stext/g' -e 's/__init_array_start/_sinit/g' -e + 's/__init_array_end/_einit/g' -e 's/__fini_array_start/_sfini/g' -e + 's/__fini_array_end/_efini/g' > nuttx.ld + COMMAND + echo ARGS + '__init_array_start = .\; __init_array_end = .\; __fini_array_start = .\; __fini_array_end = .\;' + >> nuttx.ld) + endif() + + # conflicting symbols to rename + + include(nuttx_redefine_symbols) + + # TODO: do with single function call? + set(nuttx_libs_paths) + foreach(lib ${nuttx_libs}) + list(APPEND nuttx_libs_paths $) + endforeach() + + add_custom_command( + OUTPUT nuttx.rel + COMMAND + ${CMAKE_C_COMPILER} ARGS -r $<$:-m32> + $ $<$>:-Wl,--start-group> + ${nuttx_libs_paths} $<$>:-Wl,--end-group> -o + nuttx.rel + COMMAND ${CMAKE_OBJCOPY} --redefine-syms=nuttx-names.dat nuttx.rel + DEPENDS ${nuttx_libs_paths} sim_head + COMMAND_EXPAND_LISTS) + add_custom_target(nuttx-rel DEPENDS nuttx.rel + $<$>:nuttx.ld>) + + # link the final nuttx binary + add_dependencies(nuttx nuttx-rel) + target_link_options(nuttx PUBLIC $<$>:-T nuttx.ld> + $<$:-m32>) +endif() + +# TODO: if we use an install target a manifest may not be needed +if(CONFIG_ARCH_SIM) + file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "nuttx\n") +endif() + +# Userspace portion ########################################################## + +if(NOT CONFIG_BUILD_FLAT) + add_executable(nuttx_user) + + get_property(nuttx_system_libs GLOBAL PROPERTY NUTTX_SYSTEM_LIBRARIES) + + get_property(user_ldscript GLOBAL PROPERTY LD_SCRIPT_USER) + list(TRANSFORM user_ldscript PREPEND "-Wl,--script=") + + target_link_options( + nuttx_user PRIVATE -nostartfiles -nodefaultlibs + -Wl,--entry=${CONFIG_USER_ENTRYPOINT} + -Wl,--undefined=${CONFIG_USER_ENTRYPOINT}) + + target_link_libraries( + nuttx_user + PRIVATE ${user_ldscript} + userspace + $<$>:-Wl,--start-group> + ${nuttx_system_libs} + gcc + $<$:supc++> + $<$>:-Wl,--end-group>) + + add_custom_command( + OUTPUT User.map + COMMAND ${CMAKE_NM} nuttx_user > User.map + DEPENDS nuttx_user) + add_custom_target(usermap ALL DEPENDS User.map) + + # generate binary outputs in different formats (.bin, .hex, etc) + nuttx_generate_outputs(nuttx_user) + + # create merged .hex file ready to be flashed TODO: does not seem to be + # generating a functional hex file + if(CONFIG_INTELHEX_BINARY AND SREC_CAT) + add_custom_command( + OUTPUT nuttx_combined.hex + COMMAND ${SREC_CAT} nuttx.hex -intel nuttx_user.hex -intel -o + nuttx_combined.hex -intel + DEPENDS nuttx_user nuttx) + add_custom_target(nuttx-combined ALL DEPENDS nuttx_combined.hex) + endif() + + # TODO: could also merge elf binaries +endif() diff --git a/arch/CMakeLists.txt b/arch/CMakeLists.txt new file mode 100644 index 0000000000..ac8f147493 --- /dev/null +++ b/arch/CMakeLists.txt @@ -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 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}) diff --git a/arch/arm/CMakeLists.txt b/arch/arm/CMakeLists.txt new file mode 100644 index 0000000000..cf3a6c3e76 --- /dev/null +++ b/arch/arm/CMakeLists.txt @@ -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() diff --git a/arch/arm/src/CMakeLists.txt b/arch/arm/src/CMakeLists.txt new file mode 100644 index 0000000000..e459f0853c --- /dev/null +++ b/arch/arm/src/CMakeLists.txt @@ -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() diff --git a/arch/arm/src/armv7-a/CMakeLists.txt b/arch/arm/src/armv7-a/CMakeLists.txt new file mode 100644 index 0000000000..75cca9eda8 --- /dev/null +++ b/arch/arm/src/armv7-a/CMakeLists.txt @@ -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}) diff --git a/arch/arm/src/armv7-m/CMakeLists.txt b/arch/arm/src/armv7-m/CMakeLists.txt new file mode 100644 index 0000000000..3adbedce30 --- /dev/null +++ b/arch/arm/src/armv7-m/CMakeLists.txt @@ -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}) diff --git a/arch/arm/src/armv8-m/CMakeLists.txt b/arch/arm/src/armv8-m/CMakeLists.txt new file mode 100644 index 0000000000..251a02a9e7 --- /dev/null +++ b/arch/arm/src/armv8-m/CMakeLists.txt @@ -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}) diff --git a/arch/arm/src/cmake/Toolchain.cmake b/arch/arm/src/cmake/Toolchain.cmake new file mode 100644 index 0000000000..f61e266349 --- /dev/null +++ b/arch/arm/src/cmake/Toolchain.cmake @@ -0,0 +1,217 @@ +# ############################################################################## +# arch/arm/src/cmake/Toolchain.cmake +# +# 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. +# +# ############################################################################## + +# Toolchain + +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_VERSION 1) + +set(ARCH_SUBDIR) + +if(CONFIG_ARCH_ARMV7A) # ARMv7-A + set(ARCH_SUBDIR armv7-a) +elseif(CONFIG_ARCH_ARMV7R) # ARMv7-R + set(ARCH_SUBDIR armv7-r) +elseif(CONFIG_ARCH_ARMV7M) # ARMv7-M + set(ARCH_SUBDIR armv7-m) +elseif(CONFIG_ARCH_ARMV8M) # ARMv8-M + set(ARCH_SUBDIR armv8-m) +elseif(CONFIG_ARCH_ARMV6M) # ARMv6-M + set(ARCH_SUBDIR armv6-m) +else() # ARM9, ARM7TDMI, etc. + set(ARCH_SUBDIR arm) +endif() + +include(${ARCH_SUBDIR}) + +if(CONFIG_ARCH_TOOLCHAIN_CLANG) + set(CMAKE_ASM_COMPILER clang) + set(CMAKE_C_COMPILER clang) + set(CMAKE_CXX_COMPILER clang++) + set(CMAKE_STRIP llvm-strip --strip-unneeded) + set(CMAKE_OBJCOPY llvm-objcopy) + set(CMAKE_OBJDUMP llvm-objdump) + set(CMAKE_LINKER ld.lld) + set(CMAKE_LD ld.lld) + set(CMAKE_AR llvm-ar) + set(CMAKE_NM llvm-nm) + set(CMAKE_RANLIB llvm-ranlib) + + # Since the no_builtin attribute is not fully supported on Clang disable the + # built-in functions, refer: + # https://github.com/apache/incubator-nuttx/pull/5971 + + add_compile_options(-fno-builtin) +else() + set(TOOLCHAIN_PREFIX arm-none-eabi) + set(CMAKE_LIBRARY_ARCHITECTURE ${TOOLCHAIN_PREFIX}) + set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) + set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) + + set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) + set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) + set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) + set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip --strip-unneeded) + set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy) + set(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump) + + if(CONFIG_LTO_FULL AND CONFIG_ARCH_TOOLCHAIN_GNU) + set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-gcc) + set(CMAKE_LD ${TOOLCHAIN_PREFIX}-gcc) + set(CMAKE_AR ${TOOLCHAIN_PREFIX}-gcc-ar) + set(CMAKE_NM ${TOOLCHAIN_PREFIX}-gcc-nm) + set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-gcc-ranlib) + else() + set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld) + set(CMAKE_LD ${TOOLCHAIN_PREFIX}-ld) + set(CMAKE_AR ${TOOLCHAIN_PREFIX}-ar) + set(CMAKE_NM ${TOOLCHAIN_PREFIX}-nm) + set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-ranlib) + endif() +endif() + +# override the ARCHIVE command + +set(CMAKE_C_ARCHIVE_CREATE " rcs -o ") +set(CMAKE_CXX_ARCHIVE_CREATE + " rcs -o ") +set(CMAKE_ASM_ARCHIVE_CREATE + " rcs -o ") + +# Architecture flags + +add_link_options(--entry=__start) +add_link_options(-nostdlib) +add_compile_options(-fno-common) +add_compile_options(-Wall -Wshadow -Wundef) +add_compile_options(-nostdlib) + +if(CONFIG_ARM_THUMB) + add_compile_options(-mthumb) + + # GCC Manual: -mthumb ... If you want to force assembler files to be + # interpreted as Thumb code, either add a `.thumb' directive to the source or + # pass the -mthumb option directly to the assembler by prefixing it with -Wa. + + add_compile_options(-Wa,-mthumb) + + # Outputs an implicit IT block when there is a conditional instruction without + # an enclosing IT block. + + add_compile_options(-Wa,-mimplicit-it=always) +endif() + +if(CONFIG_UNWINDER_ARM) + add_compile_options(-funwind-tables -fasynchronous-unwind-tables) +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_ARCH_COVERAGE) + add_compile_options(-fprofile-generate -ftest-coverage) +endif() + +# Optimization of unused sections + +if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS) + add_link_options(-Wl,--gc-sections) + add_compile_options(-ffunction-sections -fdata-sections) +endif() + +if(CONFIG_ENDIAN_BIG) + add_compile_options(-mbig-endian) +endif() + +# Link Time Optimization + +if(CONFIG_LTO_THIN) + add_compile_options(-flto=thin) +elseif(CONFIG_LTO_FULL) + add_compile_options(-flto) + if(CONFIG_ARCH_TOOLCHAIN_GNU) + add_compile_options(-fno-builtin) + add_compile_options(-fuse-linker-plugin) + endif() +endif() + +# Debug link map + +if(CONFIG_DEBUG_LINK_MAP) + add_link_options(-Wl,--cref -Wl,-Map=nuttx.map) +endif() + +if(CONFIG_DEBUG_SYMBOLS) + add_compile_options(-g) +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() + +if(CONFIG_ARCH_TOOLCHAIN_CLANG) + set(CMAKE_EXE_LINKER_FLAGS_INIT "-c") +else() + set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs") +endif() diff --git a/arch/arm/src/cmake/arm.cmake b/arch/arm/src/cmake/arm.cmake new file mode 100644 index 0000000000..dc8bcae69c --- /dev/null +++ b/arch/arm/src/cmake/arm.cmake @@ -0,0 +1,19 @@ +# ############################################################################## +# arch/arm/src/cmake/arm.cmake +# +# 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. +# +# ############################################################################## diff --git a/arch/arm/src/cmake/armv6-m.cmake b/arch/arm/src/cmake/armv6-m.cmake new file mode 100644 index 0000000000..e748674f2e --- /dev/null +++ b/arch/arm/src/cmake/armv6-m.cmake @@ -0,0 +1,21 @@ +# ############################################################################## +# arch/arm/src/cmake/armv6-m.cmake +# +# 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_compile_options(-mcpu=cortex-m0 -mthumb -mfloat-abi=soft) diff --git a/arch/arm/src/cmake/armv7-a.cmake b/arch/arm/src/cmake/armv7-a.cmake new file mode 100644 index 0000000000..8566b54539 --- /dev/null +++ b/arch/arm/src/cmake/armv7-a.cmake @@ -0,0 +1,68 @@ +# ############################################################################## +# arch/arm/src/cmake/armv7-a.cmake +# +# 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(PLATFORM_FLAGS) + +if(CONFIG_ARCH_CORTEXA5) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-a5) +elseif(CONFIG_ARCH_CORTEXA7) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-a7) +elseif(CONFIG_ARCH_CORTEXA8) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-a8) +elseif(CONFIG_ARCH_CORTEXA9) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-a9) +endif() + +if(NOT CONFIG_ARM_DPFPU32) + set(ARCHFPUD16 -d16) +endif() + +# Cortex-A5 | -mfpu=vfpv4-fp16 | -mfpu=vfpv4-d16-fp16 | -mfpu=neon-fp16 +# Cortex-A7 | -mfpu=vfpv4 | -mfpu=vfpv4-d16 | -mfpu=neon-vfpv4 +# Cortex-A8 | -mfpu=vfpv3 | | -mfpu=neon (alias for +# neon-vfpv3) Cortex-A9 | -mfpu=vfpv3-fp16 | -mfpu=vfpv3-d16-fp16 | +# -mfpu=neon-fp16 Cortex-A15 | -mfpu=vfpv4 | | +# -mfpu=neon-vfpv4 + +if(CONFIG_ARCH_FPU) + if(CONFIG_ARM_FPU_ABI_SOFT) + list(APPEND PLATFORM_FLAGS -mfloat-abi=softfp) + else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=hard) + endif() + + if(CONFIG_ARM_NEON) + set(ARCHNEON neon-) + endif() + if(CONFIG_ARCH_CORTEXA8) + set(ARCHFPU vfpv3) + elseif(CONFIG_ARCH_CORTEXA9) + set(ARCHFPU vfpv3) + else() + set(ARCHFPU vfpv4) + endif() + + list(APPEND PLATFORM_FLAGS -mfpu=${ARCHNEON}${ARCHFPU}${ARCHFPUD16}) + +else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=soft) +endif() + +add_compile_options(${PLATFORM_FLAGS}) diff --git a/arch/arm/src/cmake/armv7-m.cmake b/arch/arm/src/cmake/armv7-m.cmake new file mode 100644 index 0000000000..3d6706fd0a --- /dev/null +++ b/arch/arm/src/cmake/armv7-m.cmake @@ -0,0 +1,93 @@ +# ############################################################################## +# arch/arm/src/cmake/armv7-m.cmake +# +# 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(PLATFORM_FLAGS) + +if(CONFIG_ARCH_CORTEXM4) + list(APPEND PLATFORM_FLAGS -mtune=cortex-m4 -march=armv7e-m) + if(CONFIG_ARCH_FPU) + list(APPEND PLATFORM_FLAGS -mfpu=fpv4-sp-d16) + endif() +elseif(CONFIG_ARCH_CORTEXM7) + list(APPEND PLATFORM_FLAGS -mtune=cortex-m7 -march=armv7e-m) + if(CONFIG_ARCH_FPU) + if(CONFIG_ARCH_DPFPU) + list(APPEND PLATFORM_FLAGS -mfpu=fpv5-d16) + else() + list(APPEND PLATFORM_FLAGS -mfpu=fpv5-sp-d16) + endif() + endif() +else() + list(APPEND PLATFORM_FLAGS -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft) +endif() + +if(CONFIG_ARCH_FPU) + if(CONFIG_ARM_FPU_ABI_SOFT) + list(APPEND PLATFORM_FLAGS -mfloat-abi=softfp) + else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=hard) + endif() +else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=soft) +endif() + +# Clang Configuration files + +if(CONFIG_ARCH_TOOLCHAIN_CLANG) + set(ARCHFLAGS) + + if(CONFIG_ARCH_CORTEXM4) + if(CONFIG_ARCH_FPU) + string(APPEND ARCHFLAGS "--config armv7em_hard_fpv4_sp_d16_nosys") + else() + string(APPEND ARCHFLAGS "--config armv7em_soft_nofp_nosys") + endif() + elseif(CONFIG_ARCH_CORTEXM7) + if(CONFIG_ARCH_FPU) + string(APPEND ARCHFLAGS "--config armv7em_hard_fpv5_d16_nosys") + else() + string(APPEND ARCHFLAGS "--config armv7em_soft_nofp_nosys") + endif() + else() + string(APPEND ARCHFLAGS "--config armv7em_soft_nofp_nosys") + endif() + + if(NOT "${CMAKE_C_FLAGS}" STREQUAL "" AND NOT "${ARCHFLAGS}" STREQUAL "") + string(REGEX MATCH "${ARCHFLAGS}" EXISTS_FLAGS "${CMAKE_C_FLAGS}") + endif() + + if(NOT EXISTS_FLAGS) + set(CMAKE_ASM_FLAGS + "${CMAKE_ASM_FLAGS}${ARCHFLAGS}" + CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS + "${CMAKE_C_FLAGS}${ARCHFLAGS}" + CACHE STRING "" FORCE) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS}${ARCHFLAGS}" + CACHE STRING "" FORCE) + endif() +endif() + +if(CONFIG_ARMV7M_STACKCHECK) + list(APPEND PLATFORM_FLAGS -finstrument-functions -ffixed-r10) +endif() + +add_compile_options(${PLATFORM_FLAGS}) diff --git a/arch/arm/src/cmake/armv7-r.cmake b/arch/arm/src/cmake/armv7-r.cmake new file mode 100644 index 0000000000..cf6a3e8398 --- /dev/null +++ b/arch/arm/src/cmake/armv7-r.cmake @@ -0,0 +1,42 @@ +# ############################################################################## +# arch/arm/src/cmake/armv7-r.cmake +# +# 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(PLATFORM_FLAGS) + +if(CONFIG_ARCH_CORTEXR4) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-r4) +elseif(CONFIG_ARCH_CORTEXR5) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-r5) +elseif(CONFIG_ARCH_CORTEXR7) + list(APPEND PLATFORM_FLAGS -mcpu=cortex-r7) +endif() + +if(CONFIG_ARCH_FPU) + list(APPEND PLATFORM_FLAGS -mfpu=vfpv3-d16) + if(CONFIG_ARM_FPU_ABI_SOFT) + list(APPEND PLATFORM_FLAGS -mfloat-abi=softfp) + else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=hard) + endif() +else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=soft) +endif() + +add_compile_options(${PLATFORM_FLAGS}) diff --git a/arch/arm/src/cmake/armv8-m.cmake b/arch/arm/src/cmake/armv8-m.cmake new file mode 100644 index 0000000000..ce304aeaea --- /dev/null +++ b/arch/arm/src/cmake/armv8-m.cmake @@ -0,0 +1,62 @@ +# ############################################################################## +# arch/arm/src/cmake/armv8-m.cmake +# +# 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(PLATFORM_FLAGS) + +if(CONFIG_ARCH_CORTEXM23) + list(APPEND PLATFORM_FLAGS -mtune=cortex-m23 -march=armv8-m.main + -mfloat-abi=soft) +elseif(CONFIG_ARCH_CORTEXM33) + list(APPEND PLATFORM_FLAGS -mtune=cortex-m33 -march=armv8-m.main+dsp) + if(CONFIG_ARCH_FPU) + list(APPEND PLATFORM_FLAGS -mfpu=fpv5-sp-d16) + endif() +elseif(CONFIG_ARCH_CORTEXM35P) + list(APPEND PLATFORM_FLAGS -mtune=cortex-m35p -march=armv8-m.main+dsp) + if(CONFIG_ARCH_FPU) + list(APPEND PLATFORM_FLAGS -mfpu=fpv5-sp-d16) + endif() +elseif(CONFIG_ARCH_CORTEXM55) + list(APPEND PLATFORM_FLAGS -mtune=cortex-m55) + if(CONFIG_ARM_HAVE_MVE) + list(APPEND PLATFORM_FLAGS -march=armv8.1-m.main+mve.fp+fp.dp) + else() + list(APPEND PLATFORM_FLAGS -march=armv8.1-m.main+dsp) + endif() + if(CONFIG_ARCH_FPU) + list(APPEND PLATFORM_FLAGS -mfpu=fpv5-d16) + endif() +endif() + +if(CONFIG_ARCH_FPU) + if(CONFIG_ARM_FPU_ABI_SOFT) + list(APPEND PLATFORM_FLAGS -mfloat-abi=softfp) + else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=hard) + endif() +else() + list(APPEND PLATFORM_FLAGS -mfloat-abi=soft) +endif() + +if(CONFIG_ARMV8M_STACKCHECK) + list(APPEND PLATFORM_FLAGS -finstrument-functions -ffixed-r10) +endif() + +add_compile_options(${PLATFORM_FLAGS}) diff --git a/arch/arm/src/cmake/platform.cmake b/arch/arm/src/cmake/platform.cmake new file mode 100644 index 0000000000..a4261f6b20 --- /dev/null +++ b/arch/arm/src/cmake/platform.cmake @@ -0,0 +1,103 @@ +# ############################################################################## +# ./arch/arm/src/cmake/platform.cmake +# +# 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. +# +# ############################################################################## + +# configure target processor + +if(CONFIG_ARCH_CORTEXM0) + set(CMAKE_SYSTEM_PROCESSOR cortex-m0) +elseif(CONFIG_ARCH_CORTEXM3) + set(CMAKE_SYSTEM_PROCESSOR cortex-m3) +elseif(CONFIG_ARCH_CORTEXM4) + set(CMAKE_SYSTEM_PROCESSOR cortex-m4) +elseif(CONFIG_ARCH_CORTEXM7) + set(CMAKE_SYSTEM_PROCESSOR cortex-m7) +elseif(CONFIG_ARCH_CORTEXM23) + set(CMAKE_SYSTEM_PROCESSOR cortex-m23) +elseif(CONFIG_ARCH_CORTEXM33) + set(CMAKE_SYSTEM_PROCESSOR cortex-m33) +elseif(CONFIG_ARCH_CORTEXM35P) + set(CMAKE_SYSTEM_PROCESSOR cortex-m35p) +elseif(CONFIG_ARCH_CORTEXM55) + set(CMAKE_SYSTEM_PROCESSOR cortex-m55) +elseif(CONFIG_ARCH_CORTEXA5) + set(CMAKE_SYSTEM_PROCESSOR cortex-a5) +elseif(CONFIG_ARCH_CORTEXA7) + set(CMAKE_SYSTEM_PROCESSOR cortex-a7) +elseif(CONFIG_ARCH_CORTEXA8) + set(CMAKE_SYSTEM_PROCESSOR cortex-a8) +elseif(CONFIG_ARCH_CORTEXA9) + set(CMAKE_SYSTEM_PROCESSOR cortex-a9) +elseif(CONFIG_ARCH_CORTEXR4) + set(CMAKE_SYSTEM_PROCESSOR cortex-r4) +elseif(CONFIG_ARCH_CORTEXR5) + set(CMAKE_SYSTEM_PROCESSOR cortex-r5) +elseif(CONFIG_ARCH_CORTEXR7) + set(CMAKE_SYSTEM_PROCESSOR cortex-r7) +else() + message(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR not set") +endif() + +get_directory_property(NUTTX_EXTRA_FLAGS DIRECTORY ${CMAKE_SOURCE_DIR} + COMPILE_OPTIONS) + +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS} + --print-libgcc-file-name + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) +if(NOT EXISTS ${extra_library} AND CONFIG_ARCH_TOOLCHAIN_CLANG) + get_filename_component(COMPILER_RT_LIB ${extra_library} NAME) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name ${COMPILER_RT_LIB} + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) +endif() + +list(APPEND EXTRA_LIB ${extra_library}) + +if(NOT CONFIG_LIBM) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=libm.a + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) + list(APPEND EXTRA_LIB ${extra_library}) +endif() + +if(CONFIG_LIBSUPCXX) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=libsupc++.a + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) + list(APPEND EXTRA_LIB ${extra_library}) +endif() + +if(CONFIG_ARCH_COVERAGE) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=libgcov.a + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_library) + list(APPEND EXTRA_LIB ${extra_library}) +endif() + +set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES ${EXTRA_LIB}) diff --git a/arch/arm/src/common/CMakeLists.txt b/arch/arm/src/common/CMakeLists.txt new file mode 100644 index 0000000000..609b1a82d6 --- /dev/null +++ b/arch/arm/src/common/CMakeLists.txt @@ -0,0 +1,98 @@ +# ############################################################################## +# arch/arm/src/common/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. +# +# ############################################################################## + +if(CONFIG_ARCH_TOOLCHAIN_IAR) + set(ARCH_TOOLCHAIN_PATH iar) +else() + set(ARCH_TOOLCHAIN_PATH gnu) +endif() + +set(SRCS + arm_allocateheap.c + arm_createstack.c + arm_exit.c + arm_getintstack.c + arm_initialize.c + arm_lowputs.c + arm_modifyreg8.c + arm_modifyreg16.c + arm_modifyreg32.c + arm_nputs.c + arm_releasestack.c + arm_registerdump.c + arm_stackframe.c + arm_switchcontext.c + arm_usestack.c + arm_vfork.c + ${ARCH_TOOLCHAIN_PATH}/vfork.S) + +if(NOT CONFIG_ALARM_ARCH AND NOT CONFIG_TIMER_ARCH) + list(APPEND SRCS arm_mdelay.c arm_udelay.c) +endif() + +if(CONFIG_STACK_COLORATION) + list(APPEND SRCS arm_checkstack.c) +endif() + +if(NOT CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS arm_idle.c) +endif() + +if(CONFIG_BUILD_PROTECTED OR CONFIG_BUILD_KERNEL) + list(APPEND SRCS arm_task_start.c arm_pthread_start.c arm_signal_dispatch.c) + + if(CONFIG_BUILD_PROTECTED) + list(APPEND SRCS ${ARCH_TOOLCHAIN_PATH}/arm_signal_handler.S) + endif() +endif() + +if(CONFIG_ARM_SEMIHOSTING_SYSLOG) + list(APPEND SRCS arm_semi_syslog.c) +endif() + +if(CONFIG_ARM_SEMIHOSTING_HOSTFS) + list(APPEND SRCS arm_hostfs.c) +endif() + +if(CONFIG_SCHED_THREAD_LOCAL) + list(APPEND SRCS arm_tls.c) +endif() + +if(CONFIG_UNWINDER_FRAME_POINTER) + list(APPEND SRCS arm_backtrace_fp.c) +endif() + +if(CONFIG_UNWINDER_STACK_POINTER) + list(APPEND SRCS arm_backtrace_sp.c) +endif() + +if(CONFIG_UNWINDER_ARM) + list(APPEND SRCS arm_backtrace_unwind.c) +endif() + +if(CONFIG_ARCH_HAVE_TESTSET AND NOT CONFIG_ARCH_ARMV6M) + list(APPEND SRCS ${ARCH_TOOLCHAIN_PATH}/arm_testset.S) +endif() + +if(CONFIG_ARCH_HAVE_FETCHADD) + list(APPEND SRCS ${ARCH_TOOLCHAIN_PATH}/arm_fetchadd.S) +endif() + +target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/cxd56xx/CMakeLists.txt b/arch/arm/src/cxd56xx/CMakeLists.txt new file mode 100644 index 0000000000..c89be14549 --- /dev/null +++ b/arch/arm/src/cxd56xx/CMakeLists.txt @@ -0,0 +1,166 @@ +# ############################################################################## +# arch/arm/src/cxd56xx/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 + cxd56_farapistub.S + cxd56_allocateheap.c + cxd56_idle.c + cxd56_uid.c + cxd56_serial.c + cxd56_uart.c + cxd56_irq.c + cxd56_start.c + cxd56_timerisr.c + cxd56_pinconfig.c + cxd56_clock.c + cxd56_delay.c + cxd56_gpio.c + cxd56_pmic.c + cxd56_cpufifo.c + cxd56_icc.c + cxd56_powermgr.c + cxd56_farapi.c + cxd56_sysctl.c) + +if(CONFIG_SMP) + list(APPEND SRCS cxd56_cpuidlestack.c) + list(APPEND SRCS cxd56_cpuindex.c) + list(APPEND SRCS cxd56_cpupause.c) + list(APPEND SRCS cxd56_cpustart.c) + if(CONFIG_CXD56_TESTSET) + list(APPEND SRCS cxd56_testset.c) + endif() +endif() + +if(CONFIG_ARCH_USE_TEXT_HEAP) + list(APPEND SRCS cxd56_textheap.c) +endif() + +if(CONFIG_CXD56_UART0) + list(APPEND SRCS cxd56_uart0.c) +endif() + +if(CONFIG_CXD56_PM_PROCFS) + list(APPEND SRCS cxd56_powermgr_procfs.c) +endif() + +if(CONFIG_CXD56_RTC) + list(APPEND SRCS cxd56_rtc.c) + if(CONFIG_RTC_DRIVER) + list(APPEND SRCS cxd56_rtc_lowerhalf.c) + endif() +endif() + +if(CONFIG_CXD56_GPIO_IRQ) + list(APPEND SRCS cxd56_gpioint.c) +endif() + +if(CONFIG_USBDEV) + list(APPEND SRCS cxd56_usbdev.c) +endif() + +if(CONFIG_CXD56_SDIO) + list(APPEND SRCS cxd56_sdhci.c) +endif() + +if(CONFIG_CXD56_SFC) + list(APPEND SRCS cxd56_sfc.c) +endif() + +if(CONFIG_CXD56_SPH) + list(APPEND SRCS cxd56_sph.c) +endif() + +if(CONFIG_CXD56_EMMC) + list(APPEND SRCS cxd56_emmc.c) +endif() + +if(CONFIG_CXD56_SPI) + list(APPEND SRCS cxd56_spi.c) +endif() + +if(CONFIG_CXD56_I2C) + list(APPEND SRCS cxd56_i2c.c) +endif() + +if(CONFIG_I2C_BITBANG) + list(APPEND SRCS cxd56_i2c_bitbang.c) +endif() + +if(CONFIG_CXD56_DMAC) + list(APPEND SRCS cxd56_dmac.c) +endif() + +if(CONFIG_CXD56_PWM) + list(APPEND SRCS cxd56_pwm.c) +endif() + +if(CONFIG_CXD56_GAUGE) + list(APPEND SRCS cxd56_gauge.c) +endif() + +if(CONFIG_CXD56_CHARGER) + list(APPEND SRCS cxd56_charger.c) +endif() + +if(CONFIG_CXD56_GE2D) + list(APPEND SRCS cxd56_ge2d.c) +endif() + +if(CONFIG_CXD56_CISIF) + list(APPEND SRCS cxd56_cisif.c) +endif() + +if(CONFIG_CXD56_SCU) + list(APPEND SRCS cxd56_scu.c cxd56_scufifo.c) + if(CONFIG_CXD56_ADC) + list(APPEND SRCS cxd56_adc.c) + endif() + if(CONFIG_CXD56_UDMAC) + list(APPEND SRCS cxd56_udmac.c) + endif() +endif() + +if(CONFIG_CXD56_TIMER) + list(APPEND SRCS cxd56_timer.c) +endif() + +if(CONFIG_CXD56_WDT) + list(APPEND SRCS cxd56_wdt.c) +endif() + +if(CONFIG_CXD56_GNSS) + list(APPEND SRCS cxd56_gnss.c) + list(APPEND SRCS cxd56_cpu1signal.c) +endif() + +if(CONFIG_CXD56_GEOFENCE) + list(APPEND SRCS cxd56_geofence.c) +endif() + +if(CONFIG_CXD56_BACKUPLOG) + list(APPEND SRCS cxd56_backuplog.c) +endif() + +if(CONFIG_CXD56_HOSTIF) + list(APPEND SRCS cxd56_hostif.c) +endif() + +target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/imx6/CMakeLists.txt b/arch/arm/src/imx6/CMakeLists.txt new file mode 100644 index 0000000000..d1730f478d --- /dev/null +++ b/arch/arm/src/imx6/CMakeLists.txt @@ -0,0 +1,49 @@ +# ############################################################################## +# arch/arm/src/imx6/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 + imx_boot.c + imx_memorymap.c + imx_clockconfig.c + imx_irq.c + imx_timerisr.c + imx_gpio.c + imx_iomuxc.c + imx_serial.c + imx_lowputc.c + imx_idle.c) + +if(CONFIG_SMP) + list(APPEND SRCS imx_cpuboot.c) +endif() + +if(CONFIG_IMX6_ECSPI) + list(APPEND SRCS imx_ecspi.c) +endif() + +if(CONFIG_IMX6_ENET) + list(APPEND SRCS imx_enet.c) +endif() + +if(CONFIG_MM_PGALLOC) + list(APPEND SRCS imx_pgalloc.c) +endif() + +target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/stm32/CMakeLists.txt b/arch/arm/src/stm32/CMakeLists.txt new file mode 100644 index 0000000000..e8df2ef253 --- /dev/null +++ b/arch/arm/src/stm32/CMakeLists.txt @@ -0,0 +1,233 @@ +# ############################################################################## +# arch/arm/src/stm32/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) + +list( + APPEND + SRCS + stm32_allocateheap.c + stm32_start.c + stm32_rcc.c + stm32_lse.c + stm32_lsi.c + stm32_gpio.c + stm32_exti_gpio.c + stm32_flash.c + stm32_irq.c + stm32_dma.c + stm32_lowputc.c + stm32_serial.c + stm32_spi.c + stm32_i2s.c + stm32_sdio.c + stm32_tim.c + stm32_waste.c + stm32_ccm.c + stm32_uid.c + stm32_capture.c + stm32_dfumode.c) + +if(CONFIG_TIMER) + list(APPEND SRCS stm32_tim_lowerhalf.c) +endif() + +if(CONFIG_STM32_TICKLESS_TIMER) + list(APPEND SRCS stm32_tickless.c) +else() + list(APPEND SRCS stm32_timerisr.c) +endif() + +if(CONFIG_STM32_ONESHOT) + list(APPEND SRCS stm32_oneshot.c stm32_oneshot_lowerhalf.c) +endif() + +if(CONFIG_STM32_FREERUN) + list(APPEND SRCS stm32_freerun.c) +endif() + +if(CONFIG_BUILD_PROTECTED) + list(APPEND SRCS stm32_userspace.c stm32_mpuinit.c) +endif() + +if(CONFIG_STM32_CCM_PROCFS) + list(APPEND SRCS stm32_procfs_ccm.c) +endif() + +if(CONFIG_STM32_HAVE_IP_I2C_V1) + if(CONFIG_STM32_I2C_ALT) + list(APPEND SRCS stm32_i2c_alt.c) + elseif(CONFIG_STM32_STM32F4XXX) + list(APPEND SRCS stm32f40xxx_i2c.c) + else() + list(APPEND SRCS stm32_i2c.c) + endif() +elseif(CONFIG_STM32_HAVE_IP_I2C_V2) + list(APPEND SRCS stm32_i2c_v2.c) +endif() + +if(CONFIG_USBDEV) + if(CONFIG_STM32_USB) + list(APPEND SRCS stm32_usbdev.c) + endif() + if(CONFIG_STM32_OTGFS) + list(APPEND SRCS stm32_otgfsdev.c) + endif() + if(CONFIG_STM32_OTGHS) + list(APPEND SRCS stm32_otghsdev.c) + endif() +endif() + +if(CONFIG_STM32_USBHOST) + if(CONFIG_STM32_OTGFS) + list(APPEND SRCS stm32_otgfshost.c) + endif() + if(CONFIG_STM32_OTGHS) + list(APPEND SRCS stm32_otghshost.c) + endif() + if(CONFIG_USBHOST_TRACE) + list(APPEND SRCS stm32_usbhost.c) + else() + if(CONFIG_DEBUG_USB) + list(APPEND SRCS stm32_usbhost.c) + endif() + endif() +endif() + +if(NOT CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS stm32_idle.c) +endif() + +list(APPEND SRCS stm32_pmstop.c stm32_pmstandby.c stm32_pmsleep.c) + +if(NOT CONFIG_ARCH_CUSTOM_PMINIT) + list(APPEND SRCS stm32_pminitialize.c) +endif() + +if(CONFIG_STM32_ETHMAC) + list(APPEND SRCS stm32_eth.c) +endif() + +if(CONFIG_STM32_PWR) + list(APPEND SRCS stm32_pwr.c stm32_exti_pwr.c) +endif() + +if(CONFIG_STM32_RTC) + list(APPEND SRCS stm32_rtc.c) + if(CONFIG_RTC_ALARM) + list(APPEND SRCS stm32_exti_alarm.c) + endif() + if(CONFIG_RTC_PERIODIC) + list(APPEND SRCS stm32_exti_wakeup.c) + endif() + if(CONFIG_RTC_DRIVER) + list(APPEND SRCS stm32_rtc_lowerhalf.c) + endif() +endif() + +if(CONFIG_STM32_ADC) + list(APPEND SRCS stm32_adc.c) +endif() + +if(CONFIG_STM32_SDADC) + list(APPEND SRCS stm32_sdadc.c) +endif() + +if(CONFIG_STM32_DAC) + list(APPEND SRCS stm32_dac.c) +endif() + +if(CONFIG_STM32_COMP) + list(APPEND SRCS stm32_comp.c) +endif() + +if(CONFIG_STM32_OPAMP) + list(APPEND SRCS stm32_opamp.c) +endif() + +if(CONFIG_STM32_HRTIM) + list(APPEND SRCS stm32_hrtim.c) +endif() + +if(CONFIG_STM32_1WIREDRIVER) + list(APPEND SRCS stm32_1wire.c) +endif() + +if(CONFIG_STM32_HCIUART) + list(APPEND SRCS stm32_hciuart.c) +endif() + +if(CONFIG_STM32_RNG) + list(APPEND SRCS stm32_rng.c) +endif() + +if(CONFIG_STM32_LTDC) + list(APPEND SRCS stm32_ltdc.c) +endif() + +if(CONFIG_STM32_DMA2D) + list(APPEND SRCS stm32_dma2d.c) +endif() + +if(CONFIG_STM32_PWM) + list(APPEND SRCS stm32_pwm.c) +endif() + +if(CONFIG_SENSORS_QENCODER) + list(APPEND SRCS stm32_qencoder.c) +endif() + +if(CONFIG_STM32_CAN) + list(APPEND SRCS stm32_can.c) +endif() + +if(CONFIG_STM32_IWDG) + list(APPEND SRCS stm32_iwdg.c) +endif() + +if(CONFIG_STM32_WWDG) + list(APPEND SRCS stm32_wwdg.c) +endif() + +if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS stm32_dumpgpio.c) +endif() + +if(CONFIG_STM32_AES) + list(APPEND SRCS stm32_aes.c) +endif() + +if(CONFIG_STM32_BBSRAM) + list(APPEND SRCS stm32_bbsram.c) +endif() + +if(CONFIG_STM32_FMC) + list(APPEND SRCS stm32_fmc.c) +endif() + +if(CONFIG_STM32_FSMC) + list(APPEND SRCS stm32_fsmc.c) +endif() + +if(CONFIG_STM32_FOC) + list(APPEND SRCS stm32_foc.c) +endif() + +target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/stm32u5/CMakeLists.txt b/arch/arm/src/stm32u5/CMakeLists.txt new file mode 100644 index 0000000000..d034144d89 --- /dev/null +++ b/arch/arm/src/stm32u5/CMakeLists.txt @@ -0,0 +1,60 @@ +# ############################################################################## +# arch/arm/src/stm32u5/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 + stm32_allocateheap.c + stm32_exti_gpio.c + stm32_gpio.c + stm32_irq.c + stm32_lowputc.c + stm32_rcc.c + stm32_serial.c + stm32_start.c + stm32_waste.c + stm32_uid.c + stm32_spi.c + stm32_lse.c + stm32_lsi.c + stm32_pwr.c + stm32_tim.c + stm32_flash.c + stm32_timerisr.c) + +if(NOT CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS stm32_idle.c) +endif() + +if(CONFIG_TIMER) + list(APPEND SRCS stm32_tim_lowerhalf.c) +endif() + +if(CONFIG_BUILD_PROTECTED) + list(APPEND SRCS stm32_userspace.c stm32_mpuinit.c) +endif() + +if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS stm32_dumpgpio.c) +endif() + +if(CONFIG_STM32U5_STM32U585XX) + list(APPEND SRCS stm32u585xx_rcc.c) +endif() + +target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/tiva/CMakeLists.txt b/arch/arm/src/tiva/CMakeLists.txt new file mode 100644 index 0000000000..9bc18f4949 --- /dev/null +++ b/arch/arm/src/tiva/CMakeLists.txt @@ -0,0 +1,140 @@ +# ############################################################################## +# arch/arm/src/tiva/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. +# +# ############################################################################## + +if(CONFIG_ARCH_CHIP_LM) + set(ARCH_CHIP lm) +elseif(CONFIG_ARCH_CHIP_TM4C) + set(ARCH_CHIP tm4c) +elseif(CONFIG_ARCH_CHIP_CC13X0) + set(ARCH_CHIP cc13xx) +elseif(CONFIG_ARCH_CHIP_CC13X2) + set(ARCH_CHIP cc13xx) +endif() + +set(SRCS) + +if(NOT CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS tiva_idle.c) +endif() + +list(APPEND SRCS tiva_allocateheap.c tiva_irq.c tiva_lowputc.c tiva_serial.c) +list(APPEND SRCS tiva_ssi.c) + +if(CONFIG_ARCH_CHIP_LM3S) + list(APPEND SRCS lmxx_tm4c_start.c lm3s_gpio.c lmxx_tm4c_gpioirq.c) + list(APPEND SRCS lm4xx_tm3c_sysctrl.c) +elseif(CONFIG_ARCH_CHIP_LM4F) + list(APPEND SRCS lmxx_tm4c_start.c lm4f_gpio.c lmxx_tm4c_gpioirq.c) + list(APPEND SRCS lm4xx_tm3c_sysctrl.c) +elseif(CONFIG_ARCH_CHIP_TM4C) + list(APPEND SRCS lmxx_tm4c_start.c tm4c_gpio.c lmxx_tm4c_gpioirq.c) + if(CONFIG_ARCH_CHIP_TM4C129) + list(APPEND SRCS tm4c129_sysctrl.c) + else() + list(APPEND SRCS lm4xx_tm3c_sysctrl.c) + endif() + +elseif(CONFIG_ARCH_CHIP_CC13X0) + list(APPEND SRCS cc13xx_start.c cc13xx_prcm.c cc13xx_chipinfo.c cc13xx_gpio.c) + list(APPEND SRCS cc13xx_gpioirq.c cc13xx_enableclks.c cc13xx_enablepwr.c) + list(APPEND SRCS cc13x0_trim.c cc13x0_rom.c) +elseif(CONFIG_ARCH_CHIP_CC13X2) + list(APPEND SRCS cc13xx_start.c cc13xx_prcm.c cc13xx_chipinfo.c cc13xx_gpio.c) + list(APPEND SRCS cc13xx_gpioirq.c cc13xx_enableclks.c cc13xx_enablepwr.c) + list(APPEND SRCS cc13x2_aux_sysif.c) + if(CONFIG_ARCH_CHIP_CC13XX_V1) + list(APPEND SRCS cc13x2_v1_trim.c cc13x2_cc26x2_v1_rom.c) + else() + list(APPEND SRCS cc13x2_v2_trim.c) + endif() +endif() + +if(CONFIG_DEBUG_GPIO_INFO) + list(APPEND SRCS tiva_dumpgpio.c) +endif() + +if(NOT CONFIG_SCHED_TICKLESS) + list(APPEND SRCS tiva_timerisr.c) +endif() + +if(CONFIG_BUILD_PROTECTED) + list(APPEND SRCS tiva_userspace.c tiva_mpuinit.c) +endif() + +if(CONFIG_TIVA_I2C) + list(APPEND SRCS tiva_i2c.c) +endif() + +if(CONFIG_TIVA_PWM) + list(APPEND SRCS tiva_pwm.c) +endif() + +if(CONFIG_TIVA_QEI) + list(APPEND SRCS tiva_qencoder.c) +endif() + +if(CONFIG_TIVA_TIMER) + list(APPEND SRCS tiva_timerlib.c) + if(CONFIG_TIVA_TIMER32_PERIODIC) + list(APPEND SRCS tiva_timerlow32.c) + endif() +endif() + +if(CONFIG_TIVA_ADC) + list(APPEND SRCS tiva_adclow.c) + list(APPEND SRCS tiva_adclib.c) +endif() + +if(CONFIG_TIVA_CAN) + list(APPEND SRCS tiva_can.c) +endif() + +if(CONFIG_TIVA_ETHERNET) + if(CONFIG_ARCH_CHIP_LM3S) + list(APPEND SRCS lm3s_ethernet.c) + endif() + if(CONFIG_ARCH_CHIP_TM4C) + list(APPEND SRCS tm4c_ethernet.c) + endif() +endif() + +if(CONFIG_TIVA_FLASH) + list(APPEND SRCS tiva_flash.c) +endif() + +if(CONFIG_TIVA_EEPROM) + list(APPEND SRCS tiva_eeprom.c) +endif() + +if(CONFIG_TIVA_HCIUART) + list(APPEND SRCS tiva_hciuart.c) +endif() + +set(COMMON_SRCS) + +foreach(src ${SRCS}) + if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/common/${src}) + list(APPEND COMMON_SRCS common/${src}) + else() + list(APPEND COMMON_SRCS ${ARCH_CHIP}/${src}) + endif() +endforeach() + +target_sources(arch PRIVATE ${COMMON_SRCS}) diff --git a/arch/sim/CMakeLists.txt b/arch/sim/CMakeLists.txt new file mode 100644 index 0000000000..8aa73382d7 --- /dev/null +++ b/arch/sim/CMakeLists.txt @@ -0,0 +1,196 @@ +# ############################################################################## +# arch/sim/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_directories(include) +add_subdirectory(src) + +# configure host binary ###################################################### + +target_include_directories(nuttx PRIVATE ${CONFIG_ARCH_CHIP}) + +target_compile_definitions(nuttx + PRIVATE CONFIG_USEC_PER_TICK=${CONFIG_USEC_PER_TICK}) + +if(APPLE) + target_compile_options(nuttx PRIVATE -Wno-deprecated-declarations) +endif() + +# configure simulated nuttx ################################################## + +if(NOT WIN32) + # Add -fvisibility=hidden Because we don't want export nuttx's symbols to + # shared libraries + + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS -fvisibility=hidden) + + # Add -fno-common because macOS "ld -r" doesn't seem to pick objects for + # common symbols. + + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS -fno-common) +endif() + +if(CONFIG_SIM_SANITIZE) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS -fsanitize=address -fsanitize=undefined + -fno-omit-frame-pointer) +endif() + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS + # NuttX is sometimes built as a native target. In that case, the + # __NuttX__ macro is predefined by the compiler. + # https://github.com/NuttX/buildroot + # + # In other cases, __NuttX__ is an ordinary user-definded macro. It's + # especially the case for NuttX sim, which is a target to run the + # entire NuttX as a program on the host OS, which can be Linux, + # macOS, Windows, etc. + # https://cwiki.apache.org/confluence/display/NUTTX/NuttX+Simulation + # In that case, the host OS compiler is used to build NuttX. Thus, + # eg. NuttX sim on macOS is built with __APPLE__. We #undef + # predefined macros for those possible host OSes here because the OS + # APIs this library should use are of NuttX, not the host OS. + -U_AIX + -U_WIN32 + -U__APPLE__ + -U__FreeBSD__ + -U__NetBSD__ + -U__linux__ + -U__sun__ + -U__unix__ + -U__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) + +# common options ############################################################# + +if(X86_64 AND CONFIG_SIM_M32) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS -m32) + target_compile_options(nuttx PRIVATE -m32) + target_link_options(nuttx PRIVATE -m32) +endif() + +if(CONFIG_LIBCXX) + if(APPLE) + # macOS uses libc++abi + + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_DEFINITIONS LIBCXX_BUILDING_LIBCXXABI) + else() + # Linux C++ ABI seems vary. Probably __GLIBCXX__ is the best bet. XXX what + # to do for windows? + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_DEFINITIONS __GLIBCXX__) + endif() + + # Disable availability macros. The availability on Host OS is not likely + # appropriate for NuttX. + # + # Note: When compiling NuttX apps, we undefine __APPLE__. It makes libcxx + # __availability header unhappy. + # https://github.com/llvm/llvm-project/blob/2e2999cd44f6ec9a5e396fa0113497ea82582f69/libcxx/include/__availability#L258 + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_DEFINITIONS _LIBCPP_DISABLE_AVAILABILITY) +endif() + +# This is part of the top-level export target TODO: how to deal with in CMake? + +# export_startup: board/libboard$(LIBEXT) up_head.o $(HOSTOBJS) nuttx-names.dat +# cp up_head.o $(HOSTOBJS) ${EXPORT_DIR}/startup cp nuttx-names.dat +# ${EXPORT_DIR}/libs echo main NXmain >> ${EXPORT_DIR}/libs/nuttx-names.dat + +# Loadable module definitions TODO: implement modules with CMake + +# -fno-pic to avoid GOT relocations +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_COMPILE_OPTIONS -fno-pic) +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_LINK_OPTIONS -r -e module_initialize -T + ${NUTTX_DIR}/libs/libc/modlib/gnu-elf.ld) + +if(CONFIG_LIBC_ARCH_ELF_64BIT) + # For amd64: It seems macOS/x86_64 loads the program text around + # 00000001_xxxxxxxx. The gcc default (-mcmodel=small) would produce + # out-of-range 32-bit relocations. Even on Linux, NuttX modules are loaded + # into the NuttX heap, which can be out of range with -mcmodel=small. + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_COMPILE_OPTIONS -mcmodel=large) +endif() + +# On Linux, we (ab)use the host compiler to compile binaries for NuttX. +# Explicitly disable features which might be default on the host while not +# available on NuttX. +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_COMPILE_OPTIONS -fno-stack-protector) + +# TODO: move to toolchain file NuttX modules are ELF binaries. Non-ELF platforms +# like macOS need to use a separate ELF toolchain. ifeq ($(CONFIG_HOST_MACOS),y) +# # eg. brew install x86_64-elf-gcc MODULECC = x86_64-elf-gcc MODULELD = +# x86_64-elf-ld MODULESTRIP = x86_64-elf-strip --strip-unneeded endif + +# ELF module definitions + +# -fno-pic to avoid GOT relocations +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_APP_COMPILE_OPTIONS -fno-pic) +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_APP_LINK_OPTIONS -r -e main + -T${BOARD_PATH}/scripts/gnu-elf.ld) + +# TODO: move to toolchain file +if(X86_64 AND CONFIG_SIM_M32) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_LINK_OPTIONS -m32) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_APP_LINK_OPTIONS -m32) +endif() diff --git a/arch/sim/src/CMakeLists.txt b/arch/sim/src/CMakeLists.txt new file mode 100644 index 0000000000..fdafd1b89a --- /dev/null +++ b/arch/sim/src/CMakeLists.txt @@ -0,0 +1,30 @@ +# ############################################################################## +# arch/sim/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(${CONFIG_ARCH_CHIP}) + +# Include directories (before system ones) as PUBLIC so that it can be exposed +# to libboard +target_include_directories(arch BEFORE PUBLIC ${CONFIG_ARCH_CHIP} common) + +if(NOT CONFIG_BUILD_FLAT) + target_include_directories(arch_interface BEFORE PUBLIC ${CONFIG_ARCH_CHIP} + common) +endif() diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake new file mode 100644 index 0000000000..b0e228a357 --- /dev/null +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -0,0 +1,24 @@ +# ############################################################################## +# arch/sim/cmake/Toolchain.cmake +# +# 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. +# +# ############################################################################## + +if(APPLE) + find_program(CMAKE_C_ELF_COMPILER x86_64-elf-gcc) + find_program(CMAKE_CXX_ELF_COMPILER x86_64-elf-g++) +endif() diff --git a/arch/sim/src/cmake/platform.cmake b/arch/sim/src/cmake/platform.cmake new file mode 100644 index 0000000000..b2765ef31a --- /dev/null +++ b/arch/sim/src/cmake/platform.cmake @@ -0,0 +1,19 @@ +# ############################################################################## +# arch/sim/src/cmake/platform.cmake +# +# 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. +# +# ############################################################################## diff --git a/arch/sim/src/sim/CMakeLists.txt b/arch/sim/src/sim/CMakeLists.txt new file mode 100644 index 0000000000..52427a0140 --- /dev/null +++ b/arch/sim/src/sim/CMakeLists.txt @@ -0,0 +1,228 @@ +# ############################################################################## +# arch/sim/src/sim/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. +# +# ############################################################################## + +# Initialize empty variables to hold internal (emulated guest) and external +# (host) source files + +set(SRCS) +set(HOSTSRCS) + +set(HOST_INCLUDE_DIRS) +set(STDLIBS pthread) + +list(APPEND HOST_DEFINITIONS -D__SIM__) + +# common guest sources + +list( + APPEND + SRCS + sim_initialize.c + sim_idle.c + sim_doirq.c + sim_initialstate.c + sim_createstack.c + sim_usestack.c + sim_releasestack.c + sim_stackframe.c + sim_exit.c + sim_schedulesigaction.c + sim_switchcontext.c + sim_heap.c + sim_uart.c + sim_copyfullstate.c + sim_sigdeliver.c + sim_registerdump.c + sim_saveusercontext.c + sim_textheap.c) + +if(CONFIG_HOST_X86_64) + if(CONFIG_SIM_M32) + list(APPEND SRCS sim_vfork_x86.S) + else() + list(APPEND SRCS sim_vfork_x86_64.S) + endif() +elseif(CONFIG_HOST_X86) + list(APPEND SRCS sim_vfork_x86.S) +elseif(CONFIG_HOST_ARM) + list(APPEND SRCS sim_vfork_arm.S) +elseif(CONFIG_HOST_ARM64) + list(APPEND SRCS sim_vfork_arm64.S) +endif() + +if(CONFIG_SCHED_BACKTRACE) + list(APPEND SRCS sim_backtrace.c) +endif() + +if(CONFIG_ARCH_HAVE_VFORK AND CONFIG_SCHED_WAITPID) + list(APPEND SRCS sim_vfork.c) +endif() + +if(CONFIG_ONESHOT) + list(APPEND SRCS sim_oneshot.c) +endif() + +if(CONFIG_RTC_DRIVER) + list(APPEND SRCS sim_rtc.c) +endif() + +if(CONFIG_SIM_LCDDRIVER) + list(APPEND SRCS sim_lcd.c) +elseif(CONFIG_SIM_FRAMEBUFFER) + list(APPEND SRCS sim_framebuffer.c) +endif() + +if(CONFIG_STACK_COLORATION) + list(APPEND SRCS sim_checkstack.c) +endif() + +if(CONFIG_FS_FAT) + list(APPEND SRCS sim_blockdevice.c sim_deviceimage.c) + list(APPEND STDLIBS z) +endif() + +if(APPLE) + if(NOT CONFIG_LIBCXX) + list(APPEND STDLIBS c++abi) + endif() +else() + list(APPEND STDLIBS rt) +endif() + +if(CONFIG_RPTUN) + list(APPEND SRCS sim_rptun.c) +endif() + +if(CONFIG_SIM_SOUND_ALSA) + list(APPEND SRCS sim_alsa.c) + list(APPEND STDLIBS asound) + list(APPEND STDLIBS mad) +endif() + +# host sources ############################################################### + +list( + APPEND + HOSTSRCS + sim_hostirq.c + sim_hostmemory.c + sim_hostmisc.c + sim_hosttime.c + sim_hostuart.c) + +if(CONFIG_SPINLOCK) + list(APPEND HOSTSRCS sim_testset.c) +endif() + +if(CONFIG_SMP) + list(APPEND SRCS sim_smpsignal.c sim_cpuidlestack.c) + list(APPEND HOSTSRCS sim_hostsmp.c) +endif() + +if(CONFIG_SIM_X11FB) + list(APPEND HOSTSRCS sim_x11framebuffer.c) + list(APPEND STDLIBS X11 Xext) + + if(CONFIG_SIM_TOUCHSCREEN) + list(APPEND SRCS sim_touchscreen.c) + list(APPEND HOSTSRCS sim_x11eventloop.c) + elseif(CONFIG_SIM_AJOYSTICK) + list(APPEND SRCS sim_ajoystick.c) + list(APPEND HOSTSRCS sim_x11eventloop.c) + elseif(CONFIG_SIM_BUTTONS) + list(APPEND HOSTSRCS sim_x11eventloop.c) + endif() +endif() + +if(CONFIG_SIM_NETDEV_TAP) + list(APPEND SRCS sim_netdriver.c) + + if(NOT CYGWIN) + list(APPEND HOSTSRCS sim_tapdev.c) + + else() # CYGWIN != y + list(APPEND HOSTSRCS sim_wpcap.c) + list(APPEND STDLIBS /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a) + endif() # CONFIG_WINDOWS_CYGWIN != y +elseif(CONFIG_SIM_NETDEV_VPNKIT) + list(APPEND SRCS sim_netdriver.c) + list(APPEND HOST_DEFINITIONS + CONFIG_SIM_NETDEV_VPNKIT_PATH=\"${CONFIG_SIM_NETDEV_VPNKIT_PATH}\") + 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 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) +endif() + +if(CONFIG_SIM_I2CBUS_LINUX) + list(APPEND HOSTSRCS sim_i2cbuslinux.c) +endif() + +if(CONFIG_SIM_SPI_LINUX) + list(APPEND HOSTSRCS sim_spilinux.c) +endif() + +if(CONFIG_SIM_HOSTFS) + list(APPEND HOSTSRCS sim_hostfs.c) + list(APPEND HOST_DEFINITIONS CONFIG_NAME_MAX=${CONFIG_NAME_MAX}) + + configure_file(${NUTTX_DIR}/include/nuttx/fs/hostfs.h + ${CMAKE_CURRENT_BINARY_DIR}/hostfs.h COPYONLY) + target_include_directories(nuttx PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +target_include_directories(nuttx PRIVATE ${CMAKE_BINARY_DIR}/include/nuttx) +target_include_directories(nuttx PRIVATE ${CMAKE_CURRENT_LIST_DIR}) + +target_sources(sim_head PUBLIC sim_head.c sim_doirq.c) +target_sources(arch PRIVATE ${SRCS}) + +if(WIN32) + set(HOSTDIR win) +else() + set(HOSTDIR posix) + target_link_libraries(nuttx PUBLIC ${STDLIBS}) +endif() + +set(WINHOSTSRCS) +foreach(hostsrc ${HOSTSRCS}) + list(APPEND WINHOSTSRCS ${HOSTDIR}/${hostsrc}) +endforeach() + +set(HOSTSRCS ${WINHOSTSRCS}) + +target_sources(nuttx PRIVATE ${HOSTSRCS}) +target_compile_definitions(nuttx PRIVATE ${HOST_DEFINITIONS}) diff --git a/audio/CMakeLists.txt b/audio/CMakeLists.txt new file mode 100644 index 0000000000..6103dad43e --- /dev/null +++ b/audio/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# audio/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. +# +# ############################################################################## + +if(CONFIG_AUDIO) + nuttx_add_kernel_library(audio) + + set(SRCS audio.c) + + if(CONFIG_AUDIO_COMP) + list(APPEND SRCS audio_comp.c) + endif() + + if(CONFIG_AUDIO_FORMAT_PCM) + list(APPEND SRCS pcm_decode.c) + endif() + + target_sources(audio PRIVATE ${SRCS}) +endif() diff --git a/binfmt/CMakeLists.txt b/binfmt/CMakeLists.txt new file mode 100644 index 0000000000..c66615b620 --- /dev/null +++ b/binfmt/CMakeLists.txt @@ -0,0 +1,61 @@ +# ############################################################################## +# binfmt/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) + +nuttx_add_kernel_library(binfmt) + +nuttx_add_subdirectory() + +list( + APPEND + SRCS + binfmt_globals.c + binfmt_initialize.c + binfmt_register.c + binfmt_unregister.c + binfmt_loadmodule.c + binfmt_unloadmodule.c + binfmt_execmodule.c + binfmt_exec.c + binfmt_copyargv.c + binfmt_dumpmodule.c + binfmt_coredump.c) + +if(CONFIG_BINFMT_LOADABLE) + list(APPEND SRCS binfmt_exit.c) +endif() + +if(CONFIG_LIBC_EXECFUNCS) + list(APPEND SRCS binfmt_execsymtab.c) +endif() + +if(CONFIG_ELF) + list(APPEND SRCS elf.c) +endif() + +# Builtin application interfaces + +if(CONFIG_BUILTIN) + list(APPEND SRCS builtin.c) +endif() + +target_sources(binfmt PRIVATE ${SRCS}) +target_include_directories(binfmt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/binfmt/libelf/CMakeLists.txt b/binfmt/libelf/CMakeLists.txt new file mode 100644 index 0000000000..5652f2bd38 --- /dev/null +++ b/binfmt/libelf/CMakeLists.txt @@ -0,0 +1,51 @@ +# ############################################################################## +# binfmt/libelf/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. +# +# ############################################################################## + +if(CONFIG_ELF) + set(SRCS) + + # ELF library + + list( + APPEND + SRCS + libelf_bind.c + libelf_init.c + libelf_addrenv.c + libelf_iobuffer.c + libelf_load.c + libelf_read.c + libelf_sections.c + libelf_symbols.c + libelf_uninit.c + libelf_unload.c + libelf_verify.c) + + if(CONFIG_ELF_COREDUMP) + list(APPEND SRCS libelf_coredump.c) + target_include_directories(binfmt PRIVATE ${NUTTX_DIR}/sched) + endif() + + if(CONFIG_BINFMT_CONSTRUCTORS) + list(APPEND SRCS libelf_ctors.c libelf_dtors.c) + endif() + + target_sources(binfmt PRIVATE ${SRCS}) +endif() diff --git a/binfmt/libnxflat/CMakeLists.txt b/binfmt/libnxflat/CMakeLists.txt new file mode 100644 index 0000000000..2189319f69 --- /dev/null +++ b/binfmt/libnxflat/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# binfmt/libnxflat/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. +# +# ############################################################################## + +if(CONFIG_NXFLAT) + + target_sources( + binfmt + PRIVATE # NXFLAT library + libnxflat_init.c + libnxflat_uninit.c + libnxflat_addrenv.c + libnxflat_load.c + libnxflat_unload.c + libnxflat_verify.c + libnxflat_read.c + libnxflat_bind.c) + +endif() diff --git a/boards/CMakeLists.txt b/boards/CMakeLists.txt new file mode 100644 index 0000000000..87edb584cd --- /dev/null +++ b/boards/CMakeLists.txt @@ -0,0 +1,65 @@ +# ############################################################################## +# boards/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. +# +# ############################################################################## + +# Determine if there is a Kconfig file for any custom board configuration + +# TODO: implement if("${CONFIG_ARCH_BOARD_CUSTOM}" STREQUAL "y") CUSTOM_DIR = +# $(patsubst "%",%,$(CONFIG_ARCH_BOARD_CUSTOM_DIR)) +# if("${CONFIG_ARCH_BOARD_CUSTOM_DIR_RELPATH}" STREQUAL "y") CUSTOM_KPATH = +# $(TOPDIR)$(DELIM)$(CUSTOM_DIR)$(DELIM)Kconfig else CUSTOM_KPATH = +# $(CUSTOM_DIR)$(DELIM)Kconfig endif CUSTOM_KCONFIG = $(if $(wildcard +# $(CUSTOM_KPATH)),y,) else CUSTOM_KCONFIG = endif + +# ifeq ($(CUSTOM_KCONFIG),y) BOARD_KCONFIG = $(CUSTOM_KPATH) else BOARD_KCONFIG +# = $(TOPDIR)$(DELIM)configs$(DELIM)dummy$(DELIM)dummy_kconfig endif + +file(WRITE ${CMAKE_BINARY_DIR}/dummy.c "") +nuttx_add_kernel_library(board ${CMAKE_BINARY_DIR}/dummy.c) + +# boardctl support + +if(CONFIG_BOARDCTL) + target_sources(board PRIVATE boardctl.c) +endif() + +# obtain include directories exported by libarch +target_include_directories(board + PRIVATE $) + +# add contents of , and directories, adding common/ subdirs +# if found at each arch and soc level + +if(EXISTS ${NUTTX_BOARD_ABS_DIR}/../common/CMakeLists.txt) + add_subdirectory("${NUTTX_BOARD_ABS_DIR}/../common" EXCLUDE_FROM_ALL + exclude_common) + + # Create link ARCH_SRC_BOARD_BOARD_SYMLINK + + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}/src/board) + file(CREATE_LINK ${NUTTX_BOARD_ABS_DIR}/src + ${CMAKE_BINARY_DIR}/arch/${CONFIG_ARCH}/src/board/board SYMBOLIC) +endif() + +if(EXISTS ${NUTTX_BOARD_ABS_DIR}/../drivers/CMakeLists.txt) + add_subdirectory("${NUTTX_BOARD_ABS_DIR}/../drivers" EXCLUDE_FROM_ALL + exclude_drivers) +endif() + +add_subdirectory(${NUTTX_BOARD_ABS_DIR} EXCLUDE_FROM_ALL exclude_board) diff --git a/boards/arm/cxd56xx/common/CMakeLists.txt b/boards/arm/cxd56xx/common/CMakeLists.txt new file mode 100644 index 0000000000..ae9eaca2d3 --- /dev/null +++ b/boards/arm/cxd56xx/common/CMakeLists.txt @@ -0,0 +1,183 @@ +# ############################################################################## +# boards/arm/cxd56xx/common/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. +# +# ############################################################################## + +if(CONFIG_ARCH_BOARD_COMMON) + set(SRCS) + + list(APPEND SRCS src/cxd56_boot.c) + + if(CONFIG_AUDIO_CXD56) + list(APPEND SRCS src/cxd56_audio.c) + endif() + + if(CONFIG_CXD56_AUDIO) + list(APPEND SRCS src/cxd56_audio.c) + endif() + + if(CONFIG_MODEM_ALTMDM) + list(APPEND SRCS src/cxd56_altmdm.c) + endif() + + if(CONFIG_BOARDCTL_UNIQUEID) + list(APPEND SRCS src/cxd56_uid.c) + endif() + + if(CONFIG_CXD56_BACKUPLOG) + list(APPEND SRCS src/cxd56_crashdump.c) + endif() + + if(CONFIG_SENSORS) + list(APPEND SRCS src/cxd56_sensors.c) + endif() + + if(CONFIG_SENSORS_AK09912) + list(APPEND SRCS src/cxd56_ak09912_i2c.c) + endif() + + if(CONFIG_SENSORS_AK09912_SCU) + list(APPEND SRCS src/cxd56_ak09912_scu.c) + endif() + + if(CONFIG_SENSORS_APDS9930_SCU) + list(APPEND SRCS src/cxd56_apds9930_scu.c) + endif() + + if(CONFIG_SENSORS_APDS9960) + list(APPEND SRCS src/cxd56_apds9960_i2c.c) + endif() + + if(CONFIG_SENSORS_BH1721FVC_SCU) + list(APPEND SRCS src/cxd56_bh1721fvc_scu.c) + endif() + + if(CONFIG_SENSORS_BH1745NUC_SCU) + list(APPEND SRCS src/cxd56_bh1745nuc_scu.c) + endif() + + if(CONFIG_SENSORS_BM1383GLV_SCU) + list(APPEND SRCS src/cxd56_bm1383glv_scu.c) + endif() + + if(CONFIG_SENSORS_BM1422GMV_SCU) + list(APPEND SRCS src/cxd56_bm1422gmv_scu.c) + endif() + + if(CONFIG_SENSORS_BMI160_I2C) + list(APPEND SRCS src/cxd56_bmi160_i2c.c) + endif() + + if(CONFIG_SENSORS_BMI160_SCU) + list(APPEND SRCS src/cxd56_bmi160_scu.c) + endif() + + if(CONFIG_SENSORS_BMI160_SPI) + list(APPEND SRCS src/cxd56_bmi160_spi.c) + endif() + + if(CONFIG_SENSORS_BMP280) + list(APPEND SRCS src/cxd56_bmp280_i2c.c) + endif() + + if(CONFIG_SENSORS_BMP280_SCU) + list(APPEND SRCS src/cxd56_bmp280_scu.c) + endif() + + if(CONFIG_SENSORS_KX022_SCU) + list(APPEND SRCS src/cxd56_kx022_scu.c) + endif() + + if(CONFIG_SENSORS_LT1PA01_SCU) + list(APPEND SRCS src/cxd56_lt1pa01_scu.c) + endif() + + if(CONFIG_SENSORS_RPR0521RS_SCU) + list(APPEND SRCS src/cxd56_rpr0521rs_scu.c) + endif() + + if(CONFIG_SENSORS_SCD41) + list(APPEND SRCS src/cxd56_scd41_i2c.c) + endif() + + if(CONFIG_NETDEVICES) + list(APPEND SRCS src/cxd56_netinit.c) + endif() + + if(CONFIG_WL_GS2200M) + list(APPEND SRCS src/cxd56_gs2200m.c) + endif() + + if(CONFIG_LCD_ILI9340) + list(APPEND SRCS src/cxd56_ili9340.c) + endif() + + if(CONFIG_LCD_LPM013M091A) + list(APPEND SRCS src/cxd56_lpm013m091a.c) + endif() + + if(CONFIG_CXD56_SFC) + list(APPEND SRCS src/cxd56_flash.c) + endif() + + if(CONFIG_USBMSC) + list(APPEND SRCS src/cxd56_usbmsc.c) + endif() + + if(CONFIG_CXD56_I2C_DRIVER) + list(APPEND SRCS src/cxd56_i2cdev.c) + endif() + + if(CONFIG_I2C_BITBANG) + list(APPEND SRCS src/cxd56_i2cdev_bitbang.c) + endif() + + if(CONFIG_CXD56_SPI_DRIVER) + list(APPEND SRCS src/cxd56_spidev.c) + endif() + + if(CONFIG_VIDEO_ISX012) + list(APPEND SRCS src/cxd56_isx012.c) + endif() + + if(CONFIG_VIDEO_ISX019) + list(APPEND SRCS src/cxd56_isx019.c) + endif() + + if(CONFIG_CXD56_IMAGEPROC) + list(APPEND SRCS src/cxd56_imageproc.c) + endif() + + if(CONFIG_BCM20706) + list(APPEND SRCS src/cxd56_bcm20706.c) + endif() + + if(CONFIG_CXD56_EMMC) + list(APPEND SRCS src/cxd56_emmcdev.c) + endif() + + if(CONFIG_CXD56_SPISD) + list(APPEND SRCS src/cxd56_spisd.c) + endif() + + if(CONFIG_BOARD_USBDEV_SERIALSTR) + list(APPEND SRCS src/cxd56_usbdevserialstr.c) + endif() + + target_sources(board PRIVATE ${SRCS}) +endif() diff --git a/boards/arm/cxd56xx/spresense/CMakeLists.txt b/boards/arm/cxd56xx/spresense/CMakeLists.txt new file mode 100644 index 0000000000..fb1fa4a322 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# boards/arm/cxd56xx/spresense/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(src) + +if(NOT CONFIG_BUILD_FLAT) + add_subdirectory(kernel) + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER ${CMAKE_CURRENT_LIST_DIR}/scripts/memory.ld + ${CMAKE_CURRENT_LIST_DIR}/scripts/user-space.ld) +endif() + +ExternalProject_Add( + nuttx_post_build + SOURCE_DIR ${CMAKE_SOURCE_DIR}/tools/cxd56 + INSTALL_DIR ${CMAKE_BINARY_DIR}/tools/cxd56 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} + USES_TERMINAL_CONFIGURE true + USES_TERMINAL_BUILD true + USES_TERMINAL_INSTALL true + DEPENDS nuttx) + +add_custom_command( + TARGET nuttx_post_build + POST_BUILD + BYPRODUCTS nuttx.spk + COMMAND ${CMAKE_BINARY_DIR}/bin/mkspk -c2 nuttx nuttx nuttx.spk + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/boards/arm/cxd56xx/spresense/src/CMakeLists.txt b/boards/arm/cxd56xx/spresense/src/CMakeLists.txt new file mode 100644 index 0000000000..8146b4f4aa --- /dev/null +++ b/boards/arm/cxd56xx/spresense/src/CMakeLists.txt @@ -0,0 +1,89 @@ +# ############################################################################## +# boards/arm/cxd56xx/spresense/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. +# +# ############################################################################## + +set(SRCS) + +set(SRCS cxd56_main.c cxd56_clock.c cxd56_bringup.c) + +if(CONFIG_BOARDCTL) + list(APPEND SRCS cxd56_appinit.c) + list(APPEND SRCS cxd56_power.c) +endif() + +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS cxd56_ioctl.c) +endif() + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS cxd56_leds.c) +elseif(CONFIG_USERLED) + list(APPEND SRCS cxd56_userleds.c) +endif() + +if(CONFIG_ARCH_BUTTONS) + list(APPEND SRCS cxd56_buttons.c) +endif() + +if(CONFIG_CXD56_GPIO_IRQ) + list(APPEND SRCS cxd56_gpioif.c) +endif() + +if(CONFIG_CXD56_PWM) + list(APPEND SRCS cxd56_pwm.c) +endif() + +if(CONFIG_SPI) + list(APPEND SRCS cxd56_spi.c) +endif() + +if(CONFIG_CXD56_SDIO) + list(APPEND SRCS cxd56_sdcard.c) +endif() + +if(CONFIG_CXD56_SDCARD_AUTOMOUNT) + list(APPEND SRCS cxd56_automount.c) +endif() + +if(CONFIG_CXD56_GAUGE) + list(APPEND SRCS cxd56_gauge.c) +endif() + +if(CONFIG_CXD56_CHARGER) + list(APPEND SRCS cxd56_charger.c) +endif() + +if(CONFIG_USBDEV_COMPOSITE) + list(APPEND SRCS cxd56_composite.c) +endif() + +if(CONFIG_MODEM_ALT1250) + list(APPEND SRCS cxd56_alt1250_power.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +if(CONFIG_CXD56_USE_SYSBUS) + set(LDSCRIPT ramconfig-new.ld) +else() + set(LDSCRIPT ramconfig.ld) +endif() + +# TODO: make this the default and then allow boards to redefine +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/${LDSCRIPT}") diff --git a/boards/arm/imx6/sabre-6quad/CMakeLists.txt b/boards/arm/imx6/sabre-6quad/CMakeLists.txt new file mode 100644 index 0000000000..af0a8fd1f1 --- /dev/null +++ b/boards/arm/imx6/sabre-6quad/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# boards/arm/imx6/sabre-6quad/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(src) + +if(NOT CONFIG_BUILD_FLAT) + add_subdirectory(kernel) + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER ${CMAKE_CURRENT_LIST_DIR}/scripts/memory.ld + ${CMAKE_CURRENT_LIST_DIR}/scripts/user-space.ld) +endif() diff --git a/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt b/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt new file mode 100644 index 0000000000..3c82bef94a --- /dev/null +++ b/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt @@ -0,0 +1,36 @@ +# ############################################################################## +# boards/arm/imx6/sabre-6quad/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. +# +# ############################################################################## + +set(SRCS imx_boardinit.c imx_bringup.c) + +if(CONFIG_BOARDCTL) + list(APPEND SRCS imx_appinit.c) +endif() + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS imx_autoleds.c) +else() + list(APPEND SRCS imx_userleds.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +# TODO: make this the default and then allow boards to redefine +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/dramboot.ld") diff --git a/boards/arm/stm32/common/CMakeLists.txt b/boards/arm/stm32/common/CMakeLists.txt new file mode 100644 index 0000000000..a7246392df --- /dev/null +++ b/boards/arm/stm32/common/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# boards/arm/stm32/common/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(src) +target_include_directories(board PRIVATE include) diff --git a/boards/arm/stm32/common/src/CMakeLists.txt b/boards/arm/stm32/common/src/CMakeLists.txt new file mode 100644 index 0000000000..f56d5f6d57 --- /dev/null +++ b/boards/arm/stm32/common/src/CMakeLists.txt @@ -0,0 +1,127 @@ +# ############################################################################## +# boards/arm/stm32/common/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. +# +# ############################################################################## + +set(SRCS) + +if(CONFIG_SENSORS_BMP180) + list(APPEND SRCS stm32_bmp180.c) +endif() + +if(CONFIG_LEDS_APA102) + list(APPEND SRCS stm32_apa102.c) +endif() + +if(CONFIG_WS2812) + list(APPEND SRCS stm32_ws2812.c) +endif() + +if(CONFIG_SENSORS_MAX6675) + list(APPEND SRCS stm32_max6675.c) +endif() + +if(CONFIG_SENSORS_VEML6070) + list(APPEND SRCS stm32_veml6070.c) +endif() + +if(CONFIG_INPUT_NUNCHUCK) + list(APPEND SRCS stm32_nunchuck.c) +endif() + +if(CONFIG_AUDIO_TONE) + list(APPEND SRCS stm32_tone.c) +endif() + +if(CONFIG_LCD_BACKPACK) + list(APPEND SRCS stm32_lcd_backpack.c) +endif() + +if(CONFIG_LCD_SSD1306) + list(APPEND SRCS stm32_ssd1306.c) +endif() + +if(CONFIG_SENSORS_LM75) + list(APPEND SRCS stm32_lm75.c) +endif() + +if(CONFIG_WL_NRF24L01) + list(APPEND SRCS stm32_nrf24l01.c) +endif() + +if(CONFIG_SENSORS_HCSR04) + list(APPEND SRCS stm32_hcsr04.c) +endif() + +if(CONFIG_SENSORS_APDS9960) + list(APPEND SRCS stm32_apds9960.c) +endif() + +if(CONFIG_SENSORS_ZEROCROSS) + list(APPEND SRCS stm32_zerocross.c) +endif() + +if(CONFIG_SENSORS_QENCODER) + list(APPEND SRCS stm32_qencoder.c) +endif() + +if(CONFIG_SENSORS_INA219) + list(APPEND SRCS stm32_ina219.c) +endif() + +if(CONFIG_SENSORS_L3GD20) + list(APPEND SRCS stm32_l3gd20.c) +endif() + +if(CONFIG_SENSORS_MPL115A) + list(APPEND SRCS stm32_mpl115a.c) +endif() + +if(CONFIG_SENSORS_DHTXX) + list(APPEND SRCS stm32_dhtxx.c) +endif() + +if(CONFIG_SENSORS_XEN1210) + list(APPEND SRCS stm32_xen1210.c) +endif() + +if(CONFIG_SENSORS_BH1750FVI) + list(APPEND SRCS stm32_bh1750.c) +endif() + +if(CONFIG_SENSORS_MLX90614) + list(APPEND SRCS stm32_mlx90614.c) +endif() + +if(CONFIG_SENSORS_MAX31855) + list(APPEND SRCS stm32_max31855.c) +endif() + +if(CONFIG_LIS3DSH) + list(APPEND SRCS stm32_lis3dsh.c) +endif() + +if(CONFIG_BOARD_STM32_IHM07M1) + list(APPEND SRCS stm32_ihm07m1.c) +endif() + +if(CONFIG_BOARD_STM32_IHM08M1) + list(APPEND SRCS stm32_ihm08m1.c) +endif() + +target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm/stm32/stm32f103-minimum/CMakeLists.txt b/boards/arm/stm32/stm32f103-minimum/CMakeLists.txt new file mode 100644 index 0000000000..5f1265c546 --- /dev/null +++ b/boards/arm/stm32/stm32f103-minimum/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# boards/arm/stm32/stm32f103-minimum/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(src) diff --git a/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt b/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt new file mode 100644 index 0000000000..18bc829758 --- /dev/null +++ b/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt @@ -0,0 +1,153 @@ +# ############################################################################## +# boards/arm/stm32/stm32f103-minimum/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. +# +# ############################################################################## + +set(CSRCS) + +list(APPEND CSRCS stm32_boot.c stm32_bringup.c stm32_spi.c) + +if("${CONFIG_LIB_BOARDCTL}" STREQUAL "y") + list(APPEND CSRCS stm32_appinit.c) +endif() + +if("${CONFIG_ARCH_BUTTONS}" STREQUAL "y") + list(APPEND CSRCS stm32_buttons.c) +endif() + +if("${CONFIG_ARCH_LEDS}" STREQUAL "y") + list(APPEND CSRCS stm32_autoleds.c) +else() + list(APPEND CSRCS stm32_userleds.c) +endif() + +if("${CONFIG_ADC}" STREQUAL "y") + list(APPEND CSRCS stm32_adc.c) +endif() + +if("${CONFIG_DEV_GPIO}" STREQUAL "y") + list(APPEND CSRCS stm32_gpio.c) +endif() + +if("${CONFIG_PWM}" STREQUAL "y") + list(APPEND CSRCS stm32_pwm.c) +endif() + +if("${CONFIG_SENSORS_ZEROCROSS}" STREQUAL "y") + list(APPEND CSRCS stm32_zerocross.c) +endif() + +if("${CONFIG_LEDS_APA102}" STREQUAL "y") + list(APPEND CSRCS stm32_apa102.c) +endif() + +if("${CONFIG_SENSORS_BMP180}" STREQUAL "y") + list(APPEND CSRCS stm32_bmp180.c) +endif() + +if("${CONFIG_LM75_I2C}" STREQUAL "y") + list(APPEND CSRCS stm32_lm75.c) +endif() + +if("${CONFIG_RGBLED}" STREQUAL "y") + list(APPEND CSRCS stm32_rgbled.c) +endif() + +if("${CONFIG_MMCSD}" STREQUAL "y") + list(APPEND CSRCS stm32_mmcsd.c) +endif() + +if("${CONFIG_MTD_W25}" STREQUAL "y") + list(APPEND CSRCS stm32_w25.c) +endif() + +if("${CONFIG_MTD_AT24XX}" STREQUAL "y") + if("${CONFIG_STM32_I2C1}" STREQUAL "y") + list(APPEND CSRCS stm32_at24.c) + endif() +endif() + +if("${CONFIG_AUDIO_TONE}" STREQUAL "y") + list(APPEND CSRCS stm32_tone.c) +endif() + +if("${CONFIG_CAN_MCP2515}" STREQUAL "y") + list(APPEND CSRCS stm32_mcp2515.c) +endif() + +if("${CONFIG_CL_MFRC522}" STREQUAL "y") + list(APPEND CSRCS stm32_mfrc522.c) +endif() + +if("${CONFIG_SENSORS_HCSR04}" STREQUAL "y") + list(APPEND CSRCS stm32_hcsr04.c) +endif() + +if("${CONFIG_SENSORS_MAX6675}" STREQUAL "y") + list(APPEND CSRCS stm32_max6675.c) +endif() + +if("${CONFIG_LCD_MAX7219}" STREQUAL "y") + list(APPEND CSRCS stm32_max7219.c) +endif() + +if("${CONFIG_INPUT_NUNCHUCK}" STREQUAL "y") + list(APPEND CSRCS stm32_nunchuck.c) +endif() + +if("${CONFIG_LCD_SSD1306_I2C}" STREQUAL "y") + list(APPEND CSRCS stm32_ssd1306.c) +endif() + +if("${CONFIG_LCD_ST7567}" STREQUAL "y") + list(APPEND CSRCS stm32_lcd.c) +endif() + +if("${CONFIG_LCD_PCD8544}" STREQUAL "y") + list(APPEND CSRCS stm32_pcd8544.c) +endif() + +if("${CONFIG_SENSORS_APDS9960}" STREQUAL "y") + list(APPEND CSRCS stm32_apds9960.c) +endif() + +if("${CONFIG_SENSORS_QENCODER}" STREQUAL "y") + list(APPEND CSRCS stm32_qencoder.c) +endif() + +if("${CONFIG_SENSORS_VEML6070}" STREQUAL "y") + list(APPEND CSRCS stm32_veml6070.c) +endif() + +if("${CONFIG_WL_NRF24L01}" STREQUAL "y") + list(APPEND CSRCS stm32_nrf24l01.c) +endif() + +if("${CONFIG_USBDEV}" STREQUAL "y") + list(APPEND CSRCS stm32_usbdev.c) +endif() + +if("${CONFIG_USBMSC}" STREQUAL "y") + list(APPEND CSRCS stm32_usbmsc.c) +endif() + +target_sources(board PRIVATE ${CSRCS}) + +# Configure linker script TODO: better to place this in boards/CMakeLists.txt? + +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32/stm32f4discovery/CMakeLists.txt b/boards/arm/stm32/stm32f4discovery/CMakeLists.txt new file mode 100644 index 0000000000..0b1cf06d66 --- /dev/null +++ b/boards/arm/stm32/stm32f4discovery/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# boards/arm/stm32/stm32f4discovery/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(src) + +if(NOT CONFIG_BUILD_FLAT) + add_subdirectory(kernel) + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER ${CMAKE_CURRENT_LIST_DIR}/scripts/memory.ld + ${CMAKE_CURRENT_LIST_DIR}/scripts/user-space.ld) +endif() diff --git a/boards/arm/stm32/stm32f4discovery/kernel/CMakeLists.txt b/boards/arm/stm32/stm32f4discovery/kernel/CMakeLists.txt new file mode 100644 index 0000000000..6b6b7ae95c --- /dev/null +++ b/boards/arm/stm32/stm32f4discovery/kernel/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# boards/arm/stm32/stm32f4discovery/kernel/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_aux_library(userspace stm32_userspace.c) diff --git a/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt b/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt new file mode 100644 index 0000000000..eb63c65ed5 --- /dev/null +++ b/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt @@ -0,0 +1,224 @@ +# ############################################################################## +# boards/arm/stm32/stm32f4discovery/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. +# +# ############################################################################## + +set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c) + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS stm32_autoleds.c) +else() + list(APPEND SRCS stm32_userleds.c) +endif() + +if(CONFIG_AUDIO_CS43L22) + list(APPEND SRCS stm32_cs43l22.c) +endif() + +if(CONFIG_ARCH_BUTTONS) + list(APPEND SRCS stm32_buttons.c) +endif() + +if(CONFIG_STM32_CAN_CHARDRIVER) + list(APPEND SRCS stm32_can.c) +endif() + +if(CONFIG_STM32_OTGFS) + list(APPEND SRCS stm32_usb.c) +endif() + +if(CONFIG_LCD_ST7567) + list(APPEND SRCS stm32_st7567.c) +endif() + +if(CONFIG_ENC28J60) + list(APPEND SRCS stm32_enc28j60.c) +endif() + +if(CONFIG_LPWAN_SX127X) + list(APPEND SRCS stm32_sx127x.c) +endif() + +if(CONFIG_LCD_MAX7219) + list(APPEND SRCS stm32_max7219.c) +endif() + +if(CONFIG_LCD_ST7032) + list(APPEND SRCS stm32_st7032.c) +endif() + +if(CONFIG_PCA9635PW) + list(APPEND SRCS stm32_pca9635.c) +endif() + +if(CONFIG_STM32_SDIO) + list(APPEND SRCS stm32_sdio.c) +endif() + +if(CONFIG_STM32_ETHMAC) + list(APPEND SRCS stm32_ethernet.c) +endif() + +if(CONFIG_LEDS_MAX7219) + list(APPEND SRCS stm32_max7219_leds.c) +endif() + +if(CONFIG_RGBLED) + list(APPEND SRCS stm32_rgbled.c) +endif() + +if(CONFIG_RTC_DS1307) + list(APPEND SRCS stm32_ds1307.c) +endif() + +if(CONFIG_PWM) + list(APPEND SRCS stm32_pwm.c) +endif() + +if(CONFIG_BOARDCTL) + list(APPEND SRCS stm32_appinit.c) + if(CONFIG_BOARDCTL_RESET) + list(APPEND SRCS stm32_reset.c) + endif() +endif() + +if(CONFIG_ARCH_CUSTOM_PMINIT) + list(APPEND SRCS stm32_pm.c) +endif() + +if(CONFIG_PM_BUTTONS) + list(APPEND SRCS stm32_pmbuttons.c) +endif() + +if(CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS stm32_idle.c) +endif() + +if(CONFIG_STM32_FSMC) + list(APPEND SRCS stm32_extmem.c) + + if(CONFIG_LCD_SSD1289) + list(APPEND SRCS stm32_ssd1289.c) + endif() +endif() + +if(CONFIG_LCD_SSD1351) + list(APPEND SRCS stm32_ssd1351.c) +endif() + +if(CONFIG_LCD_UG2864AMBAG01) + list(APPEND SRCS stm32_ug2864ambag01.c) +endif() + +if(CONFIG_LCD_UG2864HSWEG01) + list(APPEND SRCS stm32_ug2864hsweg01.c) +endif() + +if(CONFIG_TIMER) + list(APPEND SRCS stm32_timer.c) +endif() + +if(CONFIG_STM32_HCIUART) + if(CONFIG_BLUETOOTH_UART) + list(APPEND SRCS stm32_hciuart.c) + endif() +endif() + +if(CONFIG_STM32_ROMFS) + list(APPEND SRCS stm32_romfs_initialize.c) +endif() + +if(CONFIG_BOARDCTL_UNIQUEID) + list(APPEND SRCS stm32_uid.c) +endif() + +if(CONFIG_USBMSC) + list(APPEND SRCS stm32_usbmsc.c) +endif() + +if(NOT CONFIG_STM32_ETHMAC) + if(CONFIG_NETDEVICES) + list(APPEND SRCS stm32_netinit.c) + endif() +endif() + +if(CONFIG_MMCSD_SPI) + list(APPEND SRCS stm32_mmcsd.c) +endif() + +if(CONFIG_WL_GS2200M) + list(APPEND SRCS stm32_gs2200m.c) +endif() + +if(CONFIG_LCD_ST7789) + list(APPEND SRCS stm32_st7789.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +# TODO: make this the default and then allow boards to redefine +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") + +# TODO:move this to apropriate arch/toolchain level +set_property( + GLOBAL APPEND + PROPERTY COMPILE_OPTIONS $<$:-fno-strict-aliasing + -fomit-frame-pointer>) + +# TODO: see where to put pic flags set_property(TARGET nuttx APPEND PROPERTY +# NUTTX_COMPILE_OPTIONS $<$>:-fpic -msingle-pic-base +# -mpic-register=r10>) + +# ifeq ($(CONFIG_ARMV7M_TOOLCHAIN_CLANGL),y) ARCHCFLAGS += -nostdlib +# -ffreestanding ARCHCXXFLAGS += -nostdlib -ffreestanding else ARCHCFLAGS += +# -funwind-tables ARCHCXXFLAGS += -fno-rtti -funwind-tables ifneq +# ($(CONFIG_DEBUG_NOOPT),y) ARCHOPTIMIZATION += -fno-strength-reduce endif endif + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS -funwind-tables) +set_property(GLOBAL APPEND PROPERTY COMPILE_OPTIONS -fno-strength-reduce) + +# TODO: nxflat NXFLATLDFLAGS1 = -r -d -warn-common NXFLATLDFLAGS2 = +# $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld +# -no-check-sections LDNXFLATFLAGS = -e main -s 2048 + +# Loadable module definitions + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_COMPILE_OPTIONS -mlong-calls) +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_MODULE_LINK_OPTIONS -r -e module_initialize -T + ${NUTTX_DIR}/libs/libc/modlib/gnu-elf.ld) + +# ELF module definitions + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_APP_COMPILE_OPTIONS -mlong-calls) +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_ELF_APP_LINK_OPTIONS -r -e main + -T${NUTTX_BOARD_DIR}/scripts/gnu-elf.ld) diff --git a/boards/arm/stm32u5/b-u585i-iot02a/CMakeLists.txt b/boards/arm/stm32u5/b-u585i-iot02a/CMakeLists.txt new file mode 100644 index 0000000000..c5732a36f8 --- /dev/null +++ b/boards/arm/stm32u5/b-u585i-iot02a/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# boards/arm/stm32u5/b-u585i-iot02a/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(src) + +if(NOT CONFIG_BUILD_FLAT) + add_subdirectory(kernel) + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER ${CMAKE_CURRENT_LIST_DIR}/scripts/memory.ld + ${CMAKE_CURRENT_LIST_DIR}/scripts/user-space.ld) +endif() diff --git a/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt b/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt new file mode 100644 index 0000000000..e82a23f800 --- /dev/null +++ b/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# boards/arm/stm32u5/b-u585i-iot02a/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. +# +# ############################################################################## + +set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c) + +if(CONFIG_BOARDCTL) + list(APPEND SRCS stm32_appinit.c) +endif() + +if(CONFIG_ARCH_BOARD_STM32U5_CUSTOM_CLOCKCONFIG) + list(APPEND SRCS stm32_clockconfig.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +# TODO: make this the default and then allow boards to redefine +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/tiva/lm3s6965-ek/CMakeLists.txt b/boards/arm/tiva/lm3s6965-ek/CMakeLists.txt new file mode 100644 index 0000000000..d2081c5c05 --- /dev/null +++ b/boards/arm/tiva/lm3s6965-ek/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# boards/arm/tiva/lm3s6965-ek/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(src) + +if(NOT CONFIG_BUILD_FLAT) + add_subdirectory(kernel) + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER ${CMAKE_CURRENT_LIST_DIR}/scripts/memory.ld + ${CMAKE_CURRENT_LIST_DIR}/scripts/user-space.ld) +endif() diff --git a/boards/arm/tiva/lm3s6965-ek/src/CMakeLists.txt b/boards/arm/tiva/lm3s6965-ek/src/CMakeLists.txt new file mode 100644 index 0000000000..7210adbabe --- /dev/null +++ b/boards/arm/tiva/lm3s6965-ek/src/CMakeLists.txt @@ -0,0 +1,40 @@ +# ############################################################################## +# boards/arm/tiva/lm3s6965-ek/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. +# +# ############################################################################## + +set(SRCS lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c) + +if(CONFIG_BOARDCTL) + list(APPEND SRCS lm_appinit.c) +endif() + +if(CONFIG_NX_LCDDRIVER) + list(APPEND SRCS lm_oled.c) +endif() + +if(CONFIG_BOARD_LATE_INITIALIZE) + list(APPEND SRCS lm_bringup.c) +elseif(CONFIG_BOARDCTL) + list(APPEND SRCS lm_bringup.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +# TODO: make this the default and then allow boards to redefine +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/sim/sim/sim/CMakeLists.txt b/boards/sim/sim/sim/CMakeLists.txt new file mode 100644 index 0000000000..d3daa2c07d --- /dev/null +++ b/boards/sim/sim/sim/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# boards/sim/sim/sim/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(src) diff --git a/boards/sim/sim/sim/configs/nsh/defconfig b/boards/sim/sim/sim/configs/nsh/defconfig index f7cc0bc916..9d509e53ea 100644 --- a/boards/sim/sim/sim/configs/nsh/defconfig +++ b/boards/sim/sim/sim/configs/nsh/defconfig @@ -6,7 +6,6 @@ # modifications. # # CONFIG_NSH_CMDOPT_HEXDUMP is not set -CONFIG_ALLSYMS=y CONFIG_ARCH="sim" CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y diff --git a/boards/sim/sim/sim/src/CMakeLists.txt b/boards/sim/sim/sim/src/CMakeLists.txt new file mode 100644 index 0000000000..51a1cb393b --- /dev/null +++ b/boards/sim/sim/sim/src/CMakeLists.txt @@ -0,0 +1,79 @@ +# ############################################################################## +# boards/sim/sim/sim/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. +# +# ############################################################################## + +# CSRCS = dummy.c + +if(CONFIG_BOARD_LATE_INITIALIZE) + list(APPEND SRCS sim_boot.c) +endif() + +if(CONFIG_BOARDCTL) + list(APPEND SRCS sim_appinit.c) +endif() + +if(CONFIG_BOARD_LATE_INITIALIZE) + list(APPEND SRCS sim_bringup.c) + if(CONFIG_LIBC_ZONEINFO_ROMFS) + list(APPEND SRCS sim_zoneinfo.c) + endif() +elseif(CONFIG_BOARDCTL) + list(APPEND SRCS sim_bringup.c) + if(CONFIG_LIBC_ZONEINFO_ROMFS) + list(APPEND SRCS sim_zoneinfo.c) + endif() +endif() + +if(CONFIG_EXAMPLES_GPIO) + if(CONFIG_GPIO_LOWER_HALF) + list(APPEND SRCS sim_ioexpander.c) + else() + list(APPEND SRCS sim_gpio.c) + endif() +endif() + +if(CONFIG_ARCH_BUTTONS) + list(APPEND SRCS sim_buttons.c) +endif() + +if(CONFIG_MOTOR_FOC_DUMMY) + list(APPEND SRCS sim_foc.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/gnu-elf.ld") + +if(CONFIG_NSH_ROMFSETC AND CONFIG_NSH_ARCHROMFS) + nuttx_add_romfs( + NAME + etc + MOUNTPOINT + etc + RCSRCS + etc/init.d/rcS + etc/init.d/rc.sysinit + RCRAWS + etc/group + etc/passwd + PATH + ${CMAKE_CURRENT_BINARY_DIR}/etc) + + target_link_libraries(board PRIVATE romfs_etc) +endif() diff --git a/cmake/menuconfig.cmake b/cmake/menuconfig.cmake new file mode 100644 index 0000000000..4bdf7eaea4 --- /dev/null +++ b/cmake/menuconfig.cmake @@ -0,0 +1,115 @@ +# ############################################################################## +# cmake/menuconfig.cmake +# +# 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. +# +# ############################################################################## + +# menuconfig target this triggers a reconfiguration (TODO: do only if config +# changes) + +set(KCONFIG_ENV + "KCONFIG_CONFIG=${CMAKE_BINARY_DIR}/.config" + "EXTERNALDIR=dummy" + "APPSDIR=${NUTTX_APPS_DIR}" + "DRIVERS_PLATFORM_DIR=dummy" + "APPSBINDIR=${NUTTX_APPS_BINDIR}" + "BINDIR=${CMAKE_BINARY_DIR}" + "HOST_LINUX=$,y,n>" + "HOST_MACOS=$,y,n>" + "HOST_WINDOWS=$,y,n>" + "HOST_OTHER=$,y,n>") + +# Use qconfig instead of menuconfig since PowerShell not support curses +# redirection + +if(WIN32) + set(MENUCONFIG guiconfig) +else() + set(MENUCONFIG menuconfig) +endif() + +add_custom_target( + menuconfig + COMMAND ${CMAKE_COMMAND} -E env ${KCONFIG_ENV} ${MENUCONFIG} + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_BINARY_DIR}/include/nuttx/config.h # invalidate existing + # config + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_PARENT_LIST_FILE} + WORKING_DIRECTORY ${NUTTX_DIR} + USES_TERMINAL) + +# qconfig target + +add_custom_target( + qconfig + COMMAND ${CMAKE_COMMAND} -E env ${KCONFIG_ENV} guiconfig + COMMAND ${CMAKE_COMMAND} -E remove -f + ${CMAKE_BINARY_DIR}/include/nuttx/config.h # invalidate existing + # config + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_PARENT_LIST_FILE} + WORKING_DIRECTORY ${NUTTX_DIR} + USES_TERMINAL) + +add_custom_target( + savedefconfig + COMMAND ${CMAKE_COMMAND} -E env ${KCONFIG_ENV} savedefconfig --out + ${CMAKE_BINARY_DIR}/defconfig.tmp + COMMAND grep "CONFIG_ARCH=" ${CMAKE_BINARY_DIR}/.config >> + ${CMAKE_BINARY_DIR}/defconfig.tmp + COMMAND grep "^CONFIG_ARCH_CHIP_" ${CMAKE_BINARY_DIR}/.config >> + ${CMAKE_BINARY_DIR}/defconfig.tmp + COMMAND grep "CONFIG_ARCH_CHIP=" ${CMAKE_BINARY_DIR}/.config >> + ${CMAKE_BINARY_DIR}/defconfig.tmp + COMMAND grep "CONFIG_ARCH_BOARD=" ${CMAKE_BINARY_DIR}/.config >> + ${CMAKE_BINARY_DIR}/defconfig.tmp || true + COMMAND grep "^CONFIG_ARCH_CUSTOM" ${CMAKE_BINARY_DIR}/.config >> + ${CMAKE_BINARY_DIR}/defconfig.tmp || true + COMMAND grep "^CONFIG_ARCH_BOARD_CUSTOM" ${CMAKE_BINARY_DIR}/.config >> + ${CMAKE_BINARY_DIR}/defconfig.tmp || true + COMMAND export LC_ALL=C && cat ${CMAKE_BINARY_DIR}/defconfig.tmp | sort | uniq + > ${CMAKE_BINARY_DIR}/sortedconfig.tmp || true + COMMAND echo "\\#" > ${CMAKE_BINARY_DIR}/warning.tmp || true + COMMAND echo "\\# This file is autogenerated: PLEASE DO NOT EDIT IT." >> + ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND echo "\\#" >> ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND + echo + "\\# You can use make menuconfig to make any modifications to the installed .config file." + >> ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND + echo + "\\# You can then do make savedefconfig or cmake -t savedefconfig to generate a new defconfig file that includes your" + >> ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND echo "\\# modifications." >> ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND echo "\\#" >> ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND cat ${CMAKE_BINARY_DIR}/warning.tmp + ${CMAKE_BINARY_DIR}/sortedconfig.tmp > ${CMAKE_BINARY_DIR}/defconfig + COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/warning.tmp + COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/defconfig.tmp + COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/sortedconfig.tmp + WORKING_DIRECTORY ${NUTTX_DIR}) + +# utility target to restore .config from board's defconfig +add_custom_target( + resetconfig + COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_DEFCONFIG} + ${CMAKE_BINARY_DIR}/.config + COMMAND ${CMAKE_COMMAND} -E env ${KCONFIG_ENV} olddefconfig + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/.config + ${CMAKE_BINARY_DIR}/.config.orig + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_PARENT_LIST_FILE} + WORKING_DIRECTORY ${NUTTX_DIR}) diff --git a/cmake/nuttx_add_application.cmake b/cmake/nuttx_add_application.cmake new file mode 100644 index 0000000000..8727154360 --- /dev/null +++ b/cmake/nuttx_add_application.cmake @@ -0,0 +1,192 @@ +# ############################################################################## +# cmake/nuttx_add_application.cmake +# +# 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(nuttx_parse_function_args) + +define_property( + GLOBAL + PROPERTY NUTTX_APPS_LIBRARIES + BRIEF_DOCS "NuttX application libs" + FULL_DOCS "List of all NuttX application libraries") + +# nuttx_add_application +# +# Description: Declares a NuttX application as a static library. The +# corresponding target will be named apps_. The first entry into the +# source list is assumed to be the one containing main() and will thus receive a +# -Dmain=app_main definition during build. +# +# Usage: nuttx_add_application( NAME [ PRIORITY ] [ STACKSIZE +# ] [ COMPILE_FLAGS ] [ INCLUDE_DIRECTORIES ] [ DEPENDS +# ] [ MODULE ] [ SRCS ] ) +# +# Parameters: NAME : unique name of application PRIORITY : +# priority STACKSIZE : stack size COMPILE_FLAGS : compile flags SRCS : +# source files MODULE : if "m", build module (designed to received +# CONFIG_ value) DEPENDS : targets which this module depends on +# NO_MAIN_ALIAS : do not add a main=_main alias(*) +# +# (*) This is only really needed in convoluted cases where a single .c file +# contains differently named _main() entries for different . This +# situation should really be changed into a separate main file per actual app +# using a shared user library. +# +# Example: nuttx_add_application( NAME test SRCS file.cpp STACKSIZE 1024 DEPENDS +# nshlib MODULE ${CONFIG_EXAMPLES_TEST} ) + +function(nuttx_add_application) + + # parse arguments into variables + + nuttx_parse_function_args( + FUNC + nuttx_add_application + ONE_VALUE + NAME + PRIORITY + STACKSIZE + MODULE + MULTI_VALUE + COMPILE_FLAGS + INCLUDE_DIRECTORIES + SRCS + DEPENDS + OPTIONS + NO_MAIN_ALIAS + REQUIRED + NAME + ARGN + ${ARGN}) + + # create target + + if(SRCS) + if(MODULE + AND ("${MODULE}" STREQUAL "m") + OR CONFIG_BUILD_KERNEL) + # create as standalone executable (loadable application or "module") + set(TARGET "${NAME}") + + # Use ELF capable toolchain, by building manually and overwriting the + # non-elf output + if(NOT CMAKE_C_ELF_COMPILER) + add_library(${TARGET} ${SRCS}) + + add_custom_command( + TARGET ${TARGET} + POST_BUILD + COMMAND + ${CMAKE_C_COMPILER} + $> + $ -o ${TARGET} + COMMAND_EXPAND_LISTS) + else() + add_executable(${TARGET} ${SRCS}) + target_link_options( + ${TARGET} PRIVATE + $>) + endif() + + # easy access to final ELF, regardless of how it was created + set_property(TARGET ${TARGET} + PROPERTY ELF_BINARY ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}) + + nuttx_add_library_internal(${TARGET}) + + install(TARGETS ${TARGET}) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_LOADABLE_APPS ${TARGET}) + else() + # create as library to be archived into libapps.a + set(TARGET "apps_${NAME}") + add_library(${TARGET} ${SRCS}) + + nuttx_add_library_internal(${TARGET}) + # add to list of application libraries + + set_property(GLOBAL APPEND PROPERTY NUTTX_APPS_LIBRARIES ${TARGET}) + + if(NOT NO_MAIN_ALIAS) + # provide main() alias + list(GET SRCS 0 MAIN_SRC) + set_property( + SOURCE ${MAIN_SRC} + APPEND + PROPERTY COMPILE_DEFINITIONS main=${NAME}_main) + endif() + endif() + + # loadable build requires applying ELF flags to all applications + + if(CONFIG_BUILD_LOADABLE) + target_compile_options( + ${TARGET} + PRIVATE + $>) + endif() + endif() + + # store parameters into properties (used during builtin list generation) + + set_target_properties(${TARGET} PROPERTIES APP_MAIN ${NAME}_main) + set_target_properties(${TARGET} PROPERTIES APP_NAME ${NAME}) + + if(PRIORITY) + set_target_properties(${TARGET} PROPERTIES APP_PRIORITY ${PRIORITY}) + else() + set_target_properties(${TARGET} PROPERTIES APP_PRIORITY + SCHED_PRIORITY_DEFAULT) + endif() + + if(STACKSIZE) + set_target_properties(${TARGET} PROPERTIES APP_STACK ${STACKSIZE}) + else() + set_target_properties(${TARGET} PROPERTIES APP_STACK + ${CONFIG_DEFAULT_TASK_STACKSIZE}) + endif() + + # compile options + + if(COMPILE_FLAGS) + target_compile_options(${TARGET} PRIVATE ${COMPILE_FLAGS}) + endif() + + if(INCLUDE_DIRECTORIES) + foreach(inc ${INCLUDE_DIRECTORIES}) + target_include_directories(${TARGET} PRIVATE ${inc}) + endforeach() + endif() + + # add supplied dependencies + + if(DEPENDS) + # using target_link_libraries for dependencies provides linking as well as + # interface include and libraries + foreach(dep ${DEPENDS}) + get_target_property(dep_type ${dep} TYPE) + # if (${dep_type} STREQUAL "STATIC_LIBRARY") + # target_link_libraries(${TARGET} PRIVATE ${dep}) else() + add_dependencies(${TARGET} ${dep}) + # endif() + endforeach() + endif() +endfunction() diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake new file mode 100644 index 0000000000..daeb2a1f84 --- /dev/null +++ b/cmake/nuttx_add_library.cmake @@ -0,0 +1,177 @@ +# ############################################################################## +# cmake/nuttx_add_library.cmake +# +# 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. +# +# ############################################################################## + +# Internal utility function +# +# Used by functions below, not to be used directly + +function(nuttx_add_library_internal target) + # ensure nuttx_context is created before this + add_dependencies(${target} nuttx_context) + + # add main include directories + target_include_directories( + ${target} SYSTEM + PUBLIC ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include + ${CMAKE_BINARY_DIR}/include_arch) + + # Set global compile options & definitions We use the "nuttx" target to hold + # these properties so that libraries added after this property is set can read + # the final value at build time. The GENEX_EVAL allows the property to hold + # generator expression itself + target_compile_options( + ${target} + PRIVATE $>) + target_compile_definitions( + ${target} PRIVATE $>) + target_include_directories( + ${target} + PRIVATE $>) +endfunction() + +# Auxiliary libraries +# +# The whole purpose of this is to overcome the limitation of CMake 3.16 to set +# source file properties from directories different from the one defining the +# target where the source file is used. This auxiliary library acts as an +# intermediate target that is usually linked to the system/kernel library +# defined at a higher level. + +function(nuttx_add_aux_library target) + # declare target + add_library(${target} OBJECT ${ARGN}) + + nuttx_add_library_internal(${target} ${ARGN}) +endfunction() + +# User (application) libraries +# +# An user library is a target which is defined as a collection of object files +# which is ultimately archived into the apps library + +function(nuttx_add_user_library target) + # declare target + add_library(${target} OBJECT ${ARGN}) + + nuttx_add_library_internal(${target} ${ARGN}) + + # link to final libapps + target_link_libraries(apps INTERFACE ${target}) + + # add apps/include to include path + target_include_directories(${target} INTERFACE ${NUTTX_APPS_DIR}/include) +endfunction() + +# System Libraries +# +# A system library is a library which is built into the OS but does not receive +# kernel-level flags (such as __KERNEL__). This is will be part of the userspace +# blob in kernel builds + +function(nuttx_add_system_library target) + # declare target + add_library(${target} ${ARGN}) + + # add library to build + nuttx_add_library_internal(${target} ${ARGN}) + + # add to list of libraries to link to final nuttx binary + set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target}) + + # install to library dir + install(TARGETS ${target} DESTINATION lib) +endfunction() + +# Kernel Libraries +# +# nuttx_add_kernel_library(target [SPLIT] [SAME_SOURCES] [sources ...]) +# +# For non-kernel builds, this defines an OS library which will receive +# kernel-level flags (such as __KERNEL__) and will be linked into nuttx binary +# For kernel builds, the same happens unless SPLIT is specified. In this case +# both a and a k library will be defined, but only the latter +# having the kernel-level flags. In this case, both libraries will receive the +# same set of sources (the original should be used by the user to add +# sources). + +function(nuttx_add_kernel_library target) + cmake_parse_arguments(ARGS SPLIT "" "" ${ARGN}) + set(SRCS ${ARGS_UNPARSED_ARGUMENTS}) + + if(ARGS_SPLIT AND NOT CONFIG_BUILD_FLAT) + set(kernel_target k${target}) + + # add non-kernel (system) library + nuttx_add_system_library(${target} ${SRCS}) + else() + set(kernel_target ${target}) + endif() + + # add kernel library + add_library(${kernel_target} ${SRCS}) + nuttx_add_library_internal(${kernel_target} ${SRCS}) + set_property(GLOBAL APPEND PROPERTY NUTTX_KERNEL_LIBRARIES ${kernel_target}) + + # Add kernel options & definitions See note above in + # nuttx_add_library_internal() on syntax and nuttx target use + target_compile_options( + ${kernel_target} + PRIVATE $>) + target_compile_definitions( + ${kernel_target} + PRIVATE $>) + target_include_directories( + ${kernel_target} + PRIVATE + $>) + + if(NOT "${target}" STREQUAL "${kernel_target}") + # The k${target} lib will have the same sources added to that ${target} lib. + # This allows to do target_sources(${target} ..) easily + target_sources(${kernel_target} + PRIVATE $) + + # same for include directories + target_include_directories( + ${kernel_target} PRIVATE $) + endif() +endfunction() + +include(nuttx_parse_function_args) + +define_property( + GLOBAL + PROPERTY NUTTX_LIBRARIES + BRIEF_DOCS "NuttX libs" + FULL_DOCS "List of all NuttX libraries") + +# ============================================================================= +# +# nuttx_add_library +# +# Wrapper of cmake add_library but with nuttx platform dependencies +# +function(nuttx_add_library target) + add_library(${target} ${ARGN}) + + set_property(GLOBAL APPEND PROPERTY NUTTX_EXTRA_LIBRARIES ${target}) + + nuttx_add_library_internal(${target}) +endfunction() diff --git a/cmake/nuttx_add_module.cmake b/cmake/nuttx_add_module.cmake new file mode 100644 index 0000000000..94ff71e4c0 --- /dev/null +++ b/cmake/nuttx_add_module.cmake @@ -0,0 +1,57 @@ +# ############################################################################## +# cmake/nuttx_add_module.cmake +# +# 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. +# +# ############################################################################## + +function(nuttx_add_module target) + # Use ELF capable toolchain, by building manually and overwriting the non-elf + # output + if(CMAKE_C_ELF_COMPILER) + add_library(${target} ${ARGN}) + + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND + ${CMAKE_C_ELF_COMPILER} + $ + $ -o ${target} + COMMAND_EXPAND_LISTS) + else() + add_executable(${target} ${ARGN}) + target_link_options( + ${target} PRIVATE + $>) + endif() + + set_property(TARGET ${target} PROPERTY ELF_BINARY + ${CMAKE_CURRENT_BINARY_DIR}/${target}) + + nuttx_add_library_internal(${target}) + + target_compile_options( + ${target} + PRIVATE + $>) + target_compile_definitions( + ${target} + PRIVATE $> + $>) + + install(TARGETS ${target}) +endfunction() diff --git a/cmake/nuttx_add_romfs.cmake b/cmake/nuttx_add_romfs.cmake new file mode 100644 index 0000000000..3c168c4dfe --- /dev/null +++ b/cmake/nuttx_add_romfs.cmake @@ -0,0 +1,158 @@ +# ############################################################################## +# cmake/nuttx_add_romfs.cmake +# +# 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_romfs Generates a ROMFS image in a C array, which is built to an +# OBJECT library. +# +# Parameters: - NAME: determines the romfs label and name of target +# (romfs_${NAME}) - HEADER: option to indicate that a .h file is to be generated +# instead of a .c - PREFIX: optional prefix to add to image name (as +# romfs_${PREFIX}.img) - NONCONST: option to indicate the array should be +# non-const - DEPENDS: list of targets that should be depended on + +function(nuttx_add_romfs) + nuttx_parse_function_args( + FUNC + nuttx_add_romfs + ONE_VALUE + NAME + MOUNTPOINT + PATH + PREFIX + OPTIONS + HEADER + NONCONST + MULTI_VALUE + DEPENDS + RCSRCS + RCRAWS + REQUIRED + NAME + ARGN + ${ARGN}) + + if(NOT PATH AND NOT FILES) + message(FATAL_ERROR "Either PATH or FILES must be specified") + endif() + + foreach(rcsrc ${RCSRCS}) + get_filename_component(rcpath ${rcsrc} DIRECTORY) + add_custom_command( + OUTPUT ${rcsrc} + COMMAND ${CMAKE_COMMAND} -E make_directory ${rcpath} + COMMAND + ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -E -P -x c + -I${CMAKE_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/${rcsrc} > + ${rcsrc} + DEPENDS nuttx_context ${CMAKE_CURRENT_SOURCE_DIR}/${rcsrc}) + list(APPEND DEPENDS ${rcsrc}) + endforeach() + + foreach(rcraw ${RCRAWS}) + get_filename_component(absrcraw ${rcraw} ABSOLUTE) + if(IS_DIRECTORY ${absrcraw}) + file( + GLOB subdir + LIST_DIRECTORIES false + ${rcraws} ${rcraw}) + foreach(rcraw ${rcraws}) + list(APPEND DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${rcraw}) + configure_file(${rcraw} ${CMAKE_CURRENT_BINARY_DIR}/${rcraw} COPYONLY) + endforeach() + else() + list(APPEND DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${rcraw}) + configure_file(${rcraw} ${CMAKE_CURRENT_BINARY_DIR}/${rcraw} COPYONLY) + endif() + endforeach() + + if(HEADER) + set(EXTENSION h) + else() + set(EXTENSION c) + endif() + + if(PREFIX) + set(IMGNAME ${PREFIX}.img) + else() + set(IMGNAME romfs.img) + endif() + + add_custom_command( + OUTPUT romfs_${NAME}.${EXTENSION} + COMMAND ${CMAKE_COMMAND} -E make_directory romfs_${NAME} + COMMAND if \[ \"${PATH}\" != \"\" \]; then ${CMAKE_COMMAND} -E + copy_directory ${PATH} romfs_${NAME} \; fi + COMMAND genromfs -f ${IMGNAME} -d romfs_${NAME} -V ${NAME} + COMMAND xxd -i ${IMGNAME} romfs_${NAME}.${EXTENSION} + COMMAND ${CMAKE_COMMAND} -E remove ${IMGNAME} + COMMAND ${CMAKE_COMMAND} -E remove_directory romfs_${NAME} + COMMAND if ! [ -z "${NONCONST}" ]\; then sed -E -i'' -e + "s/^unsigned/const unsigned/g" romfs_${NAME}.${EXTENSION} \; fi + DEPENDS ${DEPENDS}) + + if(NOT HEADER) + add_custom_target(target-romfs DEPENDS ${DEPENDS}) + nuttx_add_aux_library(romfs_${NAME}) + target_sources(romfs_${NAME} PRIVATE romfs_${NAME}.${EXTENSION}) + add_dependencies(romfs_${NAME} target-romfs) + endif() +endfunction() + +# nuttx_add_cromfs Generates a CROMFS image in a C array, which is built to an +# OBJECT library. +# +# Parameters: - NAME: determines the name of target (cromfs_${NAME}) - PATH: the +# directory that will be used to create the CROMFS - FILES: paths to files to +# copy into CROMFS - DEPENDS: list of targets that should be depended on + +function(nuttx_add_cromfs) + nuttx_parse_function_args( + FUNC + nuttx_add_cromfs + ONE_VALUE + NAME + MOUNTPOINT + PATH + MULTI_VALUE + DEPENDS + FILES + OPTIONS + REQUIRED + NAME + ARGN + ${ARGN}) + + if(NOT PATH AND NOT FILES) + message(FATAL_ERROR "Either PATH or FILES must be specified") + endif() + + add_custom_command( + OUTPUT cromfs_${NAME}.c + COMMAND ${CMAKE_COMMAND} -E make_directory cromfs_${NAME} + COMMAND if \[ \"${PATH}\" != \"\" \]; then ${CMAKE_COMMAND} -E + copy_directory ${PATH} cromfs_${NAME} \; fi + COMMAND if \[ \"${FILES}\" != \"\" \]; then ${CMAKE_COMMAND} -E copy + ${FILES} cromfs_${NAME} \; fi + COMMAND ${CMAKE_BINARY_DIR}/bin/gencromfs cromfs_${NAME} cromfs_${NAME}.c + DEPENDS ${DEPENDS}) + + add_library(cromfs_${NAME} OBJECT cromfs_${NAME}.c) + nuttx_add_library_internal(cromfs_${NAME}) +endfunction() diff --git a/cmake/nuttx_add_subdirectory.cmake b/cmake/nuttx_add_subdirectory.cmake new file mode 100644 index 0000000000..49c5da90ba --- /dev/null +++ b/cmake/nuttx_add_subdirectory.cmake @@ -0,0 +1,32 @@ +# ############################################################################## +# cmake/nuttx_add_subdirectory.cmake +# +# 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. +# +# ############################################################################## + +function(nuttx_add_subdirectory) + file( + GLOB subdir + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_LIST_DIR} + ${CMAKE_CURRENT_LIST_DIR}/*/CMakeLists.txt) + + foreach(dir ${subdir}) + get_filename_component(dir ${dir} DIRECTORY) + add_subdirectory(${dir}) + endforeach() +endfunction() diff --git a/cmake/nuttx_add_symtab.cmake b/cmake/nuttx_add_symtab.cmake new file mode 100644 index 0000000000..e3f1d42404 --- /dev/null +++ b/cmake/nuttx_add_symtab.cmake @@ -0,0 +1,103 @@ +# ############################################################################## +# cmake/nuttx_add_symtab.cmake +# +# 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_symtab Generates a symbol table of undefined symbols from a set of +# binaries +# +# Parameters: - NAME: name of symtab (output will be symtab_${NAME}.c) - +# BINARIES: list of binary target names to process (dependencies will be added +# to these targets) - PREFIX: optional prefix to add to symtab variable name - +# EXCLUDE: optional list of symbols to exclude (ie: assume they are defined) + +function(nuttx_add_symtab) + nuttx_parse_function_args( + FUNC + nuttx_add_symtab + ONE_VALUE + NAME + PREFIX + OPTIONS + HEADER + MULTI_VALUE + EXCLUDE + BINARIES + REQUIRED + NAME + BINARIES + ARGN + ${ARGN}) + + # get path to binaries + set(BINARY_PATHS) + foreach(binary ${BINARIES}) + # this way of getting the path will select the actual ELF binary, even when + # this was built by means of an intermediate library on non-ELF platforms + list(APPEND BINARY_PATHS $) + endforeach() + + if(EXCLUDE) + string(REPLACE ";" " " EXCLUDE_STRING ${EXCLUDE}) + endif() + + # generate list of undefined symbols + add_custom_command( + OUTPUT symtab_${NAME}.dat + COMMAND ${CMAKE_NM} ${BINARY_PATHS} | fgrep ' U ' | sed -e "s/^[ ]*//g" | + cut -d' ' -f2 | sort | uniq > symtab_${NAME}.dat + COMMAND + if [ \"${EXCLUDE}\" != \"\" ]\; then fgrep -v -x ${EXCLUDE_STRING} + symtab_${NAME}.dat > symtab_${NAME}.dat2\; mv symtab_${NAME}.dat2 + symtab_${NAME}.dat\; fi + DEPENDS ${BINARIES}) + + add_custom_target(symtab_${NAME}_dat DEPENDS symtab_${NAME}.dat) + + # generate declarations for symbols and symtab entries as headers + add_custom_command( + OUTPUT symtab_${NAME}_declarations.h symtab_${NAME}_entries.h + COMMAND sed -E 's|\(.+\)|extern void *\\1\;|g' symtab_${NAME}.dat > + symtab_${NAME}_declarations.h + COMMAND sed -E 's|\(.+\)|{ \"\\1\", \\&\\1 },|g' symtab_${NAME}.dat > + symtab_${NAME}_entries.h + DEPENDS symtab_${NAME}_dat) + + # generate code which instantiates the symbol table + configure_file(${CMAKE_SOURCE_DIR}/cmake/symtab.c.in symtab_${NAME}.c @ONLY) + + # define an internal library to build the symtab file on its own + add_library(symtab_${NAME} OBJECT + ${CMAKE_CURRENT_BINARY_DIR}/symtab_${NAME}.c) + + # Make the dependance between .c and .h explicit. This is necessary since + # using configure_file() does not seem to allow this to be automatically + # guessed by CMake + set_property( + SOURCE ${CMAKE_CURRENT_BINARY_DIR}/symtab_${NAME}.c + APPEND + PROPERTY OBJECT_DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/symtab_${NAME}_declarations.h + ${CMAKE_CURRENT_BINARY_DIR}/symtab_${NAME}_entries.h) + + nuttx_add_library_internal(symtab_${NAME}) + + if(PREFIX) + target_compile_definitions(symtab_${NAME} PRIVATE -DSYMTAB_PREFIX=${PREFIX}) + endif() +endfunction() diff --git a/cmake/nuttx_create_symlink.cmake b/cmake/nuttx_create_symlink.cmake new file mode 100644 index 0000000000..6d3a5f3934 --- /dev/null +++ b/cmake/nuttx_create_symlink.cmake @@ -0,0 +1,27 @@ +# ############################################################################## +# cmake/nuttx_create_symlink.cmake +# +# 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. +# +# ############################################################################## + +function(nuttx_create_symlink old new) + if(IS_DIRECTORY ${old} AND WIN32) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${old} ${new}) + else() + file(CREATE_LINK ${old} ${new} COPY_ON_ERROR SYMBOLIC) + endif() +endfunction() diff --git a/cmake/nuttx_generate_headers.cmake b/cmake/nuttx_generate_headers.cmake new file mode 100644 index 0000000000..b4a2049e47 --- /dev/null +++ b/cmake/nuttx_generate_headers.cmake @@ -0,0 +1,149 @@ +# ############################################################################## +# cmake/nuttx_generate_headers.cmake +# +# 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. +# +# ############################################################################## + +# setup target to generate config.h and version.h from mkconfig and mkversion + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/nuttx) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/nuttx) +endif() + +include(nuttx_mkconfig) +include(nuttx_mkversion) + +# Setup symbolic link generation + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/include_arch/arch) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_apps) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_BINARY_DIR}/include_apps) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include/arch) + nuttx_create_symlink(${NUTTX_DIR}/arch/${CONFIG_ARCH}/include + ${CMAKE_BINARY_DIR}/include/arch) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch/board) + nuttx_create_symlink(${NUTTX_BOARD_DIR}/include + ${CMAKE_BINARY_DIR}/include_arch/arch/board) +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/include_arch/arch/chip) + if(CONFIG_ARCH_CHIP_CUSTOM) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CHIP_ABS_DIR}/include + ${CMAKE_BINARY_DIR}/include_arch/arch/chip) + else() + execute_process( + COMMAND + ${CMAKE_COMMAND} -E copy_directory + ${NUTTX_DIR}/arch/${CONFIG_ARCH}/include/${CONFIG_ARCH_CHIP} + ${CMAKE_BINARY_DIR}/include_arch/arch/chip) + endif() +endif() + +# Optional symbolic links + +# Target used to copy include/nuttx/lib/stdarg.h. If CONFIG_ARCH_STDARG_H is +# defined, then there is an architecture specific stdarg.h header file that will +# be included indirectly from include/lib/stdarg.h. But first, we have to copy +# stdarg.h from include/nuttx/. to include/. + +if(CONFIG_ARCH_STDARG_H) + nuttx_create_symlink(${NUTTX_DIR}/include/nuttx/lib/stdarg.h + ${CMAKE_BINARY_DIR}/include/stdarg.h) +else() + file(REMOVE ${CMAKE_BINARY_DIR}/include/stdarg.h) +endif() + +# Target used to copy include/nuttx/lib/math.h. If CONFIG_ARCH_MATH_H is +# defined, then there is an architecture specific math.h header file that will +# be included indirectly from include/math.h. But first, we have to copy math.h +# from include/nuttx/. to include/. Logic within include/nuttx/lib/math.h will +# hand the redirection to the architecture- specific math.h header file. +# +# If the CONFIG_LIBM is defined, the Rhombus libm will be built at libc/math. +# Definitions and prototypes for the Rhombus libm are also contained in +# include/nuttx/lib/math.h and so the file must also be copied in that case. +# +# If neither CONFIG_ARCH_MATH_H nor CONFIG_LIBM is defined, then no math.h +# header file will be provided. You would want that behavior if (1) you don't +# use libm, or (2) you want to use the math.h and libm provided within your +# toolchain. + +if(CONFIG_ARCH_MATH_H OR CONFIG_LIBM) + set(NEED_MATH_H true) +endif() + +if(NEED_MATH_H) + nuttx_create_symlink(${NUTTX_DIR}/include/nuttx/lib/math.h + ${CMAKE_BINARY_DIR}/include/math.h) +else() + file(REMOVE ${CMAKE_BINARY_DIR}/include/math.h) +endif() + +# The float.h header file defines the properties of your floating point +# implementation. It would always be best to use your toolchain's float.h +# header file but if none is available, a default float.h header file will +# provided if this option is selected. However there is no assurance that the +# settings in this float.h are actually correct for your platform! + +if(CONFIG_ARCH_FLOAT_H) + nuttx_create_symlink(${NUTTX_DIR}/include/nuttx/lib/float.h + ${CMAKE_BINARY_DIR}/include/float.h) +else() + file(REMOVE ${CMAKE_BINARY_DIR}/include/float.h) +endif() + +# Target used to copy include/nuttx/lib/setjmp.h. If CONFIG_ARCH_SETJMP_H is +# defined, then there is an architecture specific setjmp.h header file that will +# be included indirectly from include/lib/setjmp.h. But first, we have to copy +# setjmp.h from include/nuttx/. to include/. + +if(CONFIG_ARCH_SETJMP_H) + nuttx_create_symlink(${NUTTX_DIR}/include/nuttx/lib/setjmp.h + ${CMAKE_BINARY_DIR}/include/setjmp.h) +else() + file(REMOVE ${CMAKE_BINARY_DIR}/include/setjmp.h) +endif() + +# Add final context target that ties together all of the above The context +# target is invoked on each target build to assure that NuttX is properly +# configured. The basic configuration steps include creation of the the +# config.h and version.h header files in the include/nuttx directory and the +# establishment of symbolic links to configured directories. + +add_custom_target( + nuttx_context + DEPENDS + ${CMAKE_BINARY_DIR}/include/nuttx/config.h + ${CMAKE_BINARY_DIR}/include/nuttx/version.h + $<$:${CMAKE_BINARY_DIR}/include/stdarg.h> + $<$:${CMAKE_BINARY_DIR}/include/math.h> + $<$:${CMAKE_BINARY_DIR}/include/float.h> + $<$:${CMAKE_BINARY_DIR}/include/setjmp.h>) diff --git a/cmake/nuttx_generate_outputs.cmake b/cmake/nuttx_generate_outputs.cmake new file mode 100644 index 0000000000..4cc2f3036f --- /dev/null +++ b/cmake/nuttx_generate_outputs.cmake @@ -0,0 +1,48 @@ +# ############################################################################## +# cmake/nuttx_generate_outputs.cmake +# +# 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. +# +# ############################################################################## + +function(nuttx_generate_outputs target) + if(CONFIG_INTELHEX_BINARY) + add_custom_command( + OUTPUT ${target}.hex + COMMAND ${CMAKE_OBJCOPY} -O ihex ${target} ${target}.hex + DEPENDS ${target}) + add_custom_target(${target}-hex ALL DEPENDS ${target}.hex) + file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.hex\n") + endif() + + if(CONFIG_MOTOROLA_SREC) + add_custom_command( + OUTPUT ${target}.srec + COMMAND ${CMAKE_OBJCOPY} -O srec ${target} ${target}.srec + DEPENDS ${target}) + add_custom_target(${target}-srec ALL DEPENDS ${target}.srec) + file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.srec\n") + endif() + + if(CONFIG_RAW_BINARY) + add_custom_command( + OUTPUT ${target}.bin + COMMAND ${CMAKE_OBJCOPY} -O binary ${target} ${target}.bin + DEPENDS ${target}) + add_custom_target(${target}-bin ALL DEPENDS ${target}.bin) + file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.bin\n") + endif() +endfunction(nuttx_generate_outputs) diff --git a/cmake/nuttx_kconfig.cmake b/cmake/nuttx_kconfig.cmake new file mode 100644 index 0000000000..7858f379c9 --- /dev/null +++ b/cmake/nuttx_kconfig.cmake @@ -0,0 +1,127 @@ +# ############################################################################## +# cmake/nuttx_kconfig.cmake +# +# 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. +# +# ############################################################################## + +function(nuttx_export_kconfig_by_value kconfigfile config) + file(STRINGS ${kconfigfile} ConfigContents) + foreach(NameAndValue ${ConfigContents}) + string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue}) + string(REGEX MATCH "^CONFIG[^=]+" Name ${NameAndValue}) + if(Name STREQUAL ${config}) + string(REPLACE "${Name}=" "" Value ${NameAndValue}) + string(REPLACE "\"" "" Value ${Value}) + set(${Name} + ${Value} + PARENT_SCOPE) + break() + endif() + endforeach() +endfunction() + +function(nuttx_export_kconfig kconfigfile) + file(STRINGS ${kconfigfile} ConfigContents) + foreach(NameAndValue ${ConfigContents}) + # Strip leading spaces + string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue}) + + # Find variable name + string(REGEX MATCH "^CONFIG[^=]+" Name ${NameAndValue}) + + if(Name) + # Find the value + string(REPLACE "${Name}=" "" Value ${NameAndValue}) + + # remove extra quotes + string(REPLACE "\"" "" Value ${Value}) + + # Set the variable + set(${Name} + ${Value} + PARENT_SCOPE) + endif() + endforeach() + + # Compatibility for symbols usually user-settable (now, set via env vars) + # TODO: change usage of these symbols into the corresponding cmake variables + if(LINUX) + set(CONFIG_HOST_LINUX + true + PARENT_SCOPE) + elseif(APPLE) + set(CONFIG_HOST_MACOS + true + PARENT_SCOPE) + elseif(WIN32) + set(CONFIG_HOST_WINDOWS + true + PARENT_SCOPE) + else() + set(CONFIG_HOST_OTHER + true + PARENT_SCOPE) + endif() +endfunction() + +function(nuttx_generate_kconfig) + nuttx_parse_function_args( + FUNC + nuttx_generate_kconfig + ONE_VALUE + MENUDESC + REQUIRED + ARGN + ${ARGN}) + if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" + OR EXISTS "${NUTTX_APPS_BINDIR}/Kconfig") + return() + endif() + + set(KCONFIG_OUTPUT_FILE) + if(MENUDESC) + string(REPLACE "/" "_" KCONFIG_PREFIX ${CMAKE_CURRENT_LIST_DIR}) + if(WIN32) + string(REPLACE ":" "_" KCONFIG_PREFIX ${KCONFIG_PREFIX}) + endif() + string(APPEND KCONFIG_OUTPUT_FILE ${NUTTX_APPS_BINDIR} "/" + ${KCONFIG_PREFIX} "_Kconfig") + file(WRITE ${KCONFIG_OUTPUT_FILE} "menu \"${MENUDESC}\"\n") + else() + set(KCONFIG_OUTPUT_FILE ${NUTTX_APPS_BINDIR}/Kconfig) + file( + GLOB subdir + LIST_DIRECTORIES false + ${NUTTX_APPS_BINDIR} ${NUTTX_APPS_BINDIR}/*_Kconfig) + foreach(dir ${subdir}) + file(APPEND ${KCONFIG_OUTPUT_FILE} "source \"${dir}\"\n") + endforeach() + endif() + + file( + GLOB subdir + LIST_DIRECTORIES false + ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*/Kconfig) + + foreach(dir ${subdir}) + file(APPEND ${KCONFIG_OUTPUT_FILE} "source \"${dir}\"\n") + endforeach() + + if(MENUDESC) + file(APPEND ${KCONFIG_OUTPUT_FILE} "endmenu # ${MENUDESC}\n") + endif() +endfunction() diff --git a/cmake/nuttx_mkconfig.cmake b/cmake/nuttx_mkconfig.cmake new file mode 100644 index 0000000000..19aeee494b --- /dev/null +++ b/cmake/nuttx_mkconfig.cmake @@ -0,0 +1,139 @@ +# ############################################################################## +# cmake/nuttx_mkconfig.cmake +# +# 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. +# +# ############################################################################## + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config) + return() +endif() + +if(NOT EXISTS ${CMAKE_BINARY_DIR}/.config.prev) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/.config + ${CMAKE_BINARY_DIR}/.config.prev + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +endif() + +execute_process( + COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_BINARY_DIR}/.config + ${CMAKE_BINARY_DIR}/.config.prev + RESULT_VARIABLE COMPARE_RESULT + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + +set(CONFIG_H ${CMAKE_BINARY_DIR}/include/nuttx/config.h) +if(COMPARE_RESULT EQUAL 0 AND EXISTS ${CONFIG_H}) + return() +endif() + +set(DEQUOTELIST + # NuttX + "CONFIG_DEBUG_OPTLEVEL" # Custom debug level + "CONFIG_EXECFUNCS_NSYMBOLS_VAR" # Variable holding number of symbols in the + # table + "CONFIG_EXECFUNCS_SYMTAB_ARRAY" # Symbol table array used by exec[l|v] + "CONFIG_INIT_ARGS" # Argument list of entry point + "CONFIG_INIT_SYMTAB" # Global symbol table + "CONFIG_INIT_NEXPORTS" # Global symbol table size + "CONFIG_INIT_ENTRYPOINT" # Name of entry point function + "CONFIG_MODLIB_SYMTAB_ARRAY" # Symbol table array used by modlib functions + "CONFIG_MODLIB_NSYMBOLS_VAR" # Variable holding number of symbols in the + # table + "CONFIG_PASS1_BUILDIR" # Pass1 build directory + "CONFIG_PASS1_TARGET" # Pass1 build target + "CONFIG_PASS1_OBJECT" # Pass1 build object + "CONFIG_TTY_LAUNCH_ENTRYPOINT" # Name of entry point from tty launch + "CONFIG_TTY_LAUNCH_ARGS" # Argument list of entry point from tty launch + # NxWidgets/NxWM + "CONFIG_NXWM_BACKGROUND_IMAGE" # Name of bitmap image class + "CONFIG_NXWM_CALIBRATION_ICON" # Name of bitmap image class + "CONFIG_NXWM_HEXCALCULATOR_ICON" # Name of bitmap image class + "CONFIG_NXWM_MINIMIZE_BITMAP" # Name of bitmap image class + "CONFIG_NXWM_NXTERM_ICON" # Name of bitmap image class + "CONFIG_NXWM_STARTWINDOW_ICON" # Name of bitmap image class + "CONFIG_NXWM_STOP_BITMAP" # Name of bitmap image class + # apps/ definitions + "CONFIG_NSH_SYMTAB_ARRAYNAME" # Symbol table array name + "CONFIG_NSH_SYMTAB_COUNTNAME" # Name of the variable holding the + # number of symbols +) + +file(WRITE ${CONFIG_H} "/* config.h -- Autogenerated! Do not edit. */\n\n") +file(APPEND ${CONFIG_H} "#ifndef __INCLUDE_NUTTX_CONFIG_H\n") +file(APPEND ${CONFIG_H} "#define __INCLUDE_NUTTX_CONFIG_H\n\n") +file(APPEND ${CONFIG_H} + "/* Used to represent the values of tristate options */\n\n") +file(APPEND ${CONFIG_H} "#define CONFIG_y 1\n") +file(APPEND ${CONFIG_H} "#define CONFIG_m 2\n\n") +file(APPEND ${CONFIG_H} + "/* General Definitions ***********************************/\n") + +file(STRINGS ${CMAKE_BINARY_DIR}/.config ConfigContents) +foreach(NameAndValue ${ConfigContents}) + string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue}) + string(REGEX MATCH "^CONFIG[^=]+" NAME ${NameAndValue}) + string(REPLACE "${NAME}=" "" VALUE ${NameAndValue}) + + if(NAME AND NOT "${VALUE}" STREQUAL "") + if(${VALUE} STREQUAL "y") + file(APPEND ${CONFIG_H} "#define ${NAME} 1\n") + elseif(${VALUE} STREQUAL "m") + file(APPEND ${CONFIG_H} "#define ${NAME} 2\n") + elseif(${VALUE} STREQUAL "n") + file(APPEND ${CONFIG_H} "#undef ${NAME}\n") + else() + foreach(dequote ${DEQUOTELIST}) + if("${NAME}" STREQUAL "${dequote}") + if(NOT "${VALUE}" STREQUAL "\"\"") + string(REGEX REPLACE "\"" "" VALUE ${VALUE}) + else() + set(VALUE) + file(APPEND ${CONFIG_H} "#undef ${NAME}\n") + endif() + break() + endif() + endforeach() + if(NOT "${VALUE}" STREQUAL "") + file(APPEND ${CONFIG_H} "#define ${NAME} ${VALUE}\n") + endif() + endif() + endif() +endforeach() + +file(APPEND ${CONFIG_H} + "\n/* Sanity Checks *****************************************/\n\n") +file(APPEND ${CONFIG_H} + "/* If the end of RAM is not specified then it is assumed to be\n") +file(APPEND ${CONFIG_H} " * the beginning of RAM plus the RAM size.\n") +file(APPEND ${CONFIG_H} " */\n\n") +file(APPEND ${CONFIG_H} "#ifndef CONFIG_RAM_END\n") +file(APPEND ${CONFIG_H} + "# define CONFIG_RAM_END (CONFIG_RAM_START+CONFIG_RAM_SIZE)\n") +file(APPEND ${CONFIG_H} "#endif\n\n") +file(APPEND ${CONFIG_H} "#ifndef CONFIG_RAM_VEND\n") +file(APPEND ${CONFIG_H} + "# define CONFIG_RAM_VEND (CONFIG_RAM_VSTART+CONFIG_RAM_SIZE)\n") +file(APPEND ${CONFIG_H} "#endif\n\n") +file(APPEND ${CONFIG_H} + "/* If the end of FLASH is not specified then it is assumed to be\n") +file(APPEND ${CONFIG_H} " * the beginning of FLASH plus the FLASH size.\n") +file(APPEND ${CONFIG_H} " */\n\n") +file(APPEND ${CONFIG_H} "#ifndef CONFIG_FLASH_END\n") +file(APPEND ${CONFIG_H} + "# define CONFIG_FLASH_END (CONFIG_FLASH_START+CONFIG_FLASH_SIZE)\n") +file(APPEND ${CONFIG_H} "#endif\n\n") +file(APPEND ${CONFIG_H} "#endif /* __INCLUDE_NUTTX_CONFIG_H */\n") diff --git a/cmake/nuttx_mkversion.cmake b/cmake/nuttx_mkversion.cmake new file mode 100644 index 0000000000..94b1c81b7a --- /dev/null +++ b/cmake/nuttx_mkversion.cmake @@ -0,0 +1,110 @@ +# ############################################################################## +# cmake/nuttx_mkversion.cmake +# +# 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(VERSION_H ${CMAKE_BINARY_DIR}/include/nuttx/version.h) +if(EXISTS ${VERSION_H}) + return() +endif() + +execute_process( + COMMAND git -C ${NUTTX_DIR} describe --match "nuttx-*" + WORKING_DIRECTORY ${NUTTX_DIR} + OUTPUT_VARIABLE NUTTX_VERSION + RESULT_VARIABLE VERSION_STATUS) + +if(${VERSION_STATUS} AND NOT ${VERSION_STATUS} EQUAL 0) + set(NUTTX_VERSION "0.0.0") +else() + string(REPLACE "-" ";" NUTTX_VERSION ${NUTTX_VERSION}) + list(GET NUTTX_VERSION 1 NUTTX_VERSION) +endif() + +string(REPLACE "." ";" NUTTX_CHECK_VERSION ${NUTTX_VERSION}) +list(LENGTH NUTTX_CHECK_VERSION NUTTX_VERSION_LENGTH) +if(${NUTTX_VERSION_LENGTH} LESS 3) + execute_process( + COMMAND git -C ${NUTTX_DIR} -c "versionsort.suffix=-" tag --sort=v:refname + WORKING_DIRECTORY ${NUTTX_DIR} + OUTPUT_VARIABLE NUTTX_VERSION_LIST + RESULT_VARIABLE VERSION_STATUS) + + if(${VERSION_STATUS} EQUAL 0) + string(REPLACE "\n" ";" NUTTX_VERSION_LIST ${NUTTX_VERSION_LIST}) + foreach(version ${NUTTX_VERSION_LIST}) + string(REGEX MATCH "nuttx-[0-9]+\.[0-9]+\.[0-9]+" NUTTX_CHECK_VERSION + ${version}) + if(NUTTX_CHECK_VERSION) + string(REPLACE "-" ";" NUTTX_VERSION ${NUTTX_CHECK_VERSION}) + list(GET NUTTX_VERSION 1 NUTTX_VERSION) + endif() + endforeach() + endif() +endif() + +execute_process( + COMMAND git -C ${NUTTX_DIR} log --oneline -1 + WORKING_DIRECTORY ${NUTTX_DIR} + OUTPUT_VARIABLE NUTTX_VERSION_BUILD + RESULT_VARIABLE VERSION_STATUS) + +if(${VERSION_STATUS} AND NOT ${VERSION_STATUS} EQUAL 0) + set(NUTTX_VERSION_BUILD) +else() + string(REPLACE " " ";" NUTTX_VERSION_BUILD ${NUTTX_VERSION_BUILD}) + list(GET NUTTX_VERSION_BUILD 0 NUTTX_VERSION_BUILD) + + execute_process( + COMMAND git -C ${NUTTX_DIR} diff-index --name-only HEAD + WORKING_DIRECTORY ${NUTTX_DIR} + OUTPUT_VARIABLE NUTTX_VERSION_BUILD_DIRTY) + + if(NUTTX_VERSION_BUILD_DIRTY) + set(NUTTX_VERSION_BUILD ${NUTTX_VERSION_BUILD}-dirty) + endif() +endif() + +file(WRITE ${VERSION_H} "/* version.h -- Autogenerated! Do not edit. */\n\n") + +file(APPEND ${VERSION_H} "#ifndef __INCLUDE_NUTTX_VERSION_H\n") +file(APPEND ${VERSION_H} "#define __INCLUDE_NUTTX_VERSION_H\n\n") +file(APPEND ${VERSION_H} "#define CONFIG_VERSION_STRING \"${NUTTX_VERSION}\"\n") + +string(REPLACE "." ";" NUTTX_VERSION ${NUTTX_VERSION}) + +list(GET NUTTX_VERSION 0 NUTTX_VERSION_MAJOR) +list(GET NUTTX_VERSION 1 NUTTX_VERSION_MINOR) +list(GET NUTTX_VERSION 2 NUTTX_VERSION_PATCH) + +file(APPEND ${VERSION_H} + "#define CONFIG_VERSION_MAJOR ${NUTTX_VERSION_MAJOR}\n") +file(APPEND ${VERSION_H} + "#define CONFIG_VERSION_MINOR ${NUTTX_VERSION_MINOR}\n") +file(APPEND ${VERSION_H} + "#define CONFIG_VERSION_PATCH ${NUTTX_VERSION_PATCH}\n") +file(APPEND ${VERSION_H} + "#define CONFIG_VERSION_BUILD \"${NUTTX_VERSION_BUILD}\"\n\n") + +file( + APPEND ${VERSION_H} + "#define CONFIG_VERSION ((CONFIG_VERSION_MAJOR << 16) | \\ + (CONFIG_VERSION_MINOR << 8) | \\ + (CONFIG_VERSION_PATCH))\n") + +file(APPEND ${VERSION_H} "\n#endif /* __INCLUDE_NUTTX_VERSION_H */\n") diff --git a/cmake/nuttx_parse_function_args.cmake b/cmake/nuttx_parse_function_args.cmake new file mode 100644 index 0000000000..bcebeda9d9 --- /dev/null +++ b/cmake/nuttx_parse_function_args.cmake @@ -0,0 +1,84 @@ +# ############################################################################## +# cmake/nuttx_parse_function_args.cmake +# +# 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. +# +# ############################################################################## + +# ============================================================================= +# +# Defined functions in this file +# +# utility functions +# +# * nuttx_parse_function_args +# + +include(CMakeParseArguments) + +# ============================================================================= +# +# nuttx_parse_function_args +# +# This function simplifies usage of the cmake_parse_arguments module. It is +# intended to be called by other functions. +# +# Usage: nuttx_parse_function_args( FUNC [ OPTIONS ] [ ONE_VALUE +# ] [ MULTI_VALUE ] REQUIRED ARGN ) +# +# Input: FUNC : the name of the calling function OPTIONS : boolean flags +# ONE_VALUE : single value variables MULTI_VALUE : multi value variables +# REQUIRED : required arguments ARGN : the function input arguments, +# typically ${ARGN} +# +# Output: The function arguments corresponding to the following are set: +# ${OPTIONS}, ${ONE_VALUE}, ${MULTI_VALUE} +# +# Example: function test() nuttx_parse_function_args( FUNC TEST ONE_VALUE NAME +# MULTI_VALUE LIST REQUIRED NAME LIST ARGN ${ARGN}) message(STATUS "name: +# ${NAME}") message(STATUS "list: ${LIST}") endfunction() +# +# test(NAME "hello" LIST a b c) +# +# OUTPUT: name: hello list: a b c +# +function(nuttx_parse_function_args) + + cmake_parse_arguments(IN "" "FUNC" + "OPTIONS;ONE_VALUE;MULTI_VALUE;REQUIRED;ARGN" "${ARGN}") + cmake_parse_arguments(OUT "${IN_OPTIONS}" "${IN_ONE_VALUE}" + "${IN_MULTI_VALUE}" "${IN_ARGN}") + + if(OUT_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "${IN_NAME}: unparsed ${OUT_UNPARSED_ARGUMENTS}") + endif() + + foreach(arg ${IN_REQUIRED}) + if(NOT OUT_${arg}) + if(NOT "${OUT_${arg}}" STREQUAL "0") + message( + FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}") + endif() + endif() + endforeach() + + foreach(arg ${IN_OPTIONS} ${IN_ONE_VALUE} ${IN_MULTI_VALUE}) + set(${arg} + ${OUT_${arg}} + PARENT_SCOPE) + endforeach() + +endfunction() diff --git a/cmake/nuttx_redefine_symbols.cmake b/cmake/nuttx_redefine_symbols.cmake new file mode 100644 index 0000000000..826d4a3eff --- /dev/null +++ b/cmake/nuttx_redefine_symbols.cmake @@ -0,0 +1,146 @@ +# ############################################################################## +# cmake/nuttx_redefine_symbols.cmake +# +# 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(NXSYMBOLS + __cxa_atexit + abort + accept + access + atexit + backtrace + bind + calloc + chmod + chown + clock_gettime + close + closedir + connect + dlsym + dup + exit + fchmod + fchown + fclose + fcntl + fdopen + fopen + fprintf + fread + free + fseek + fstat + fsync + ftell + ftruncate + futimens + fwrite + getpeername + getsockname + getenv + getpid + getsockopt + if_nametoindex + ioctl + listen + longjmp + lseek + malloc + malloc_size + malloc_usable_size + memcpy + mkdir + mmap + mprotect + munmap + open + opendir + perror + poll + posix_memalign + pthread_attr_init + pthread_attr_setstack + pthread_attr_destroy + pthread_cond_destroy + pthread_cond_init + pthread_cond_signal + pthread_cond_wait + pthread_create + pthread_getspecific + pthread_key_create + pthread_kill + pthread_mutex_destroy + pthread_mutex_init + pthread_mutex_lock + pthread_mutex_unlock + pthread_setspecific + pthread_sigmask + puts + read + readdir + readv + realloc + recvfrom + rename + rewinddir + rmdir + sched_yield + select + sendmsg + sendto + setitimer + setbuf + setjmp + setsockopt + shutdown + sigaction + sigaddset + sigemptyset + sigfillset + sleep + socket + stat + statvfs + stderr + strcat + strchr + strerror + strlen + strtol + sysconf + syslog + tcgetattr + tcsetattr + unlink + usleep + utimensat + write + writev) + +set(NXSYMBOL_RENAMES) +foreach(NXSYMBOL ${NXSYMBOLS}) + if(APPLE OR (CYGWIN AND CONFIG_SIM_CYGWIN_DECORATED)) + list(APPEND NXSYMBOL_RENAMES "_${NXSYMBOL} NX${NXSYMBOL}") + else() + list(APPEND NXSYMBOL_RENAMES "${NXSYMBOL} NX${NXSYMBOL}") + endif() +endforeach() +string(REPLACE ";" "\n" NXSYMBOL_RENAMES "${NXSYMBOL_RENAMES}") +file(WRITE ${CMAKE_BINARY_DIR}/nuttx-names.dat "${NXSYMBOL_RENAMES}\n") diff --git a/cmake/symtab.c.in b/cmake/symtab.c.in new file mode 100644 index 0000000000..51576f1108 --- /dev/null +++ b/cmake/symtab.c.in @@ -0,0 +1,54 @@ +/**************************************************************************** + * cmake/symtab.c.in + * + * 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 +#include + +#define _CONCAT(x,y) x ## y +#define CONCAT(x,y) _CONCAT(x,y) + +#include "symtab_@NAME@_declarations.h" + +#ifndef SYMTAB_PREFIX +# if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB) +const struct symtab_s CONFIG_EXECFUNCS_SYMTAB_ARRAY[] = +# elif defined(CONFIG_SYSTEM_NSH_SYMTAB) +const struct symtab_s CONFIG_NSH_SYMTAB_ARRAYNAME[] = +# else +const struct symtab_s dummy_symtab[] = +# endif +#else +const struct symtab_s CONCAT(SYMTAB_PREFIX,_exports)[] = +#endif +{ +#include "symtab_@NAME@_entries.h" +}; + +#ifndef SYMTAB_PREFIX +# if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB) +const int CONFIG_EXECFUNCS_NSYMBOLS_VAR = sizeof(CONFIG_EXECFUNCS_SYMTAB_ARRAY) / sizeof(struct symtab_s); +# elif defined(CONFIG_SYSTEM_NSH_SYMTAB) +const int CONFIG_NSH_SYMTAB_COUNTNAME = sizeof(CONFIG_NSH_SYMTAB_ARRAYNAME) / sizeof(struct symtab_s); +# else +const int dummy_nsymtabs = sizeof(dummy_symtab) / sizeof(struct symtab_s); +# endif +#else +const int CONCAT(SYMTAB_PREFIX,_nexports) = sizeof(CONCAT(SYMTAB_PREFIX,_exports)) / sizeof(struct symtab_s); +#endif diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt new file mode 100644 index 0000000000..f02c9a1567 --- /dev/null +++ b/crypto/CMakeLists.txt @@ -0,0 +1,50 @@ +# ############################################################################## +# crypto/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. +# +# ############################################################################## +if(CONFIG_CRYPTO) + nuttx_add_kernel_library(crypto) + + set(SRCS crypto.c testmngr.c) + + # cryptodev support + + if(CONFIG_CRYPTO_CRYPTODEV) + list(APPEND SRCS cryptodev.c) + endif() + + # Software AES library + + if(CONFIG_CRYPTO_SW_AES) + list(APPEND SRCS aes.c) + endif() + + # BLAKE2s hash algorithm + + if(CONFIG_CRYPTO_BLAKE2S) + list(APPEND SRCS blake2s.c) + endif() + + # Entropy pool random number generator + + if(CONFIG_CRYPTO_RANDOM_POOL) + list(APPEND SRCS random_pool.c) + endif() + + target_sources(crypto PRIVATE ${SRCS}) +endif() diff --git a/drivers/1wire/CMakeLists.txt b/drivers/1wire/CMakeLists.txt new file mode 100644 index 0000000000..79a0cd3127 --- /dev/null +++ b/drivers/1wire/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# drivers/1wire/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. +# +# ############################################################################## + +if(CONFIG_1WIRE) + set(SRCS 1wire.c 1wire_crc.c 1wire_read.c 1wire_write.c 1wire_writeread.c) + + if(CONFIG_1WIRE_DS28E17) + list(APPEND SRCS ds28e17.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt new file mode 100644 index 0000000000..0e81c4df46 --- /dev/null +++ b/drivers/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# drivers/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_kernel_library(drivers) +nuttx_add_subdirectory() +target_sources(drivers PRIVATE drivers_initialize.c) +target_include_directories(drivers PRIVATE ${CMAKE_CURRENT_LIST_DIR}) diff --git a/drivers/analog/CMakeLists.txt b/drivers/analog/CMakeLists.txt new file mode 100644 index 0000000000..3631ef0b73 --- /dev/null +++ b/drivers/analog/CMakeLists.txt @@ -0,0 +1,100 @@ +# ############################################################################## +# drivers/analog/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) + +if(CONFIG_DAC) + # Include the common DAC character driver + list(APPEND SRCS dac.c) + + # Include DAC device drivers + + if(CONFIG_DAC_AD5410) + list(APPEND SRCS ad5410.c) + endif() + + if(CONFIG_DAC7571) + list(APPEND SRCS dac7571.c) + endif() + + if(CONFIG_DAC7554) + list(APPEND SRCS dac7554.c) + endif() + + if(CONFIG_MCP48XX) + list(APPEND SRCS mcp48xx.c) + endif() + +endif() + +# Check for COMP devices + +if(CONFIG_COMP) + # Include the common COMP character driver + list(APPEND SRCS comp.c) +endif() + +# Check for OPAMP devices + +if(CONFIG_OPAMP) + # Include the common OPAMP character driver + list(APPEND SRCS opamp.c) +endif() + +# Check for ADC devices + +if(CONFIG_ADC) + # Include the common ADC character driver + list(APPEND SRCS adc.c) + + # Amplifiers/multiplexers + + if(CONFIG_ADC_PGA11X) + list(APPEND SRCS pga11x.c) + endif() + + # Include ADC device drivers + + if(CONFIG_ADC_ADS1242) + list(APPEND SRCS ads1242.c) + endif() + + if(CONFIG_ADC_ADS125X) + list(APPEND SRCS ads1255.c) + endif() + + if(CONFIG_ADC_ADS7828) + list(APPEND SRCS ads7828.c) + endif() + + if(CONFIG_ADC_MAX1161X) + list(APPEND SRCS max1161x.c) + endif() + + if(CONFIG_ADC_LTC1867L) + list(APPEND SRCS ltc1867l.c) + endif() +endif() + +if(CONFIG_LMP92001) + list(APPEND SRCS lmp92001.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/audio/CMakeLists.txt b/drivers/audio/CMakeLists.txt new file mode 100644 index 0000000000..b4929abe63 --- /dev/null +++ b/drivers/audio/CMakeLists.txt @@ -0,0 +1,88 @@ +# ############################################################################## +# drivers/audio/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. +# +# ############################################################################## +# +# ############################################################################## + +if(CONFIG_DRIVERS_AUDIO) + set(SRCS) + + if(CONFIG_AUDIO_CXD56) + list(APPEND SRCS cxd56.c) + if(CONFIG_AUDIO_CXD56_SRC) + list(APPEND SRCS cxd56_src.c) + endif() + endif() + + if(CONFIG_AUDIO_VS1053) + list(APPEND SRCS vs1053.c) + endif() + + if(CONFIG_AUDIO_CS43L22) + list(APPEND SRCS cs43l22.c) + + if(CONFIG_CS43L22_REGDUMP) + list(APPEND SRCS cs43l22_debug.c) + elseif(CONFIG_CS43L22_CLKDEBUG) + list(APPEND SRCS cs43l22_debug.c) + endif() + endif() + + if(CONFIG_AUDIO_CS4344) + list(APPEND SRCS cs4344.c) + endif() + + if(CONFIG_AUDIO_WM8994) + list(APPEND SRCS wm8994.c) + + if(CONFIG_WM8994_REGDUMP) + list(APPEND SRCS wm8994_debug.c) + elseif(CONFIG_WM8994_CLKDEBUG) + list(APPEND SRCS wm8994_debug.c) + endif() + endif() + + if(CONFIG_AUDIO_WM8904) + list(APPEND SRCS wm8904.c) + + if(CONFIG_WM8904_REGDUMP) + list(APPEND SRCS wm8904_debug.c) + elseif(CONFIG_WM8904_CLKDEBUG) + list(APPEND SRCS wm8904_debug.c) + endif() + endif() + + if(CONFIG_AUDIO_WM8776) + list(APPEND SRCS wm8776.c) + endif() + + if(CONFIG_AUDIO_NULL) + list(APPEND SRCS audio_null.c) + endif() + + if(CONFIG_AUDIO_TONE) + list(APPEND SRCS tone.c) + endif() + + if(CONFIG_AUDIO_I2S) + list(APPEND SRCS audio_i2s.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/bch/CMakeLists.txt b/drivers/bch/CMakeLists.txt new file mode 100644 index 0000000000..542bebc0f4 --- /dev/null +++ b/drivers/bch/CMakeLists.txt @@ -0,0 +1,32 @@ +# ############################################################################## +# drivers/bch/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. +# +# ############################################################################## + +if(CONFIG_BCH) + target_sources( + drivers + PRIVATE bchlib_setup.c + bchlib_teardown.c + bchlib_read.c + bchlib_write.c + bchlib_cache.c + bchdev_register.c + bchdev_unregister.c + bchdev_driver.c) +endif() diff --git a/drivers/can/CMakeLists.txt b/drivers/can/CMakeLists.txt new file mode 100644 index 0000000000..0402b41b4a --- /dev/null +++ b/drivers/can/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# drivers/can/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. +# +# ############################################################################## + +if(CONFIG_CAN) + set(SRCS can.c) + + if(CONFIG_CAN_MCP2515) + list(APPEND SRCS mcp2515.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/clk/CMakeLists.txt b/drivers/clk/CMakeLists.txt new file mode 100644 index 0000000000..c1a478e20f --- /dev/null +++ b/drivers/clk/CMakeLists.txt @@ -0,0 +1,44 @@ +# ############################################################################## +# drivers/clk/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. +# +# ############################################################################## + +if(CONFIG_CLK) + + set(SRCS) + + list( + APPEND + SRCS + clk.c + clk_divider.c + clk_fixed_factor.c + clk_fractional_divider.c + clk_fixed_rate.c + clk_gate.c + clk_multiplier.c + clk_mux.c + clk_phase.c) + + if(CONFIG_CLK_RPMSG) + list(APPEND SRCS clk_rpmsg.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) + +endif() diff --git a/drivers/contactless/CMakeLists.txt b/drivers/contactless/CMakeLists.txt new file mode 100644 index 0000000000..44b0a1d8ac --- /dev/null +++ b/drivers/contactless/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# drivers/contactless/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. +# +# ############################################################################## + +if(CONFIG_DRIVERS_CONTACTLESS) + set(SRCS) + + if(CONFIG_CL_MFRC522) + list(APPEND SRCS mfrc522.c) + endif() + + if(CONFIG_CL_PN532) + list(APPEND SRCS pn532.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/crypto/CMakeLists.txt b/drivers/crypto/CMakeLists.txt new file mode 100644 index 0000000000..efb21c9132 --- /dev/null +++ b/drivers/crypto/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# drivers/crypto/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. +# +# ############################################################################## + +if(CONFIG_DEV_URANDOM AND NOT CONFIG_DEV_URANDOM_ARCH) + target_sources(drivers PRIVATE dev_urandom.c) +endif() diff --git a/drivers/dummy/CMakeLists.txt b/drivers/dummy/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/drivers/dummy/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/drivers/eeprom/CMakeLists.txt b/drivers/eeprom/CMakeLists.txt new file mode 100644 index 0000000000..a527dff3e7 --- /dev/null +++ b/drivers/eeprom/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# drivers/eeprom/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. +# +# ############################################################################## + +if(CONFIG_EEPROM) + set(SRCS) + + # Include the Microchip/Atmel/ST xx25xx driver for SPI + if(CONFIG_SPI_EE_25XX) + list(APPEND SRCS spi_xx25xx.c) + endif() + + # Include the Microchip/Atmel/ST xx24xx driver for I2C + if(CONFIG_I2C_EE_24XX) + list(APPEND SRCS i2c_xx24xx.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/efuse/CMakeLists.txt b/drivers/efuse/CMakeLists.txt new file mode 100644 index 0000000000..1e9ddde6e4 --- /dev/null +++ b/drivers/efuse/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/efuse/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. +# +# ############################################################################## +if(CONFIG_EFUSE) + target_sources(drivers PRIVATE efuse.c) +endif() diff --git a/drivers/i2c/CMakeLists.txt b/drivers/i2c/CMakeLists.txt new file mode 100644 index 0000000000..d3f32ac006 --- /dev/null +++ b/drivers/i2c/CMakeLists.txt @@ -0,0 +1,44 @@ +# ############################################################################## +# drivers/i2c/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. +# +# ############################################################################## +# ############################################################################## + +if(CONFIG_I2C) + set(SRCS i2c_read.c i2c_write.c i2c_writeread.c) + + if(CONFIG_I2C_DRIVER) + list(APPEND SRCS i2c_driver.c) + endif() + + if(CONFIG_I2C_BITBANG) + list(APPEND SRCS i2c_bitbang.c) + endif() + + # Include the selected I2C multiplexer drivers + + if(CONFIG_I2CMULTIPLEXER_PCA9540BDP) + list(APPEND SRCS pca9540bdp.c) + endif() + + if(CONFIG_I2CMULTIPLEXER_TCA9548A) + list(APPEND SRCS tca9548a.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/i2s/CMakeLists.txt b/drivers/i2s/CMakeLists.txt new file mode 100644 index 0000000000..83ac11b08f --- /dev/null +++ b/drivers/i2s/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# drivers/i2s/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. +# +# ############################################################################## + +if(CONFIG_I2S) + set(SRCS) + + if(CONFIG_AUDIO_I2SCHAR) + list(APPEND SRCS i2schar.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/input/CMakeLists.txt b/drivers/input/CMakeLists.txt new file mode 100644 index 0000000000..4804f5174a --- /dev/null +++ b/drivers/input/CMakeLists.txt @@ -0,0 +1,104 @@ +# ############################################################################## +# drivers/input/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. +# +# ############################################################################## + +if(CONFIG_INPUT) + set(SRCS) + + # Include the selected touchscreen drivers + + if(CONFIG_INPUT_TOUCHSCREEN) + list(APPEND SRCS touchscreen_upper.c) + endif() + + if(CONFIG_INPUT_UINPUT) + list(APPEND SRCS uinput.c) + endif() + + if(CONFIG_INPUT_TSC2007) + list(APPEND SRCS tsc2007.c) + endif() + + if(CONFIG_INPUT_FT5X06) + list(APPEND SRCS ft5x06.c) + endif() + + if(CONFIG_INPUT_ADS7843E) + list(APPEND SRCS ads7843e.c) + endif() + + if(CONFIG_INPUT_MAX11802) + list(APPEND SRCS max11802.c) + endif() + + if(CONFIG_INPUT_MXT) + list(APPEND SRCS mxt.c) + endif() + + if(CONFIG_INPUT_STMPE811) + list(APPEND SRCS stmpe811_base.c) + + if(NOT CONFIG_INPUT_STMPE811_TSC_DISABLE) + list(APPEND SRCS stmpe811_tsc.c) + endif() + if(NOT CONFIG_INPUT_STMPE811_GPIO_DISABLE) + list(APPEND SRCS stmpe811_gpio.c) + endif() + if(NOT CONFIG_INPUT_STMPE811_ADC_DISABLE) + list(APPEND SRCS stmpe811_adc.c) + endif() + if(NOT CONFIG_INPUT_STMPE811_TEMP_DISABLE) + list(APPEND SRCS stmpe811_temp.c) + endif() + endif() + + if(CONFIG_INPUT_CYPRESS_MBR3108) + list(APPEND SRCS cypress_mbr3108.c) + endif() + + if(CONFIG_INPUT_BUTTONS) + list(APPEND SRCS button_upper.c) + + if(CONFIG_INPUT_BUTTONS_LOWER) + list(APPEND SRCS button_lower.c) + endif() + endif() + + if(CONFIG_INPUT_KEYBOARD) + list(APPEND SRCS keyboard_upper.c) + endif() + + if(CONFIG_INPUT_DJOYSTICK) + list(APPEND SRCS djoystick.c) + endif() + + if(CONFIG_INPUT_AJOYSTICK) + list(APPEND SRCS ajoystick.c) + endif() + + if(CONFIG_INPUT_NUNCHUCK) + list(APPEND SRCS nunchuck.c) + endif() + + if(CONFIG_INPUT_SPQ10KBD) + list(APPEND SRCS spq10kbd.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/ioexpander/CMakeLists.txt b/drivers/ioexpander/CMakeLists.txt new file mode 100644 index 0000000000..df92f8c196 --- /dev/null +++ b/drivers/ioexpander/CMakeLists.txt @@ -0,0 +1,69 @@ +# ############################################################################## +# drivers/ioexpander/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) + +# Check if I/O expander support is enabled + +if(CONFIG_IOEXPANDER) + # Include the selected I/O expander drivers + + if(CONFIG_IOEXPANDER_RPMSG) + list(APPEND SRCS ioe_rpmsg.c) + endif() + + if(CONFIG_IOEXPANDER_DUMMY) + list(APPEND SRCS ioe_dummy.c) + endif() + + if(CONFIG_IOEXPANDER_PCA9555) + list(APPEND SRCS pca9555.c) + endif() + + if(CONFIG_IOEXPANDER_PCA9538) + list(APPEND SRCS pca9538.c) + endif() + + if(CONFIG_IOEXPANDER_TCA64XX) + list(APPEND SRCS tca64xx.c) + endif() + + if(CONFIG_IOEXPANDER_PCF8574) + list(APPEND SRCS pcf8574.c) + endif() + + if(CONFIG_IOEXPANDER_MCP23X17) + list(APPEND SRCS mcp23x17.c) + endif() + +endif() + +# GPIO test device driver (independent of IOEXPANDERS) + +if(CONFIG_DEV_GPIO) + list(APPEND SRCS gpio.c) + + if(CONFIG_GPIO_LOWER_HALF) + list(APPEND SRCS gpio_lower_half.c) + endif() +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/lcd/CMakeLists.txt b/drivers/lcd/CMakeLists.txt new file mode 100644 index 0000000000..937e5440a0 --- /dev/null +++ b/drivers/lcd/CMakeLists.txt @@ -0,0 +1,175 @@ +# ############################################################################## +# drivers/lcd/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) + +if(CONFIG_LCD) + + # Support for the generic LCD framebuffer front-end + + if(CONFIG_LCD_FRAMEBUFFER) + list(APPEND SRCS lcd_framebuffer.c) + endif() + + if(CONFIG_LCD_DEV) + list(APPEND SRCS lcd_dev.c) + endif() + + # Include support for Graphics LCD drivers + + if(CONFIG_LCD_FT80X) + list(APPEND SRCS ft80x.c) + if(CONFIG_LCD_FT80X_SPI) + list(APPEND SRCS ft80x_spi.c) + elseif(CONFIG_LCD_FT80X_I2C) + list(APPEND SRCS ft80x_i2c.c) + endif() + endif() + + if(CONFIG_LCD_LPM013M091A) + list(APPEND SRCS lpm013m091a.c) + endif() + + if(CONFIG_LCD_APA102) + list(APPEND SRCS apa102.c) + endif() + + if(CONFIG_LCD_P14201) + list(APPEND SRCS p14201.c) + endif() + + if(CONFIG_LCD_UG2864AMBAG01) + list(APPEND SRCS ug-2864ambag01.c) + endif() + + if(CONFIG_LCD_UG9664HSWAG01) + list(APPEND SRCS ug-9664hswag01.c) + endif() + + if(CONFIG_LCD_SSD1306) + list(APPEND SRCS ssd1306_base.c) + endif() + + if(CONFIG_LCD_SSD1306_SPI) + list(APPEND SRCS ssd1306_spi.c) + endif() + + if(CONFIG_LCD_SSD1306_I2C) + list(APPEND SRCS ssd1306_i2c.c) + endif() + + if(CONFIG_LCD_SSD1289) + list(APPEND SRCS ssd1289.c) + endif() + + if(CONFIG_LCD_SSD1680) + list(APPEND SRCS ssd1680.c) + endif() + + if(CONFIG_LCD_SSD1351) + list(APPEND SRCS ssd1351.c) + endif() + + if(CONFIG_LCD_MIO283QT2) + list(APPEND SRCS mio283qt2.c) + endif() + + if(CONFIG_LCD_MAX7219) + list(APPEND SRCS max7219.c) + endif() + + if(CONFIG_LCD_MIO283QT9A) + list(APPEND SRCS mio283qt9a.c) + endif() + + if(CONFIG_LCD_PCD8544) + list(APPEND SRCS pcd8544.c) + endif() + + if(CONFIG_LCD_ST7565) + list(APPEND SRCS st7565.c) + endif() + + if(CONFIG_LCD_ST7567) + list(APPEND SRCS st7567.c) + endif() + + if(CONFIG_LCD_SHARP_MEMLCD) + list(APPEND SRCS memlcd.c) + endif() + + if(CONFIG_LCD_ILI9225) + list(APPEND SRCS ili9225.c) + endif() + + if(CONFIG_LCD_ILI9340) + list(APPEND SRCS ili9340.c) + endif() + + if(CONFIG_LCD_ILI9341) + list(APPEND SRCS ili9341.c) + endif() + + if(CONFIG_LCD_LCDDRV_SPIIF) + list(APPEND SRCS lcddrv_spiif.c) + endif() + + if(CONFIG_LCD_RA8875) + list(APPEND SRCS ra8875.c) + endif() + + if(CONFIG_LCD_ST7735) + list(APPEND SRCS st7735.c) + endif() + + if(CONFIG_LCD_ST7789) + list(APPEND SRCS st7789.c) + endif() + + if(CONFIG_LCD_GC9A01) + list(APPEND SRCS gc9a01.c) + endif() + +endif() # CONFIG_LCD + +if(CONFIG_SLCD) + + # Include support for Alphanumeric/Segment LCD drivers + + if(CONFIG_LCD_BACKPACK) + list(APPEND SRCS pcf8574_lcd_backpack.c) + endif() + + if(CONFIG_LCD_ST7032) + list(APPEND SRCS st7032.c) + endif() + + if(CONFIG_LCD_HT16K33) + list(APPEND SRCS ht16k33_14seg.c) + endif() +endif() # CONFIG_SLCD + +# Other LCD-related devices + +if(CONFIG_LCD_TDA19988) + list(APPEND SRCS tda19988.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/leds/CMakeLists.txt b/drivers/leds/CMakeLists.txt new file mode 100644 index 0000000000..23ea9f4c29 --- /dev/null +++ b/drivers/leds/CMakeLists.txt @@ -0,0 +1,56 @@ +# ############################################################################## +# drivers/leds/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) + +if(CONFIG_USERLED) + list(APPEND SRCS userled_upper.c) + + if(CONFIG_USERLED_LOWER) + list(APPEND SRCS userled_lower.c) + endif() +endif() + +if(CONFIG_LEDS_APA102) + list(APPEND SRCS apa102.c) +endif() + +if(CONFIG_LEDS_MAX7219) + list(APPEND SRCS max7219.c) +endif() + +if(CONFIG_RGBLED) + list(APPEND SRCS rgbled.c) +endif() + +if(CONFIG_PCA9635PW) + list(APPEND SRCS pca9635pw.c) +endif() + +if(CONFIG_NCP5623C) + list(APPEND SRCS ncp5623c.c) +endif() + +if(CONFIG_WS2812) + list(APPEND SRCS ws2812.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/loop/CMakeLists.txt b/drivers/loop/CMakeLists.txt new file mode 100644 index 0000000000..f7189c1e7f --- /dev/null +++ b/drivers/loop/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# drivers/loop/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. +# +# ############################################################################## + +if(NOT CONFIG_DISABLE_MOUNTPOINT) + set(SRCS losetup.c) + + if(CONFIG_DEV_LOOP) + list(APPEND SRCS loop.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/math/CMakeLists.txt b/drivers/math/CMakeLists.txt new file mode 100644 index 0000000000..50cd74c644 --- /dev/null +++ b/drivers/math/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# drivers/math/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. +# +# ############################################################################## + +if(CONFIG_MATH_CORDIC) + target_sources(drivers PRIVATE cordic.c) +endif() diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt new file mode 100644 index 0000000000..f4f027b025 --- /dev/null +++ b/drivers/misc/CMakeLists.txt @@ -0,0 +1,51 @@ +# ############################################################################## +# drivers/misc/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) + +if(CONFIG_DEV_SIMPLE_ADDRENV) + list(APPEND SRCS addrenv.c) +endif() + +if(CONFIG_DEV_NULL) + list(APPEND SRCS dev_null.c) +endif() + +if(CONFIG_DEV_ZERO) + list(APPEND SRCS dev_zero.c) +endif() + +if(CONFIG_LWL_CONSOLE) + list(APPEND SRCS lwl_console.c) +endif() + +if(NOT CONFIG_DISABLE_MOUNTPOINT) + list(APPEND SRCS ramdisk.c) + if(CONFIG_DRVR_MKRD) + list(APPEND SRCS mkrd.c) + endif() +endif() + +if(CONFIG_DRVR_WRITEBUFFER) + list(APPEND SRCS rwbuffer.c) +elseif(CONFIG_DRVR_READAHEAD) + list(APPEND SRCS rwbuffer.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/mmcsd/CMakeLists.txt b/drivers/mmcsd/CMakeLists.txt new file mode 100644 index 0000000000..4321e1fd57 --- /dev/null +++ b/drivers/mmcsd/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# drivers/mmcsd/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. +# +# ############################################################################## + +if(CONFIG_MMCSD) + set(SRCS) + + # Include MMC/SD drivers + + if(CONFIG_MMCSD_SDIO) + list(APPEND SRCS mmcsd_sdio.c) + endif() + + if(CONFIG_MMCSD_SPI) + list(APPEND SRCS mmcsd_spi.c mmcsd_debug.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/modem/CMakeLists.txt b/drivers/modem/CMakeLists.txt new file mode 100644 index 0000000000..ac33a0c450 --- /dev/null +++ b/drivers/modem/CMakeLists.txt @@ -0,0 +1,31 @@ +# ############################################################################## +# drivers/modem/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. +# +# ############################################################################## + +if(CONFIG_MODEM) + set(SRCS) + + if(CONFIG_MODEM_U_BLOX) + list(APPEND SRCS u-blox.c) + endif() + + nuttx_add_subdirectory() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/motor/CMakeLists.txt b/drivers/motor/CMakeLists.txt new file mode 100644 index 0000000000..8c1ab18fbe --- /dev/null +++ b/drivers/motor/CMakeLists.txt @@ -0,0 +1,20 @@ +# ############################################################################## +# drivers/motor/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() diff --git a/drivers/motor/foc/CMakeLists.txt b/drivers/motor/foc/CMakeLists.txt new file mode 100644 index 0000000000..f77e50b505 --- /dev/null +++ b/drivers/motor/foc/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/motor/foc/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. +# +# ############################################################################## +if(CONFIG_MOTOR_FOC) + target_sources(drivers PRIVATE foc_dev.c) +endif() diff --git a/drivers/mtd/CMakeLists.txt b/drivers/mtd/CMakeLists.txt new file mode 100644 index 0000000000..201bfc9775 --- /dev/null +++ b/drivers/mtd/CMakeLists.txt @@ -0,0 +1,152 @@ +# ############################################################################## +# drivers/mtd/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. +# +# ############################################################################## +# +# ############################################################################## + +if(CONFIG_MTD) + set(SRCS ftl.c mtd_config.c) + + if(CONFIG_MTD_PARTITION) + list(APPEND SRCS mtd_partition.c) + endif() + + if(CONFIG_MTD_SECT512) + list(APPEND SRCS sector512.c) + endif() + + if(CONFIG_MTD_WRBUFFER) + list(APPEND SRCS mtd_rwbuffer.c) + else() + if(CONFIG_MTD_READAHEAD) + list(APPEND SRCS mtd_rwbuffer.c) + endif() + endif() + + if(CONFIG_MTD_PROGMEM) + list(APPEND SRCS mtd_progmem.c) + endif() + + if(CONFIG_MTD_NAND) + list( + APPEND + SRCS + mtd_nand.c + mtd_onfi.c + mtd_nandscheme.c + mtd_nandmodel.c + mtd_modeltab.c) + + if(CONFIG_MTD_NAND_SWECC) + list(APPEND SRCS mtd_nandecc.c hamming.c) + endif() + endif() + + if(CONFIG_RAMMTD) + list(APPEND SRCS rammtd.c) + endif() + + if(CONFIG_FILEMTD) + list(APPEND SRCS filemtd.c) + endif() + + if(CONFIG_MTD_AT24XX) + list(APPEND SRCS at24xx.c) + endif() + + if(CONFIG_MTD_AT45DB) + list(APPEND SRCS at45db.c) + endif() + + if(CONFIG_MTD_RAMTRON) + list(APPEND SRCS ramtron.c) + endif() + + if(CONFIG_MTD_SST25) + list(APPEND SRCS sst25.c) + endif() + + if(CONFIG_MTD_SST25XX) + list(APPEND SRCS sst25xx.c) + endif() + + if(CONFIG_MTD_SST26) + list(APPEND SRCS sst26.c) + endif() + + if(CONFIG_MTD_SST39FV) + list(APPEND SRCS sst39vf.c) + endif() + + if(CONFIG_MTD_W25) + list(APPEND SRCS w25.c) + endif() + + if(CONFIG_MTD_GD25) + list(APPEND SRCS gd25.c) + endif() + + if(CONFIG_MTD_GD5F) + list(APPEND SRCS gd5f.c) + endif() + + if(CONFIG_MTD_AT25) + list(APPEND SRCS at25.c) + endif() + + if(CONFIG_MTD_M25P) + list(APPEND SRCS m25px.c) + endif() + + if(CONFIG_MTD_MX25L) + list(APPEND SRCS mx25lx.c) + endif() + + if(CONFIG_MTD_MX35) + list(APPEND SRCS mx35.c) + endif() + + if(CONFIG_MTD_S25FL1) + list(APPEND SRCS s25fl1.c) + endif() + + if(CONFIG_MTD_N25QXXX) + list(APPEND SRCS n25qxxx.c) + endif() + + if(CONFIG_MTD_W25QXXXJV) + list(APPEND SRCS w25qxxxjv.c) + endif() + + if(CONFIG_MTD_MX25RXX) + list(APPEND SRCS mx25rxx.c) + endif() + + if(CONFIG_MTD_IS25XP) + list(APPEND SRCS is25xp.c) + endif() + + if(CONFIG_MTD_SMART) + if(CONFIG_FS_SMARTFS) + list(APPEND SRCS smart.c) + endif() + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/net/CMakeLists.txt b/drivers/net/CMakeLists.txt new file mode 100644 index 0000000000..f399251949 --- /dev/null +++ b/drivers/net/CMakeLists.txt @@ -0,0 +1,83 @@ +# ############################################################################## +# drivers/net/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. +# +# ############################################################################## + +if(CONFIG_NET) + set(SRCS) + + # Include network interface drivers + + if(CONFIG_MM_IOB) + list(APPEND SRCS netdev_upperhalf.c) + endif() + + if(CONFIG_NET_LOOPBACK) + list(APPEND SRCS loopback.c) + endif() + + if(CONFIG_NET_RPMSG_DRV) + list(APPEND SRCS rpmsgdrv.c) + endif() + + if(CONFIG_NETDEV_TELNET) + list(APPEND SRCS telnet.c) + endif() + + if(CONFIG_NET_DM90x0) + list(APPEND SRCS dm90x0.c) + endif() + + if(CONFIG_ENC28J60) + list(APPEND SRCS enc28j60.c) + endif() + + if(CONFIG_ENCX24J600) + list(APPEND SRCS encx24j600.c) + endif() + + if(CONFIG_NET_SLIP) + list(APPEND SRCS slip.c) + endif() + + if(CONFIG_NET_TUN) + list(APPEND SRCS tun.c) + endif() + + if(CONFIG_NET_FTMAC100) + list(APPEND SRCS ftmac100.c) + endif() + + if(CONFIG_NET_LAN91C111) + list(APPEND SRCS lan91c111.c) + endif() + + if(CONFIG_NET_SKELETON) + list(APPEND SRCS skeleton.c) + endif() + + if(CONFIG_NET_W5500) + list(APPEND SRCS w5500.c) + endif() + + if(CONFIG_ARCH_PHY_INTERRUPT) + list(APPEND SRCS phy_notify.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/note/CMakeLists.txt b/drivers/note/CMakeLists.txt new file mode 100644 index 0000000000..5215e75ef5 --- /dev/null +++ b/drivers/note/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# drivers/note/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) + +if(CONFIG_DRIVER_NOTE) + list(APPEND SRCS note_driver.c) +endif() + +if(CONFIG_DRIVER_NOTERAM) + list(APPEND SRCS noteram_driver.c) +endif() + +if(CONFIG_DRIVER_NOTECTL) + list(APPEND SRCS notectl_driver.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/pipes/CMakeLists.txt b/drivers/pipes/CMakeLists.txt new file mode 100644 index 0000000000..a476a0de40 --- /dev/null +++ b/drivers/pipes/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# drivers/pipes/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. +# +# ############################################################################## + +target_sources(drivers PRIVATE pipe.c fifo.c pipe_common.c) diff --git a/drivers/power/CMakeLists.txt b/drivers/power/CMakeLists.txt new file mode 100644 index 0000000000..e841ddf71a --- /dev/null +++ b/drivers/power/CMakeLists.txt @@ -0,0 +1,172 @@ +# ############################################################################## +# drivers/power/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() + +# 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}) diff --git a/drivers/rc/CMakeLists.txt b/drivers/rc/CMakeLists.txt new file mode 100644 index 0000000000..949057b2e6 --- /dev/null +++ b/drivers/rc/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# drivers/rc/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. +# +# ############################################################################## +if(CONFIG_DRIVERS_RC) + set(SRCS lirc_dev.c) + + if(CONFIG_RC_DUMMY) + list(APPEND SRCS dummy.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/rf/CMakeLists.txt b/drivers/rf/CMakeLists.txt new file mode 100644 index 0000000000..7df1c070ae --- /dev/null +++ b/drivers/rf/CMakeLists.txt @@ -0,0 +1,30 @@ +# ############################################################################## +# drivers/rf/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. +# +# ############################################################################## +if(CONFIG_DRIVERS_RF) + set(SRCS) + + if(CONFIG_SPI) + if(CONFIG_RF_DAT31R5SP) + list(APPEND SRCS dat-31r5-sp.c) + endif() + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/rptun/CMakeLists.txt b/drivers/rptun/CMakeLists.txt new file mode 100644 index 0000000000..e4b81d83f9 --- /dev/null +++ b/drivers/rptun/CMakeLists.txt @@ -0,0 +1,31 @@ +# ############################################################################## +# drivers/rptun/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. +# +# ############################################################################## +if(CONFIG_RPTUN) + set(SRCS) + + list(APPEND SRCS rptun.c rptun_dump.c) + + if(CONFIG_RPTUN_PING) + list(APPEND SRCS rptun_ping.c) + endif() + + target_include_directories(drivers PRIVATE ${NUTTX_DIR}/openamp/open-amp/lib) + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/segger/CMakeLists.txt b/drivers/segger/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/drivers/segger/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/drivers/sensors/CMakeLists.txt b/drivers/sensors/CMakeLists.txt new file mode 100644 index 0000000000..f010425cf3 --- /dev/null +++ b/drivers/sensors/CMakeLists.txt @@ -0,0 +1,341 @@ +# ############################################################################## +# drivers/sensors/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. +# +# ############################################################################## + +if(CONFIG_SENSORS) + set(SRCS sensor.c) + + if(CONFIG_USENSOR) + list(APPEND SRCS usensor.c) + endif() + + if(CONFIG_SENSORS_RPMSG) + list(APPEND SRCS sensor_rpmsg.c) + endif() + + if(CONFIG_SENSORS_WTGAHRS2) + list(APPEND SRCS wtgahrs2.c) + endif() + + if(CONFIG_SENSORS_FAKESENSOR) + list(APPEND SRCS fakesensor.c) + endif() + + if(CONFIG_SENSORS_HCSR04) + list(APPEND SRCS hc_sr04.c) + endif() + + if(CONFIG_SENSORS_ADXL345) + list(APPEND SRCS adxl345_base.c) + endif() + + if(CONFIG_SENSORS_DHTXX) + list(APPEND SRCS dhtxx.c) + endif() + + # These drivers depend on I2C support + + if(CONFIG_I2C) + + if(CONFIG_SENSORS_APDS9960) + list(APPEND SRCS apds9960.c) + endif() + + if(CONFIG_SENSORS_AK09912) + list(APPEND SRCS ak09912.c) + endif() + + if(CONFIG_SENSORS_AS5048B) + list(APPEND SRCS as5048b.c) + endif() + + if(CONFIG_SENSORS_AS726X) + list(APPEND SRCS as726x.c) + endif() + + if(CONFIG_SENSORS_FXOS8700CQ) + list(APPEND SRCS fxos8700cq.c) + endif() + + if(CONFIG_SENSORS_HYT271) + list(APPEND SRCS hyt271.c) + endif() + + if(CONFIG_SENSORS_KXTJ9) + list(APPEND SRCS kxtj9.c) + endif() + + if(CONFIG_SENSORS_LIS2DH) + list(APPEND SRCS lis2dh.c) + endif() + + if(CONFIG_LIS331DL) + list(APPEND SRCS lis331dl.c) + endif() + + if(CONFIG_SENSORS_LSM303AGR) + list(APPEND SRCS lsm303agr.c) + endif() + + if(CONFIG_SENSORS_LSM6DSL) + list(APPEND SRCS lsm6dsl.c) + endif() + + if(CONFIG_SENSORS_LSM9DS1) + list(APPEND SRCS lsm9ds1.c) + endif() + + if(CONFIG_SENSORS_MSA301) + list(APPEND SRCS msa301.c) + endif() + + if(CONFIG_SENSORS_LPS25H) + list(APPEND SRCS lps25h.c) + endif() + + if(CONFIG_ADXL345_I2C) + list(APPEND SRCS adxl345_i2c.c) + endif() + + if(CONFIG_SENSORS_BH1750FVI) + list(APPEND SRCS bh1750fvi.c) + endif() + + if(CONFIG_SENSORS_BMG160) + list(APPEND SRCS bmg160.c) + endif() + + if(CONFIG_SENSORS_BMI160) + list(APPEND SRCS bmi160.c) + endif() + + if(CONFIG_SENSORS_BMP180) + list(APPEND SRCS bmp180.c) + endif() + + if(CONFIG_SENSORS_BMP280) + list(APPEND SRCS bmp280.c) + endif() + + if(CONFIG_SENSORS_ISL29023) + list(APPEND SRCS isl29023.c) + endif() + + if(CONFIG_SENSORS_HTS221) + list(APPEND SRCS hts221.c) + endif() + + if(CONFIG_LM75_I2C) + list(APPEND SRCS lm75.c) + endif() + + if(CONFIG_SENSORS_LM92) + list(APPEND SRCS lm92.c) + endif() + + if(CONFIG_SENSORS_MAX44009) + list(APPEND SRCS max44009.c) + endif() + + if(CONFIG_SENSORS_MB7040) + list(APPEND SRCS mb7040.c) + endif() + + if(CONFIG_SENSORS_MCP9844) + list(APPEND SRCS mcp9844.c) + endif() + + if(CONFIG_SENSORS_MLX90393) + list(APPEND SRCS mlx90393.c) + endif() + + if(CONFIG_SENSORS_MLX90614) + list(APPEND SRCS mlx90614.c) + endif() + + if(CONFIG_SENSORS_MS5611) + list(APPEND SRCS ms5611.c) + endif() + + if(CONFIG_SENSORS_MS58XX) + list(APPEND SRCS ms58xx.c) + endif() + + if(CONFIG_SENSORS_LTC4151) + list(APPEND SRCS ltc4151.c) + endif() + + if(CONFIG_SENSORS_INA219) + list(APPEND SRCS ina219.c) + endif() + + if(CONFIG_SENSORS_INA226) + list(APPEND SRCS ina226.c) + endif() + + if(CONFIG_SENSORS_INA3221) + list(APPEND SRCS ina3221.c) + endif() + + if(CONFIG_SENSORS_SCD30) + list(APPEND SRCS scd30.c) + endif() + + if(CONFIG_SENSORS_SCD41) + list(APPEND SRCS scd41.c) + endif() + + if(CONFIG_SENSORS_SGP30) + list(APPEND SRCS sgp30.c) + endif() + + if(CONFIG_SENSORS_AHT10) + list(APPEND SRCS aht10.c) + endif() + + if(CONFIG_SENSORS_SHT21) + list(APPEND SRCS sht21.c) + endif() + + if(CONFIG_SENSORS_SHT3X) + list(APPEND SRCS sht3x.c) + endif() + + if(CONFIG_SENSORS_SPS30) + list(APPEND SRCS sps30.c) + endif() + + if(CONFIG_SENSORS_T67XX) + list(APPEND SRCS t67xx.c) + endif() + + endif() # CONFIG_I2C + + # These drivers depend on SPI support + + if(CONFIG_SPI) + + if(CONFIG_ADXL345_SPI) + list(APPEND SRCS adxl345_spi.c) + endif() + + if(CONFIG_SENSORS_ADXL372) + list(APPEND SRCS adxl372.c) + endif() + + if(CONFIG_LIS3DSH) + list(APPEND SRCS lis3dsh.c) + endif() + + if(CONFIG_LIS3DH) + list(APPEND SRCS lis3dh.c) + endif() + + if(CONFIG_SENSORS_MAX31855) + list(APPEND SRCS max31855.c) + endif() + + if(CONFIG_SENSORS_MAX6675) + list(APPEND SRCS max6675.c) + endif() + + if(CONFIG_SENSORS_MPL115A) + list(APPEND SRCS mpl115a.c) + endif() + + if(CONFIG_SENSORS_LIS3MDL) + list(APPEND SRCS lis3mdl.c) + endif() + + if(CONFIG_SENSORS_LSM330SPI) + list(APPEND SRCS lsm330_spi.c) + endif() + + if(CONFIG_SENSORS_L3GD20) + list(APPEND SRCS l3gd20.c) + endif() + + if(CONFIG_SENSORS_ADT7320) + list(APPEND SRCS adt7320.c) + endif() + + if(CONFIG_SENSORS_AS5048A) + list(APPEND SRCS as5048a.c) + endif() + + endif() # CONFIG_SPI + + # These drivers depend on 1WIRE support + + if(CONFIG_1WIRE) + + if(CONFIG_SENSORS_DS18B20) + list(APPEND SRCS ds18b20.c) + endif() + + endif() # CONFIG_1WIRE + + if(CONFIG_SENSORS_MPU60X0) + list(APPEND SRCS mpu60x0.c) + endif() + + # Quadrature encoder upper half + + if(CONFIG_SENSORS_QENCODER) + list(APPEND SRCS qencoder.c) + endif() + + # 3-phase Hall effect sensor upper half + + if(CONFIG_SENSORS_HALL3PHASE) + list(APPEND SRCS hall3ph.c) + endif() + + # Vishay VEML6070 + + if(CONFIG_SENSORS_VEML6070) + list(APPEND SRCS veml6070.c) + endif() + + # ST VL53L1X + + if(CONFIG_SENSORS_VL53L1X) + list(APPEND SRCS vl53l1x.c) + endif() + + # Sensixs XEN1210 + + if(CONFIG_SENSORS_XEN1210) + list(APPEND SRCS xen1210.c) + endif() + + # Zero Cross upper half + + if(CONFIG_SENSORS_ZEROCROSS) + list(APPEND SRCS zerocross.c) + endif() + + # TI HDC1008 + + if(CONFIG_SENSORS_HDC1008) + list(APPEND SRCS hdc1008.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt new file mode 100644 index 0000000000..87ca6ea8da --- /dev/null +++ b/drivers/serial/CMakeLists.txt @@ -0,0 +1,54 @@ +# ############################################################################## +# drivers/serial/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 serial drivers + +set(SRCS serial.c serial_io.c) + +if(CONFIG_SERIAL_RXDMA) + list(APPEND SRCS serial_dma.c) +elseif(CONFIG_SERIAL_TXDMA) + list(APPEND SRCS serial_dma.c) +endif() + +if(CONFIG_16550_UART) + list(APPEND SRCS uart_16550.c) +endif() + +if(CONFIG_RPMSG_UART) + list(APPEND SRCS uart_rpmsg.c) +endif() + +# Pseudo-terminal support + +if(CONFIG_PSEUDOTERM) + list(APPEND SRCS pty.c) + if(CONFIG_PSEUDOTERM_SUSV1) + list(APPEND SRCS ptmx.c) + endif() +endif() + +# Bluetooth H:4 UART driver + +if(CONFIG_UART_BTH4) + list(APPEND SRCS uart_bth4.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/spi/CMakeLists.txt b/drivers/spi/CMakeLists.txt new file mode 100644 index 0000000000..15e066bbae --- /dev/null +++ b/drivers/spi/CMakeLists.txt @@ -0,0 +1,39 @@ +# ############################################################################## +# drivers/spi/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. +# +# ############################################################################## + +if(CONFIG_SPI) + set(SRCS) + + if(CONFIG_SPI_EXCHANGE) + list(APPEND SRCS spi_transfer.c) + + if(CONFIG_SPI_DRIVER) + list(APPEND SRCS spi_driver.c) + endif() + endif() + + # Include the selected SPI drivers + + if(CONFIG_SPI_BITBANG) + list(APPEND SRCS spi_bitbang.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/syslog/CMakeLists.txt b/drivers/syslog/CMakeLists.txt new file mode 100644 index 0000000000..2378b96624 --- /dev/null +++ b/drivers/syslog/CMakeLists.txt @@ -0,0 +1,78 @@ +# ############################################################################## +# drivers/syslog/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 SYSLOG Infrastructure + +set(SRCS vsyslog.c syslog_channel.c syslog_putc.c syslog_write.c syslog_flush.c) + +if(CONFIG_SYSLOG_INTBUFFER) + list(APPEND SRCS syslog_intbuffer.c) +endif() + +if(NOT CONFIG_ARCH_SYSLOG) + list(APPEND SRCS syslog_initialize.c) +endif() + +# The RAMLOG device is usable as a system logging device or standalone + +if(CONFIG_RAMLOG) + list(APPEND SRCS ramlog.c) +endif() + +# Include SYSLOG drivers (only one should be enabled) + +# System logging to a character device (or file) + +list(APPEND SRCS syslog_device.c) + +if(CONFIG_SYSLOG_CHAR) + list(APPEND SRCS syslog_devchannel.c) +endif() + +if(CONFIG_SYSLOG_CONSOLE) + list(APPEND SRCS syslog_consolechannel.c) +endif() + +if(CONFIG_SYSLOG_FILE) + list(APPEND SRCS syslog_filechannel.c) +endif() + +if(CONFIG_SYSLOG_CHARDEV) + list(APPEND SRCS syslog_chardev.c) +endif() + +if(CONFIG_SYSLOG_RPMSG) + list(APPEND SRCS syslog_rpmsg.c) +endif() + +if(CONFIG_SYSLOG_RPMSG_SERVER) + list(APPEND SRCS syslog_rpmsg_server.c) +endif() + +if(CONFIG_CONSOLE_SYSLOG) + list(APPEND SRCS syslog_console.c) +endif() + +if(CONFIG_SYSLOG_STREAM) + list(APPEND SRCS syslog_stream.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/timers/CMakeLists.txt b/drivers/timers/CMakeLists.txt new file mode 100644 index 0000000000..0f9e7ebbed --- /dev/null +++ b/drivers/timers/CMakeLists.txt @@ -0,0 +1,76 @@ +# ############################################################################## +# drivers/timers/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) + +if(CONFIG_WATCHDOG) + list(APPEND SRCS watchdog.c) +endif() + +if(CONFIG_TIMER) + list(APPEND SRCS timer.c) +endif() + +if(CONFIG_TIMER_ARCH) + list(APPEND SRCS arch_timer.c) +endif() + +if(CONFIG_ONESHOT) + list(APPEND SRCS oneshot.c) +endif() + +if(CONFIG_ALARM_ARCH) + list(APPEND SRCS arch_alarm.c) +endif() + +if(CONFIG_RTC_DSXXXX) + list(APPEND SRCS ds3231.c) +endif() + +if(CONFIG_RTC_PCF85263) + list(APPEND SRCS pcf85263.c) +endif() + +if(CONFIG_RTC_MCP794XX) + list(APPEND SRCS mcp794xx.c) +endif() + +if(CONFIG_RTC_RPMSG) + list(APPEND SRCS rpmsg_rtc.c) +endif() + +if(CONFIG_RTC_ARCH) + list(APPEND SRCS arch_rtc.c) +endif() + +if(CONFIG_RTC_DRIVER) + list(APPEND SRCS rtc.c) +endif() + +if(CONFIG_TIMERS_CS2100CP) + list(APPEND SRCS cs2100-cp.c) +endif() + +if(CONFIG_PWM) + list(APPEND SRCS pwm.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/usbdev/CMakeLists.txt b/drivers/usbdev/CMakeLists.txt new file mode 100644 index 0000000000..9528ef1753 --- /dev/null +++ b/drivers/usbdev/CMakeLists.txt @@ -0,0 +1,65 @@ +# ############################################################################## +# drivers/usbdev/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. +# +# ############################################################################## + +if(CONFIG_USBDEV) + set(SRCS) + + # Include USB device drivers + + if(CONFIG_PL2303) + list(APPEND SRCS pl2303.c) + endif() + + if(CONFIG_CDCACM) + list(APPEND SRCS cdcacm.c cdcacm_desc.c) + endif() + + if(CONFIG_USBMSC) + list(APPEND SRCS usbmsc.c usbmsc_desc.c usbmsc_scsi.c) + endif() + + if(CONFIG_USBDEV_COMPOSITE) + list(APPEND SRCS composite.c composite_desc.c) + endif() + + if(CONFIG_USBDEV_TRACE_STRINGS) + list(APPEND SRCS usbdev_strings.c) + endif() + + if(CONFIG_RNDIS) + list(APPEND SRCS rndis.c) + endif() + + if(CONFIG_DFU) + list(APPEND SRCS dfu.c) + endif() + + if(CONFIG_USBADB) + list(APPEND SRCS adb.c) + endif() + + if(CONFIG_NET_CDCECM) + list(APPEND SRCS cdcecm.c) + endif() + + list(APPEND SRCS usbdev_trace.c usbdev_trprintf.c) + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/usbhost/CMakeLists.txt b/drivers/usbhost/CMakeLists.txt new file mode 100644 index 0000000000..f8d1d30b5b --- /dev/null +++ b/drivers/usbhost/CMakeLists.txt @@ -0,0 +1,81 @@ +# ############################################################################## +# drivers/usbhost/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. +# +# ############################################################################## + +if(CONFIG_USBHOST) + + # Include built-in USB host driver logic + + set(SRCS usbhost_registry.c usbhost_registerclass.c usbhost_findclass.c + usbhost_enumerate.c usbhost_devaddr.c) + + if(CONFIG_USBHOST_HUB) + list(APPEND SRCS usbhost_hub.c) + endif() + + if(CONFIG_USBHOST_COMPOSITE) + list(APPEND SRCS usbhost_composite.c) + endif() + + if(CONFIG_USBHOST_MSC) + list(APPEND SRCS usbhost_storage.c) + endif() + + if(CONFIG_USBHOST_CDCACM) + list(APPEND SRCS usbhost_cdcacm.c) + endif() + + if(CONFIG_USBHOST_CDCMBIM) + list(APPEND SRCS usbhost_cdcmbim.c) + endif() + + if(CONFIG_USBHOST_HID) + list(APPEND SRCS hid_parser.c) + endif() + + if(CONFIG_USBHOST_HIDKBD) + list(APPEND SRCS usbhost_hidkbd.c) + endif() + + if(CONFIG_USBHOST_HIDMOUSE) + list(APPEND SRCS usbhost_hidmouse.c) + endif() + + if(CONFIG_USBHOST_XBOXCONTROLLER) + list(APPEND SRCS usbhost_xboxcontroller.c) + endif() + + if(CONFIG_USBHOST_MAX3421E) + list(APPEND SRCS usbhost_max3421e.c) + endif() + + if(CONFIG_USBHOST_FT232R) + list(APPEND SRCS usbhost_ft232r.c) + endif() + + # HCD debug/trace logic + + if(CONFIG_USBHOST_TRACE) + list(APPEND SRCS usbhost_trace.c) + elseif(CONFIG_DEBUG_USB) + list(APPEND SRCS usbhost_trace.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/usbmisc/CMakeLists.txt b/drivers/usbmisc/CMakeLists.txt new file mode 100644 index 0000000000..15d5541829 --- /dev/null +++ b/drivers/usbmisc/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# drivers/usbmisc/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. +# +# ############################################################################## + +if(CONFIG_USBMISC) + set(SRCS) + + # Include USB miscellaneous drivers + + if(CONFIG_FUSB301) + list(APPEND SRCS fusb301.c) + endif() + + if(CONFIG_FUSB303) + list(APPEND SRCS fusb303.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/usbmonitor/CMakeLists.txt b/drivers/usbmonitor/CMakeLists.txt new file mode 100644 index 0000000000..19df127020 --- /dev/null +++ b/drivers/usbmonitor/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# drivers/usbmonitor/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. +# +# ############################################################################## + +if(CONFIG_USBMONITOR) + target_sources(drivers PRIVATE usbmonitor.c) +endif() diff --git a/drivers/usrsock/CMakeLists.txt b/drivers/usrsock/CMakeLists.txt new file mode 100644 index 0000000000..dc1bb8bb02 --- /dev/null +++ b/drivers/usrsock/CMakeLists.txt @@ -0,0 +1,41 @@ +# ############################################################################## +# drivers/usrsock/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) + +if(CONFIG_NET_USRSOCK) + + # Include usrsock device drivers + + if(CONFIG_NET_USRSOCK_DEVICE) + list(APPEND SRCS usrsock_dev.c) + endif() + + if(CONFIG_NET_USRSOCK_RPMSG) + list(APPEND SRCS usrsock_rpmsg.c) + endif() + +endif() + +if(CONFIG_NET_USRSOCK_RPMSG_SERVER) + list(APPEND SRCS usrsock_rpmsg_server.c) +endif() + +target_sources(drivers PRIVATE ${SRCS}) diff --git a/drivers/video/CMakeLists.txt b/drivers/video/CMakeLists.txt new file mode 100644 index 0000000000..a66b475998 --- /dev/null +++ b/drivers/video/CMakeLists.txt @@ -0,0 +1,66 @@ +# ############################################################################## +# drivers/video/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 video drivers + +if(CONFIG_DRIVERS_VIDEO) + + set(SRCS) + + if(CONFIG_VIDEO_FB) + list(APPEND SRCS fb.c) + endif() + + if(CONFIG_VIDEO_STREAM) + list(APPEND SRCS video.c video_framebuff.c) + endif() + + # These video drivers depend on I2C support + + if(CONFIG_I2C) + + if(CONFIG_VIDEO_ISX012) + list(APPEND SRCS isx012.c) + endif() + + if(CONFIG_VIDEO_ISX019) + list(APPEND SRCS isx019.c) + endif() + + if(CONFIG_VIDEO_OV2640) + list(APPEND SRCS ov2640.c) + endif() + + endif() + + # These video drivers depend on SPI support + + if(CONFIG_SPI) + + if(CONFIG_VIDEO_MAX7456) + list(APPEND SRCS max7456.c) + endif() + + endif() + + target_sources(drivers PRIVATE ${SRCS}) + + nuttx_add_subdirectory() +endif() diff --git a/drivers/video/vnc/CMakeLists.txt b/drivers/video/vnc/CMakeLists.txt new file mode 100644 index 0000000000..27388a8fc4 --- /dev/null +++ b/drivers/video/vnc/CMakeLists.txt @@ -0,0 +1,42 @@ +# ############################################################################## +# drivers/video/vnc/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. +# +# ############################################################################## + +if(CONFIG_VNCSERVER) + set(SRCS + vnc_server.c + vnc_negotiate.c + vnc_updater.c + vnc_receiver.c + vnc_raw.c + vnc_rre.c + vnc_color.c + vnc_fbdev.c + vnc_keymap.c) + + if(CONFIG_VNCSERVER_TOUCH) + list(APPEND SRCS vnc_touch.c) + endif() + + if(CONFIG_VNCSERVER_KBD) + list(APPEND SRCS vnc_kbd.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/wireless/CMakeLists.txt b/drivers/wireless/CMakeLists.txt new file mode 100644 index 0000000000..cb9661dc06 --- /dev/null +++ b/drivers/wireless/CMakeLists.txt @@ -0,0 +1,42 @@ +# ############################################################################## +# drivers/wireless/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. +# +# ############################################################################## + +if(CONFIG_DRIVERS_WIRELESS) + set(SRCS) + + nuttx_add_subdirectory() + + # Include wireless drivers + + if(CONFIG_WL_CC1101) + list(APPEND SRCS cc1101.c ISM1_868MHzGFSK100kbps.c ISM2_905MHzGFSK250kbps.c + ISM2_433MHzMSK500kbps.c) + endif() + + if(CONFIG_WL_GS2200M) + list(APPEND SRCS gs2200m.c) + endif() + + if(CONFIG_WL_NRF24L01) + list(APPEND SRCS nrf24l01.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/wireless/bluetooth/CMakeLists.txt b/drivers/wireless/bluetooth/CMakeLists.txt new file mode 100644 index 0000000000..ba7d07923b --- /dev/null +++ b/drivers/wireless/bluetooth/CMakeLists.txt @@ -0,0 +1,46 @@ +# ############################################################################## +# drivers/wireless/bluetooth/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. +# +# ############################################################################## + +if(CONFIG_DRIVERS_BLUETOOTH) + set(SRCS) + + if(CONFIG_BLUETOOTH_UART) + list(APPEND SRCS bt_uart.c) + + if(CONFIG_BLUETOOTH_UART_GENERIC) + list(APPEND SRCS bt_uart_generic.c) + endif() + if(CONFIG_BLUETOOTH_UART_SHIM) + list(APPEND SRCS bt_uart_shim.c) + endif() + if(CONFIG_BLUETOOTH_UART_CC2564) + list(APPEND SRCS bt_uart_cc2564.c) + endif() + if(CONFIG_BLUETOOTH_BCM4343X) + list(APPEND SRCS bt_uart_bcm4343x.c) + endif() + endif() + + if(CONFIG_BLUETOOTH_NULL) + list(APPEND SRCS bt_null.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/wireless/ieee80211/CMakeLists.txt b/drivers/wireless/ieee80211/CMakeLists.txt new file mode 100644 index 0000000000..ec843bf085 --- /dev/null +++ b/drivers/wireless/ieee80211/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/ieee80211/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. +# +# ############################################################################## +if(CONFIG_DRIVERS_IEEE80211) + nuttx_add_subdirectory() +endif() diff --git a/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt b/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt new file mode 100644 index 0000000000..bdceda54e9 --- /dev/null +++ b/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# drivers/wireless/ieee80211/bcm43xxx/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. +# +# ############################################################################## +if(CONFIG_IEEE80211_BROADCOM_FULLMAC) + set(SRCS) + + list( + APPEND + SRCS + bcmf_driver.c + bcmf_cdc.c + bcmf_bdc.c + bcmf_utils.c + bcmf_netdev.c) + + if(CONFIG_IEEE80211_BROADCOM_FULLMAC_SDIO) + list(APPEND SRCS mmc_sdio.c bcmf_sdio.c bcmf_core.c bcmf_sdpcm.c) + endif() + + if(CONFIG_IEEE80211_BROADCOM_BCM43362) + list(APPEND SRCS bcmf_chip_43362.c) + endif() + + if(CONFIG_IEEE80211_BROADCOM_BCM43438) + list(APPEND SRCS bcmf_chip_43438.c) + endif() + + target_sources(drivers PRIVATE ${SRCS}) +endif() diff --git a/drivers/wireless/ieee802154/CMakeLists.txt b/drivers/wireless/ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..7e78340716 --- /dev/null +++ b/drivers/wireless/ieee802154/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/ieee802154/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. +# +# ############################################################################## +if(CONFIG_DRIVERS_IEEE802154) + nuttx_add_subdirectory() +endif() diff --git a/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt b/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt new file mode 100644 index 0000000000..c903232cf0 --- /dev/null +++ b/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/ieee802154/at86rf23x/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. +# +# ############################################################################## +if(CONFIG_IEEE802154_AT86RF233) + target_sources(drivers PRIVATE at86rf23x.c) +endif() diff --git a/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt b/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt new file mode 100644 index 0000000000..d0ef694da6 --- /dev/null +++ b/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# drivers/wireless/ieee802154/mrf24j40/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. +# +# ############################################################################## +if(CONFIG_IEEE802154_MRF24J40) + target_sources(drivers PRIVATE mrf24j40_getset.c mrf24j40_interrupt.c + mrf24j40_radif.c mrf24j40_regops.c mrf24j40.c) +endif() diff --git a/drivers/wireless/ieee802154/xbee/CMakeLists.txt b/drivers/wireless/ieee802154/xbee/CMakeLists.txt new file mode 100644 index 0000000000..62f8d33f66 --- /dev/null +++ b/drivers/wireless/ieee802154/xbee/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/ieee802154/xbee/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. +# +# ############################################################################## +if(CONFIG_IEEE802154_XBEE) + target_sources(drivers PRIVATE xbee_ioctl.c xbee_mac.c xbee_netdev.c xbee.c) +endif() diff --git a/drivers/wireless/lpwan/CMakeLists.txt b/drivers/wireless/lpwan/CMakeLists.txt new file mode 100644 index 0000000000..fc506637d4 --- /dev/null +++ b/drivers/wireless/lpwan/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/lpwan/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. +# +# ############################################################################## +if(CONFIG_DRIVERS_LPWAN) + nuttx_add_subdirectory() +endif() diff --git a/drivers/wireless/lpwan/sx127x/CMakeLists.txt b/drivers/wireless/lpwan/sx127x/CMakeLists.txt new file mode 100644 index 0000000000..ca540a2267 --- /dev/null +++ b/drivers/wireless/lpwan/sx127x/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/lpwan/sx127x/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. +# +# ############################################################################## +if(CONFIG_LPWAN_SX127X) + target_sources(drivers PRIVATE sx127x.c) +endif() diff --git a/drivers/wireless/spirit/CMakeLists.txt b/drivers/wireless/spirit/CMakeLists.txt new file mode 100644 index 0000000000..8608c4a5bf --- /dev/null +++ b/drivers/wireless/spirit/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/spirit/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. +# +# ############################################################################## +if(CONFIG_WL_SPIRIT) + nuttx_add_subdirectory() +endif() diff --git a/drivers/wireless/spirit/drivers/CMakeLists.txt b/drivers/wireless/spirit/drivers/CMakeLists.txt new file mode 100644 index 0000000000..e2ed2dbac5 --- /dev/null +++ b/drivers/wireless/spirit/drivers/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# drivers/wireless/spirit/drivers/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. +# +# ############################################################################## +if(CONFIG_SPIRIT_NETDEV) + target_sources(drivers PRIVATE spirit_netdev.c) +endif() diff --git a/drivers/wireless/spirit/lib/CMakeLists.txt b/drivers/wireless/spirit/lib/CMakeLists.txt new file mode 100644 index 0000000000..51a62b8d76 --- /dev/null +++ b/drivers/wireless/spirit/lib/CMakeLists.txt @@ -0,0 +1,38 @@ +# ############################################################################## +# drivers/wireless/spirit/lib/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. +# +# ############################################################################## +target_sources( + drivers + PRIVATE spirit_radio.c + spirit_pktbasic.c + spirit_pktcommon.c + spirit_pktmbus.c + spirit_pktstack.c + spirit_directrf.c + spirit_qi.c + spirit_calibration.c + spirit_management.c + spirit_aes.c + spirit_csma.c + spirit_linearfifo.c + spirit_irq.c + spirit_timer.c + spirit_gpio.c + spirit_general.c + spirit_spi.c) diff --git a/dummy/CMakeLists.txt b/dummy/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/fs/CMakeLists.txt b/fs/CMakeLists.txt new file mode 100644 index 0000000000..57e0fb19e0 --- /dev/null +++ b/fs/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# fs/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_kernel_library(fs fs_initialize.c) +nuttx_add_subdirectory() +target_include_directories(fs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/fs/aio/CMakeLists.txt b/fs/aio/CMakeLists.txt new file mode 100644 index 0000000000..5c5bd47152 --- /dev/null +++ b/fs/aio/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# fs/aio/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. +# +# ############################################################################## + +if(CONFIG_FS_AIO) + + target_sources( + fs + PRIVATE aio_cancel.c + aioc_contain.c + aio_fsync.c + aio_initialize.c + aio_queue.c + aio_read.c + aio_signal.c + aio_write.c) + +endif() diff --git a/fs/binfs/CMakeLists.txt b/fs/binfs/CMakeLists.txt new file mode 100644 index 0000000000..5929a3609d --- /dev/null +++ b/fs/binfs/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# fs/binfs/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. +# +# ############################################################################## + +if(CONFIG_FS_BINFS) + + target_sources(fs PRIVATE fs_binfs.c) + +endif() diff --git a/fs/cromfs/CMakeLists.txt b/fs/cromfs/CMakeLists.txt new file mode 100644 index 0000000000..f9b79fffd4 --- /dev/null +++ b/fs/cromfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/cromfs/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. +# +# ############################################################################## + +if(CONFIG_FS_CROMFS) + target_sources(fs PRIVATE fs_cromfs.c) +endif() diff --git a/fs/driver/CMakeLists.txt b/fs/driver/CMakeLists.txt new file mode 100644 index 0000000000..fd35b53ca1 --- /dev/null +++ b/fs/driver/CMakeLists.txt @@ -0,0 +1,53 @@ +# ############################################################################## +# fs/driver/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 fs_registerdriver.c fs_unregisterdriver.c) + +# Don't built-in block driver support if there are no mountpoints + +if(NOT CONFIG_DISABLE_MOUNTPOINT) + list( + APPEND + SRCS + fs_registerblockdriver.c + fs_unregisterblockdriver.c + fs_findblockdriver.c + fs_openblockdriver.c + fs_closeblockdriver.c + fs_blockpartition.c + fs_findmtddriver.c) + + if(CONFIG_MTD) + list(APPEND SRCS fs_registermtddriver.c fs_unregistermtddriver.c + fs_mtdproxy.c) + + if(CONFIG_MTD_PARTITION) + list(APPEND SRCS fs_mtdpartition.c) + endif() + endif() + + if(CONFIG_BCH) + if(NOT CONFIG_DISABLE_PSEUDOFS_OPERATIONS) + list(APPEND SRCS fs_blockproxy.c) + endif() + endif() +endif() + +target_sources(fs PRIVATE ${SRCS}) diff --git a/fs/fat/CMakeLists.txt b/fs/fat/CMakeLists.txt new file mode 100644 index 0000000000..6e9546881f --- /dev/null +++ b/fs/fat/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# fs/fat/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. +# +# ############################################################################## + +if(CONFIG_FS_FAT) + target_sources(fs PRIVATE fs_fat32.c fs_fat32dirent.c fs_fat32attrib.c + fs_fat32util.c) +endif() diff --git a/fs/hostfs/CMakeLists.txt b/fs/hostfs/CMakeLists.txt new file mode 100644 index 0000000000..d989ede733 --- /dev/null +++ b/fs/hostfs/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# fs/hostfs/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) + +if(CONFIG_FS_HOSTFS) + list(APPEND SRCS hostfs.c) +endif() + +if(CONFIG_FS_HOSTFS_RPMSG) + list(APPEND SRCS hostfs_rpmsg.c) +endif() + +if(CONFIG_FS_HOSTFS_RPMSG_SERVER) + list(APPEND SRCS hostfs_rpmsg_server.c) +endif() + +target_sources(fs PRIVATE ${SRCS}) diff --git a/fs/inode/CMakeLists.txt b/fs/inode/CMakeLists.txt new file mode 100644 index 0000000000..b1301aa5cb --- /dev/null +++ b/fs/inode/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# fs/inode/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. +# +# ############################################################################## + +target_sources( + fs + PRIVATE fs_files.c + fs_foreachinode.c + fs_inode.c + fs_inodeaddref.c + fs_inodebasename.c + fs_inodefind.c + fs_inodefree.c + fs_inodegetpath.c + fs_inoderelease.c + fs_inoderemove.c + fs_inodereserve.c + fs_inodesearch.c) diff --git a/fs/littlefs/CMakeLists.txt b/fs/littlefs/CMakeLists.txt new file mode 100644 index 0000000000..b7e08784eb --- /dev/null +++ b/fs/littlefs/CMakeLists.txt @@ -0,0 +1,43 @@ +# ############################################################################## +# fs/littlefs/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. +# +# ############################################################################## + +if(CONFIG_FS_LITTLEFS) + if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/littlefs) + set(LITTLEFS_VERSION 2.4.0) + + FetchContent_Declare( + littlefs + URL https://github.com/ARMmbed/littlefs/archive/v${LITTLEFS_VERSION}.tar.gz + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/littlefs) + FetchContent_MakeAvailable(littlefs) + endif() + + target_compile_definitions( + fs + PRIVATE -DLFS_TRACE=finfo -DLFS_DEBUG=finfo -DLFS_WARN=fwarn + -DLFS_ERROR=ferr -DLFS_ASSERT=DEBUGASSERT + -DLFS_CONFIG=${CMAKE_CURRENT_LIST_DIR}/lfs_vfs.h) + + target_sources(fs PRIVATE lfs_vfs.c ${CMAKE_CURRENT_LIST_DIR}/littlefs/lfs.c + ${CMAKE_CURRENT_LIST_DIR}/littlefs/lfs_util.c) + + target_include_directories(fs PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +endif() diff --git a/fs/mmap/CMakeLists.txt b/fs/mmap/CMakeLists.txt new file mode 100644 index 0000000000..527f828db5 --- /dev/null +++ b/fs/mmap/CMakeLists.txt @@ -0,0 +1,27 @@ +# ############################################################################## +# fs/mmap/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 fs_mmap.c fs_munmap.c) + +if(CONFIG_FS_RAMMAP) + list(APPEND SRCS fs_rammap.c) +endif() + +target_sources(fs PRIVATE ${SRCS}) diff --git a/fs/mount/CMakeLists.txt b/fs/mount/CMakeLists.txt new file mode 100644 index 0000000000..f50d991f9a --- /dev/null +++ b/fs/mount/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# fs/mount/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. +# +# ############################################################################## + +# Don't build anything if there is no mountpoint support + +if(NOT CONFIG_DISABLE_MOUNTPOINT) + set(SRCS fs_mount.c fs_umount2.c fs_foreachmountpoint.c) + + if(CONFIG_FS_AUTOMOUNTER) + list(APPEND SRCS fs_automount.c) + endif() + + if(CONFIG_FS_PROCFS AND NOT CONFIG_FS_PROCFS_EXCLUDE_MOUNT) + list(APPEND SRCS fs_procfs_mount.c fs_gettype.c) + endif() + + target_sources(fs PRIVATE ${SRCS}) +endif() diff --git a/fs/mqueue/CMakeLists.txt b/fs/mqueue/CMakeLists.txt new file mode 100644 index 0000000000..5f7150a2a7 --- /dev/null +++ b/fs/mqueue/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# fs/mqueue/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 POSIX message queue support + +if(NOT CONFIG_DISABLE_MQUEUE) + target_sources(fs PRIVATE mq_open.c mq_close.c mq_unlink.c) +endif() diff --git a/fs/nfs/CMakeLists.txt b/fs/nfs/CMakeLists.txt new file mode 100644 index 0000000000..affb76ef23 --- /dev/null +++ b/fs/nfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/nfs/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. +# +# ############################################################################## + +if(CONFIG_NFS) + target_sources(fs PRIVATE rpc_clnt.c nfs_util.c nfs_vfsops.c) +endif() diff --git a/fs/nxffs/CMakeLists.txt b/fs/nxffs/CMakeLists.txt new file mode 100644 index 0000000000..7880d5d820 --- /dev/null +++ b/fs/nxffs/CMakeLists.txt @@ -0,0 +1,43 @@ +# ############################################################################## +# fs/nxffs/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. +# +# ############################################################################## + +if(CONFIG_FS_NXFFS) + + target_sources( + fs + PRIVATE nxffs_block.c + nxffs_blockstats.c + nxffs_cache.c + nxffs_dirent.c + nxffs_dump.c + nxffs_initialize.c + nxffs_inode.c + nxffs_ioctl.c + nxffs_open.c + nxffs_pack.c + nxffs_read.c + nxffs_reformat.c + nxffs_stat.c + nxffs_truncate.c + nxffs_unlink.c + nxffs_util.c + nxffs_write.c) + +endif() diff --git a/fs/partition/CMakeLists.txt b/fs/partition/CMakeLists.txt new file mode 100644 index 0000000000..9b8015e1ea --- /dev/null +++ b/fs/partition/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# fs/partition/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. +# +# ############################################################################## + +# Don't build anything if mountpoint doesn't support + +if(NOT CONFIG_DISABLE_MOUNTPOINT) + set(SRCS) + + list(APPEND SRCS fs_partition.c) + + if(CONFIG_PTABLE_PARTITION) + list(APPEND SRCS fs_ptable.c) + endif() + + target_sources(fs PRIVATE ${SRCS}) +endif() diff --git a/fs/procfs/CMakeLists.txt b/fs/procfs/CMakeLists.txt new file mode 100644 index 0000000000..05964f60a1 --- /dev/null +++ b/fs/procfs/CMakeLists.txt @@ -0,0 +1,38 @@ +# ############################################################################## +# fs/procfs/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. +# +# ############################################################################## + +if(CONFIG_FS_PROCFS) + + set(SRCS + fs_procfs.c + fs_procfscpuinfo.c + fs_procfscpuload.c + fs_procfscritmon.c + fs_procfsiobinfo.c + fs_procfsmeminfo.c + fs_procfsproc.c + fs_procfstcbinfo.c + fs_procfsuptime.c + fs_procfsutil.c + fs_procfsversion.c) + + target_sources(fs PRIVATE ${SRCS}) + +endif() diff --git a/fs/romfs/CMakeLists.txt b/fs/romfs/CMakeLists.txt new file mode 100644 index 0000000000..f661fee610 --- /dev/null +++ b/fs/romfs/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# fs/romfs/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. +# +# ############################################################################## + +if(CONFIG_FS_ROMFS) + + target_sources(fs PRIVATE fs_romfs.c fs_romfsutil.c) + +endif() diff --git a/fs/rpmsgfs/CMakeLists.txt b/fs/rpmsgfs/CMakeLists.txt new file mode 100644 index 0000000000..2d49c53b63 --- /dev/null +++ b/fs/rpmsgfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/rpmsgfs/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. +# +# ############################################################################## + +if(CONFIG_FS_RPMSGFS) + target_sources(fs PRIVATE rpmsgfs.c rpmsgfs_client.c rpmsgfs_server.c) +endif() diff --git a/fs/semaphore/CMakeLists.txt b/fs/semaphore/CMakeLists.txt new file mode 100644 index 0000000000..b7e5d945bb --- /dev/null +++ b/fs/semaphore/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# fs/semaphore/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. +# +# ############################################################################## + +if(CONFIG_FS_NAMED_SEMAPHORES) + + target_sources(fs PRIVATE sem_open.c sem_close.c sem_unlink.c) + +endif() diff --git a/fs/shm/CMakeLists.txt b/fs/shm/CMakeLists.txt new file mode 100644 index 0000000000..6f46371380 --- /dev/null +++ b/fs/shm/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# fs/shm/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 POSIX message queue support + +if(CONFIG_FS_SHM) + target_sources(fs PRIVATE shm_open.c shm_close.c) +endif() diff --git a/fs/smartfs/CMakeLists.txt b/fs/smartfs/CMakeLists.txt new file mode 100644 index 0000000000..84cd379d3b --- /dev/null +++ b/fs/smartfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/smartfs/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. +# +# ############################################################################## + +if(CONFIG_FS_SMARTFS) + target_sources(fs PRIVATE smartfs_smart.c smartfs_utils.c smartfs_procfs.c) +endif() diff --git a/fs/socket/CMakeLists.txt b/fs/socket/CMakeLists.txt new file mode 100644 index 0000000000..e1eb50a8a0 --- /dev/null +++ b/fs/socket/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# fs/socket/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. +# +# ############################################################################## +if(CONFIG_NET) + target_sources(fs PRIVATE socket.c) +endif() diff --git a/fs/spiffs/CMakeLists.txt b/fs/spiffs/CMakeLists.txt new file mode 100644 index 0000000000..8320f09732 --- /dev/null +++ b/fs/spiffs/CMakeLists.txt @@ -0,0 +1,20 @@ +# ############################################################################## +# fs/spiffs/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() diff --git a/fs/spiffs/src/CMakeLists.txt b/fs/spiffs/src/CMakeLists.txt new file mode 100644 index 0000000000..e5d8086880 --- /dev/null +++ b/fs/spiffs/src/CMakeLists.txt @@ -0,0 +1,30 @@ +# ############################################################################## +# fs/spiffs/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. +# +# ############################################################################## +if(CONFIG_FS_SPIFFS) + target_sources( + fs + PRIVATE spiffs_vfs.c + spiffs_volume.c + spiffs_core.c + spiffs_gc.c + spiffs_cache.c + spiffs_check.c + spiffs_mtd.c) +endif() diff --git a/fs/tmpfs/CMakeLists.txt b/fs/tmpfs/CMakeLists.txt new file mode 100644 index 0000000000..290ec1fe7c --- /dev/null +++ b/fs/tmpfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/tmpfs/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. +# +# ############################################################################## + +if(CONFIG_FS_TMPFS) + target_sources(fs PRIVATE fs_tmpfs.c) +endif() diff --git a/fs/unionfs/CMakeLists.txt b/fs/unionfs/CMakeLists.txt new file mode 100644 index 0000000000..700ea2681f --- /dev/null +++ b/fs/unionfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/unionfs/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. +# +# ############################################################################## + +if(CONFIG_FS_UNIONFS) + target_sources(fs PRIVATE fs_unionfs.c) +endif() diff --git a/fs/userfs/CMakeLists.txt b/fs/userfs/CMakeLists.txt new file mode 100644 index 0000000000..1270be7d9f --- /dev/null +++ b/fs/userfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# fs/userfs/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. +# +# ############################################################################## + +if(CONFIG_FS_USERFS) + target_sources(fs PRIVATE fs_userfs.c) +endif() diff --git a/fs/vfs/CMakeLists.txt b/fs/vfs/CMakeLists.txt new file mode 100644 index 0000000000..283bee92a8 --- /dev/null +++ b/fs/vfs/CMakeLists.txt @@ -0,0 +1,77 @@ +# ############################################################################## +# fs/vfs/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 + fs_chstat.c + fs_close.c + fs_dir.c + fs_dup2.c + fs_dup.c + fs_epoll.c + fs_fchstat.c + fs_fcntl.c + fs_fstat.c + fs_fstatfs.c + fs_ioctl.c + fs_lseek.c + fs_mkdir.c + fs_open.c + fs_poll.c + fs_pread.c + fs_pwrite.c + fs_read.c + fs_rename.c + fs_rmdir.c + fs_select.c + fs_sendfile.c + fs_stat.c + fs_statfs.c + fs_unlink.c + fs_write.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) +endif() + +# Stream support + +if(CONFIG_FILE_STREAM) + list(APPEND SRCS fs_fdopen.c) +endif() + +# Support for eventfd + +if(CONFIG_EVENT_FD) + list(APPEND SRCS fs_eventfd.c) +endif() + +# Support for timerfd + +if(CONFIG_TIMER_FD) + list(APPEND SRCS fs_timerfd.c) +endif() + +target_sources(fs PRIVATE ${SRCS}) diff --git a/graphics/CMakeLists.txt b/graphics/CMakeLists.txt new file mode 100644 index 0000000000..a8aa2931bc --- /dev/null +++ b/graphics/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# graphics/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. +# +# ############################################################################## +if(CONFIG_NX) + nuttx_add_kernel_library(graphics) + + target_include_directories(graphics PRIVATE nxmu nxbe) + + nuttx_add_subdirectory() +endif() diff --git a/graphics/nxbe/CMakeLists.txt b/graphics/nxbe/CMakeLists.txt new file mode 100644 index 0000000000..1c155ac0da --- /dev/null +++ b/graphics/nxbe/CMakeLists.txt @@ -0,0 +1,56 @@ +# ############################################################################## +# graphics/nxbe/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 + nxbe_bitmap.c + nxbe_configure.c + nxbe_colormap.c + nxbe_clipper.c + nxbe_closewindow.c + nxbe_redraw.c + nxbe_redrawbelow.c + nxbe_setposition.c + nxbe_move.c + nxbe_getrectangle.c + nxbe_fill.c + nxbe_filltrapezoid.c + nxbe_setpixel.c + nxbe_lower.c + nxbe_raise.c + nxbe_modal.c + nxbe_isvisible.c + nxbe_setsize.c + nxbe_setvisibility.c) + +if(CONFIG_NX_RAMBACKED) + list(APPEND SRCS nxbe_flush.c) +endif() + +if(CONFIG_NX_SWCURSOR) + list(APPEND SRCS nxbe_cursor.c nxbe_cursor_backupdraw.c) +elseif(CONFIG_NX_HWCURSOR) + list(APPEND SRCS nxbe_cursor.c) +endif() + +if(CONFIG_NX_UPDATE) + list(APPEND SRCS nxbe_notify_rectangle.c) +endif() + +target_sources(graphics PRIVATE ${SRCS}) diff --git a/graphics/nxglib/CMakeLists.txt b/graphics/nxglib/CMakeLists.txt new file mode 100644 index 0000000000..eb8fa0577c --- /dev/null +++ b/graphics/nxglib/CMakeLists.txt @@ -0,0 +1,82 @@ +# ############################################################################## +# graphics/nxglib/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_aux_library(nxglib) +set(SRCS) + +set(OPERATIONS setpixel fillrectangle getrectangle filltrapezoid moverectangle + copyrectangle) +set(BPPS + 1 + 2 + 8 + 4 + 16 + 24 + 32) + +if(CONFIG_NX_LCDDRIVER) + set(BLITDIR lcd) +else() + set(BLITDIR fb) +endif() + +foreach(op ${OPERATIONS}) + foreach(bpp ${BPPS}) + configure_file(${BLITDIR}/nxglib_${op}.c.in nxglib_${op}_${bpp}bpp.c) + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/nxglib_${op}_${bpp}bpp.c + PROPERTIES COMPILE_FLAGS -DNXGLIB_BITSPERPIXEL=${bpp}) + list(APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/nxglib_${op}_${bpp}bpp.c) + endforeach() +endforeach() + +if(CONFIG_NX_RAMBACKED) + foreach(op ${OPERATIONS}) + foreach(bpp ${BPPS}) + configure_file(pwfb/pwfb_${op}.c.in pwfb_${op}_${bpp}bpp.c) + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/pwfb_${op}_${bpp}bpp.c + PROPERTIES COMPILE_FLAGS -DNXGLIB_BITSPERPIXEL=${bpp}) + list(APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/pwfb_${op}_${bpp}bpp.c) + endforeach() + endforeach() +endif() + +if(CONFIG_NX_SWCURSOR) + set(CURSOR_OPS draw erase backup) + set(CURSOR_BPPS 8 16 24 32) + + foreach(op ${CURSOR_OPS}) + foreach(bpp ${CURSOR_BPPS}) + configure_file(cursor/nxglib_cursor_${op}.c.in + nxglib_cursor_${op}_${bpp}bpp.c) + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/nxglib_cursor_${op}_${bpp}bpp.c + PROPERTIES COMPILE_FLAGS -DNXGLIB_BITSPERPIXEL=${bpp}) + list(APPEND SRCS + ${CMAKE_CURRENT_BINARY_DIR}/nxglib_cursor_${op}_${bpp}bpp.c) + endforeach() + endforeach() +endif() + +target_sources(nxglib PRIVATE ${SRCS}) +target_include_directories(nxglib PUBLIC ${CMAKE_CURRENT_LIST_DIR}) +target_link_libraries(graphics PRIVATE nxglib) diff --git a/graphics/nxmu/CMakeLists.txt b/graphics/nxmu/CMakeLists.txt new file mode 100644 index 0000000000..82b0fe77e8 --- /dev/null +++ b/graphics/nxmu/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# graphics/nxmu/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. +# +# ############################################################################## + +target_sources( + graphics + PRIVATE nxmu_kbdin.c + nxmu_mouse.c + nxmu_openwindow.c + nxmu_redraw.c + nxmu_releasebkgd.c + nxmu_requestbkgd.c + nxmu_reportposition.c + nxmu_sendclient.c + nxmu_sendclientwindow.c + nxmu_server.c + nxmu_start.c) diff --git a/graphics/nxterm/CMakeLists.txt b/graphics/nxterm/CMakeLists.txt new file mode 100644 index 0000000000..e233ce7630 --- /dev/null +++ b/graphics/nxterm/CMakeLists.txt @@ -0,0 +1,49 @@ +# ############################################################################## +# graphics/nxterm/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. +# +# ############################################################################## + +if(CONFIG_NXTERM) + set(SRCS + nx_register.c + nxterm_driver.c + nxterm_font.c + nxterm_putc.c + nxterm_redraw.c + nxterm_resize.c + nxterm_register.c + nxterm_scroll.c + nxterm_vt100.c + nxtk_register.c + nxtool_register.c + nxterm_clear.c) + + if(NOT CONFIG_DISABLE_PSEUDOFS_OPERATIONS) + list(APPEND SRCS nxterm_unregister.c) + endif() + + if(CONFIG_NXTERM_NXKBDIN) + list(APPEND SRCS nxterm_kbdin.c) + endif() + + if(CONFIG_DEBUG_GRAPHICS) + list(APPEND SRCS nxterm_sem.c) + endif() + + target_sources(graphics PRIVATE ${SRCS}) +endif() diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt new file mode 100644 index 0000000000..b761b71ffb --- /dev/null +++ b/libs/CMakeLists.txt @@ -0,0 +1,20 @@ +# ############################################################################## +# libs/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() diff --git a/libs/libc/CMakeLists.txt b/libs/libc/CMakeLists.txt new file mode 100644 index 0000000000..a1e7de67cd --- /dev/null +++ b/libs/libc/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# libs/libc/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_kernel_library(c SPLIT) + +nuttx_add_subdirectory() + +target_include_directories(c PRIVATE ${CMAKE_CURRENT_LIST_DIR}) diff --git a/libs/libc/aio/CMakeLists.txt b/libs/libc/aio/CMakeLists.txt new file mode 100644 index 0000000000..dca2b3ce5e --- /dev/null +++ b/libs/libc/aio/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/aio/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. +# +# ############################################################################## + +if(CONFIG_FS_AIO) + target_sources(c PRIVATE aio_error.c aio_return.c aio_suspend.c lio_listio.c) +endif() diff --git a/libs/libc/assert/CMakeLists.txt b/libs/libc/assert/CMakeLists.txt new file mode 100644 index 0000000000..790509c04f --- /dev/null +++ b/libs/libc/assert/CMakeLists.txt @@ -0,0 +1,27 @@ +# ############################################################################## +# libs/libc/assert/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 lib_assert.c) + +if(CONFIG_STACK_CANARIES) + list(APPEND SRCS lib_stackchk.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/audio/CMakeLists.txt b/libs/libc/audio/CMakeLists.txt new file mode 100644 index 0000000000..8fad703243 --- /dev/null +++ b/libs/libc/audio/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# libs/libc/audio/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. +# +# ############################################################################## + +if(CONFIG_AUDIO) + target_sources(c PRIVATE lib_buffer.c) + nuttx_add_subdirectory() +endif() diff --git a/libs/libc/audio/libsrc/CMakeLists.txt b/libs/libc/audio/libsrc/CMakeLists.txt new file mode 100644 index 0000000000..d750a7f2a2 --- /dev/null +++ b/libs/libc/audio/libsrc/CMakeLists.txt @@ -0,0 +1,49 @@ +# ############################################################################## +# libs/libc/audio/libsrc/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. +# +# ############################################################################## +if(CONFIG_AUDIO_SRC) + set(LIBSRC_VERSION 0.1.9) + + FetchContent_Declare( + libsrc URL https://codeload.github.com/libsndfile/libsamplerate/zip/master) + FetchContent_Populate(libsrc) + FetchContent_GetProperties(libsrc) + + set(LIBSRC_DEFINITIONS -DPACKAGE="libsamplerate" + -DVERSION="${LIBSRC_VERSION}") + + if(CONFIG_SINC_FAST_CONVERTER) + list(APPEND LIBSRC_DEFINITIONS -DENABLE_SINC_FAST_CONVERTER) + endif() + + if(CONFIG_SINC_MEDIUM_CONVERTER) + list(APPEND LIBSRC_DEFINITIONS -DENABLE_SINC_MEDIUM_CONVERTER) + endif() + + if(CONFIG_SINC_BEST_CONVERTER) + list(APPEND LIBSRC_DEFINITIONS -DENABLE_SINC_BEST_CONVERTER) + endif() + + set(SRCS samplerate.c src_sinc.c src_linear.c src_zoh.c) + list(TRANSFORM SRCS PREPEND ${libsrc_SOURCE_DIR}/src/) + target_sources(c PRIVATE ${SRCS}) + + target_compile_definitions(c PRIVATE ${LIBSRC_DEFINITIONS}) + target_include_directories(c PRIVATE ${libsrc_SOURCE_DIR}/include) +endif() diff --git a/libs/libc/bin/CMakeLists.txt b/libs/libc/bin/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/libs/libc/bin/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/libs/libc/builtin/CMakeLists.txt b/libs/libc/builtin/CMakeLists.txt new file mode 100644 index 0000000000..6e5bf230a9 --- /dev/null +++ b/libs/libc/builtin/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# libs/libc/builtin/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. +# +# ############################################################################## + +if(CONFIG_BUILTIN) + set(SRCS lib_builtin_getname.c lib_builtin_isavail.c lib_builtin_forindex.c + lib_builtin_setlist.c) + + target_sources(c PRIVATE ${SRCS}) +endif() diff --git a/libs/libc/ctype/CMakeLists.txt b/libs/libc/ctype/CMakeLists.txt new file mode 100644 index 0000000000..2376e5e2a5 --- /dev/null +++ b/libs/libc/ctype/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# libs/libc/ctype/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. +# +# ############################################################################## + +target_sources( + c + PRIVATE lib_isalnum.c + lib_isalpha.c + lib_isascii.c + lib_isblank.c + lib_iscntrl.c + lib_isdigit.c + lib_isgraph.c + lib_islower.c + lib_isprint.c + lib_ispunct.c + lib_isspace.c + lib_isupper.c + lib_isxdigit.c + lib_tolower.c + lib_toupper.c) diff --git a/libs/libc/dirent/CMakeLists.txt b/libs/libc/dirent/CMakeLists.txt new file mode 100644 index 0000000000..d50f7cc142 --- /dev/null +++ b/libs/libc/dirent/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# libs/libc/dirent/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. +# +# ############################################################################## + +target_sources( + c + PRIVATE lib_alphasort.c + lib_closedir.c + lib_dirfd.c + lib_ftw.c + lib_nftw.c + lib_opendir.c + lib_readdir.c + lib_readdirr.c + lib_rewinddir.c + lib_scandir.c + lib_seekdir.c + lib_telldir.c) diff --git a/libs/libc/dlfcn/CMakeLists.txt b/libs/libc/dlfcn/CMakeLists.txt new file mode 100644 index 0000000000..df8c4f6169 --- /dev/null +++ b/libs/libc/dlfcn/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/dlfcn/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. +# +# ############################################################################## +if(CONFIG_LIBC_DLFCN) + target_sources(c PRIVATE lib_dlopen.c lib_dlclose.c lib_dlsym.c lib_dlerror.c + lib_dlsymtab.c) +endif() diff --git a/libs/libc/errno/CMakeLists.txt b/libs/libc/errno/CMakeLists.txt new file mode 100644 index 0000000000..3e108eb1ed --- /dev/null +++ b/libs/libc/errno/CMakeLists.txt @@ -0,0 +1,20 @@ +# ############################################################################## +# libs/libc/errno/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. +# +# ############################################################################## +target_sources(c PRIVATE lib_errno.c) diff --git a/libs/libc/eventfd/CMakeLists.txt b/libs/libc/eventfd/CMakeLists.txt new file mode 100644 index 0000000000..99230fb234 --- /dev/null +++ b/libs/libc/eventfd/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# libs/libc/eventfd/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. +# +# ############################################################################## +if(CONFIG_EVENT_FD) + target_sources(c PRIVATE lib_eventfd.c) +endif() diff --git a/libs/libc/fixedmath/CMakeLists.txt b/libs/libc/fixedmath/CMakeLists.txt new file mode 100644 index 0000000000..81e0e07dc3 --- /dev/null +++ b/libs/libc/fixedmath/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# libs/libc/fixedmath/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. +# +# ############################################################################## + +target_sources(c PRIVATE lib_fixedmath.c lib_b16sin.c lib_b16cos.c + lib_b16atan2.c lib_ubsqrt.c) diff --git a/libs/libc/grp/CMakeLists.txt b/libs/libc/grp/CMakeLists.txt new file mode 100644 index 0000000000..13e1074003 --- /dev/null +++ b/libs/libc/grp/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# libs/libc/grp/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 lib_getgrgid.c lib_getgrgidr.c lib_getgrnam.c lib_getgrnamr.c + lib_initgroups.c) + +if(CONFIG_LIBC_GROUP_FILE) + list(APPEND SRCS lib_find_grpfile.c lib_grp_globals.c) +else() + list(APPEND SRCS lib_getgrbuf.c lib_getgrbufr.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/hex2bin/CMakeLists.txt b/libs/libc/hex2bin/CMakeLists.txt new file mode 100644 index 0000000000..34ee54a6b6 --- /dev/null +++ b/libs/libc/hex2bin/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/hex2bin/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. +# +# ############################################################################## + +if(CONFIG_LIB_HEX2BIN) + target_sources(c PRIVATE lib_fhex2mem.c lib_hex2bin.c lib_hex2mem.c) +endif() diff --git a/libs/libc/inttypes/CMakeLists.txt b/libs/libc/inttypes/CMakeLists.txt new file mode 100644 index 0000000000..14239dfde9 --- /dev/null +++ b/libs/libc/inttypes/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# libs/libc/inttypes/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. +# +# ############################################################################## + +target_sources(c PRIVATE lib_imaxabs.c lib_strtoimax.c lib_strtoumax.c) diff --git a/libs/libc/kbin/CMakeLists.txt b/libs/libc/kbin/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/libs/libc/kbin/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/libs/libc/libgen/CMakeLists.txt b/libs/libc/libgen/CMakeLists.txt new file mode 100644 index 0000000000..7a5758c576 --- /dev/null +++ b/libs/libc/libgen/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# libs/libc/libgen/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. +# +# ############################################################################## + +target_sources(c PRIVATE lib_basename.c lib_dirname.c) diff --git a/libs/libc/locale/CMakeLists.txt b/libs/libc/locale/CMakeLists.txt new file mode 100644 index 0000000000..e293a05908 --- /dev/null +++ b/libs/libc/locale/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# libs/libc/locale/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. +# +# ############################################################################## + +if(CONFIG_LIBC_LOCALE) + target_sources(c PRIVATE lib_duplocale.c lib_freelocale.c lib_localeconv.c + lib_newlocale.c lib_setlocale.c lib_uselocale.c) +endif() diff --git a/libs/libc/lzf/CMakeLists.txt b/libs/libc/lzf/CMakeLists.txt new file mode 100644 index 0000000000..d0c418cfe4 --- /dev/null +++ b/libs/libc/lzf/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/lzf/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. +# +# ############################################################################## + +if(CONFIG_LIBC_LZF) + target_sources(c PRIVATE lzf_c.c lzf_d.c) +endif() diff --git a/libs/libc/machine/CMakeLists.txt b/libs/libc/machine/CMakeLists.txt new file mode 100644 index 0000000000..9089bb00d2 --- /dev/null +++ b/libs/libc/machine/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# libs/libc/machine/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(${CONFIG_ARCH}) diff --git a/libs/libc/machine/arm/CMakeLists.txt b/libs/libc/machine/arm/CMakeLists.txt new file mode 100644 index 0000000000..03a5a9d0ee --- /dev/null +++ b/libs/libc/machine/arm/CMakeLists.txt @@ -0,0 +1,63 @@ +# ############################################################################## +# libs/libc/machine/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. +# +# ############################################################################## + +set(SRCS) + +if(CONFIG_ARCH_ARM7TDMI) # ARM7TDMI is ARMv4T + add_subdirectory(arm) +elseif(CONFIG_ARCH_ARM920T) # ARM920T is ARMv4T + add_subdirectory(arm) +elseif(CONFIG_ARCH_ARM926EJS) # ARM926EJS is ARMv5TEJ + add_subdirectory(arm) +elseif(CONFIG_ARCH_ARM1136J) # ARM1136J is ARMv6 + add_subdirectory(arm) +elseif(CONFIG_ARCH_ARM1156T2) # ARM1156T2 is ARMv6T2 + add_subdirectory(arm) +elseif(CONFIG_ARCH_ARM1176JZ) # ARM1176JZ is ARMv6Z + add_subdirectory(arm) +elseif(CONFIG_ARCH_ARMV7A) # All ARMv7-A + add_subdirectory(armv7-a) +elseif(CONFIG_ARCH_ARMV7R) # All ARMv7-R + add_subdirectory(armv7-r) +elseif(CONFIG_ARCH_ARMV6M) # All ARMv6-M + add_subdirectory(armv6-m) +elseif(CONFIG_ARCH_ARMV7M) # All ARMv7-M + add_subdirectory(armv7-m) +elseif(CONFIG_ARCH_ARMV8M) # All ARMv8-M + add_subdirectory(armv8-m) +endif() + +if(NOT CONFIG_LIBSUPCXX) + list(APPEND SRCS aeabi_atexit.c) +endif() + +if(CONFIG_CXX_EXCEPTION) + list(APPEND SRCS gnu_unwind_find_exidx.c) +endif() + +if(CONFIG_ARCH_SETJMP_H) + if(CONFIG_ARCH_CHIP_TLSR82) + list(APPEND SRCS gnu/tc32_setjmp.S) + elseif(CONFIG_ARCH_TOOLCHAIN_GNU) + list(APPEND SRCS gnu/arch_setjmp.S) + endif() +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/machine/arm/arm/CMakeLists.txt b/libs/libc/machine/arm/arm/CMakeLists.txt new file mode 100644 index 0000000000..3152f6fb14 --- /dev/null +++ b/libs/libc/machine/arm/arm/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/machine/arm/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. +# +# ############################################################################## + +if(CONFIG_LIBC_ARCH_ELF) + target_sources(c PRIVATE arch_elf.c) +endif() diff --git a/libs/libc/machine/arm/armv6-m/CMakeLists.txt b/libs/libc/machine/arm/armv6-m/CMakeLists.txt new file mode 100644 index 0000000000..853c53ffca --- /dev/null +++ b/libs/libc/machine/arm/armv6-m/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/machine/arm/armv6-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. +# +# ############################################################################## + +if(CONFIG_LIBC_ARCH_ELF) + target_sources(c PRIVATE arch_elf.c) +endif() diff --git a/libs/libc/machine/arm/armv7-a/CMakeLists.txt b/libs/libc/machine/arm/armv7-a/CMakeLists.txt new file mode 100644 index 0000000000..05bd859ebe --- /dev/null +++ b/libs/libc/machine/arm/armv7-a/CMakeLists.txt @@ -0,0 +1,51 @@ +# ############################################################################## +# libs/libc/machine/arm/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. +# +# ############################################################################## + +set(SRCS arch_elf.c) + +if(CONFIG_ARCH_TOOLCHAIN_GNU) + set(ARCH_TOOLCHAIN_DIR gnu) +endif() + +if(CONFIG_ARMV7A_MEMCHR) + list(APPEND SRCS ${ARCH_TOOLCHAIN_DIR}/arch_memchr.S) +endif() + +if(CONFIG_ARMV7A_MEMCPY) + list(APPEND SRCS ${ARCH_TOOLCHAIN_DIR}/arch_memcpy.S) +endif() + +if(CONFIG_ARMV7A_MEMMOVE) + list(APPEND SRCS ${ARCH_TOOLCHAIN_DIR}/arch_memmove.S) +endif() + +if(CONFIG_ARMV7A_MEMSET) + list(APPEND SRCS ${ARCH_TOOLCHAIN_DIR}/arch_memset.S) +endif() + +if(CONFIG_ARMV7A_STRCMP) + list(APPEND SRCS ${ARCH_TOOLCHAIN_DIR}/arch_strcmp.S) +endif() + +if(CONFIG_ARMV7A_STRLEN) + list(APPEND SRCS ${ARCH_TOOLCHAIN_DIR}/arch_strlen.S) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/machine/arm/armv7-m/CMakeLists.txt b/libs/libc/machine/arm/armv7-m/CMakeLists.txt new file mode 100644 index 0000000000..a6bb719f5a --- /dev/null +++ b/libs/libc/machine/arm/armv7-m/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# libs/libc/machine/arm/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. +# +# ############################################################################## + +set(SRCS) + +if(CONFIG_ARMV7M_MEMCPY) + list(APPEND SRCS gnu/arch_memcpy.S) +endif() + +if(CONFIG_LIBC_ARCH_ELF) + list(APPEND SRCS arch_elf.c) +endif() + +if(CONFIG_MACHINE_OPTS_ARMV7M) + if(CONFIG_LIBM_ARCH_FABSF) + list(APPEND SRCS arch_fabsf.c) + endif() + + if(CONFIG_LIBM_ARCH_SQRTF) + list(APPEND SRCS arch_sqrtf.c) + endif() +endif() + +if(CONFIG_ARCH_SETJMP_H) + list(APPEND SRCS gnu/arch_setjmp.S) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/machine/arm/armv7-r/CMakeLists.txt b/libs/libc/machine/arm/armv7-r/CMakeLists.txt new file mode 100644 index 0000000000..62ec1bed47 --- /dev/null +++ b/libs/libc/machine/arm/armv7-r/CMakeLists.txt @@ -0,0 +1,27 @@ +# ############################################################################## +# libs/libc/machine/arm/armv7-r/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. +# +# ############################################################################## + +if(CONFIG_ARMV7R_MEMCPY) + target_sources(c PRIVATE gnu/arch_memcpy.S) +endif() + +if(CONFIG_LIBC_ARCH_ELF) + target_sources(c PRIVATE arch_elf.c) +endif() diff --git a/libs/libc/machine/arm/armv8-m/CMakeLists.txt b/libs/libc/machine/arm/armv8-m/CMakeLists.txt new file mode 100644 index 0000000000..f91afecef5 --- /dev/null +++ b/libs/libc/machine/arm/armv8-m/CMakeLists.txt @@ -0,0 +1,78 @@ +# ############################################################################## +# libs/libc/machine/arm/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) + +if(CONFIG_LIBC_ARCH_ELF) + list(APPEND SRCS arch_elf.c) +endif() + +if(CONFIG_ARMV8M_LIBM) + if(CONFIG_LIBM_ARCH_CEIL) + list(APPEND SRCS arch_ceil.c) + endif() + + if(CONFIG_LIBM_ARCH_CEILF) + list(APPEND SRCS arch_ceilf.c) + endif() + + if(CONFIG_LIBM_ARCH_FLOOR) + list(APPEND SRCS arch_floor.c) + endif() + + if(CONFIG_LIBM_ARCH_FLOORF) + list(APPEND SRCS arch_floorf.c) + endif() + + if(CONFIG_LIBM_ARCH_NEARBYINT) + list(APPEND SRCS arch_nearbyint.c) + endif() + + if(CONFIG_LIBM_ARCH_NEARBYINTF) + list(APPEND SRCS arch_nearbyintf.c) + endif() + + if(CONFIG_LIBM_ARCH_RINTF) + list(APPEND SRCS arch_rintf.c) + endif() + + if(CONFIG_LIBM_ARCH_ROUNDF) + list(APPEND SRCS arch_roundf.c) + endif() + + if(CONFIG_LIBM_ARCH_TRUNCF) + list(APPEND SRCS arch_truncf.c) + endif() + + if(CONFIG_LIBM_ARCH_RINT) + list(APPEND SRCS arch_rint.c) + endif() + + if(CONFIG_LIBM_ARCH_ROUND) + list(APPEND SRCS arch_round.c) + endif() + + if(CONFIG_LIBM_ARCH_TRUNC) + list(APPEND SRCS arch_trunc.c) + endif() + +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/machine/risc-v/CMakeLists.txt b/libs/libc/machine/risc-v/CMakeLists.txt new file mode 100644 index 0000000000..69f303841f --- /dev/null +++ b/libs/libc/machine/risc-v/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# libs/libc/machine/risc-v/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) + +if(CONFIG_ARCH_RV64GC) + add_subdirectory(rv64) +endif() + +if(CONFIG_ARCH_RV32IM) + add_subdirectory(rv32) +endif() diff --git a/libs/libc/machine/risc-v/common/CMakeLists.txt b/libs/libc/machine/risc-v/common/CMakeLists.txt new file mode 100644 index 0000000000..ea338cbfdd --- /dev/null +++ b/libs/libc/machine/risc-v/common/CMakeLists.txt @@ -0,0 +1,30 @@ +# ############################################################################## +# libs/libc/machine/risc-v/common/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) + +if(CONFIG_LIBC_ARCH_ELF) + list(APPEND SRCS arch_elf.c) +endif() + +if(CONFIG_ARCH_SETJMP_H) + list(APPEND SRCS arch_setjmp.S) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/machine/risc-v/rv32/CMakeLists.txt b/libs/libc/machine/risc-v/rv32/CMakeLists.txt new file mode 100644 index 0000000000..5563a43f2c --- /dev/null +++ b/libs/libc/machine/risc-v/rv32/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# libs/libc/machine/risc-v/rv32/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. +# +# ############################################################################## +if(CONFIG_RISCV_MEMCPY) + target_sources(c PRIVATE arch_memcpy.S) +endif() diff --git a/libs/libc/machine/risc-v/rv64/CMakeLists.txt b/libs/libc/machine/risc-v/rv64/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/libs/libc/machine/risc-v/rv64/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/libs/libc/machine/sim/CMakeLists.txt b/libs/libc/machine/sim/CMakeLists.txt new file mode 100644 index 0000000000..22ccff0bdb --- /dev/null +++ b/libs/libc/machine/sim/CMakeLists.txt @@ -0,0 +1,68 @@ +# ############################################################################## +# libs/libc/machine/sim/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. +# +# ############################################################################## + +# XXX ELF relocations are not actually sim-dependent. TODO: We should share the +# code with eg. ../x86/arch_elf.c. + +set(SRCS) + +if(CONFIG_HOST_X86_64) + if(CONFIG_SIM_M32) + if(CONFIG_LIBC_ARCH_ELF) + list(APPEND SRCS arch_elf.c) + endif() + if(CONFIG_ARCH_SETJMP_H) + if(WIN32) + list(APPEND SRCS arch_setjmp_x86.asm) + else() + list(APPEND SRCS arch_setjmp_x86.S) + endif() + endif() + else() + if(CONFIG_LIBC_ARCH_ELF) + list(APPEND SRCS arch_elf64.c) + endif() + if(CONFIG_ARCH_SETJMP_H) + list(APPEND SRCS arch_setjmp_x86_64.S) + endif() + endif() + +elseif(CONFIG_HOST_X86) + if(CONFIG_LIBC_ARCH_ELF) + list(APPEND SRCS arch_elf.c) + endif() + if(CONFIG_ARCH_SETJMP_H) + if(WIN32) + list(APPEND SRCS arch_setjmp_x86.asm) + else() + list(APPEND SRCS arch_setjmp_x86.S) + endif() + endif() +elseif(CONFIG_HOST_ARM) + if(CONFIG_ARCH_SETJMP_H) + list(APPEND SRCS arch_setjmp_arm.S) + endif() +elseif(CONFIG_HOST_ARM64) + if(CONFIG_ARCH_SETJMP_H) + list(APPEND SRCS arch_setjmp_arm64.S) + endif() +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/machine/x86/CMakeLists.txt b/libs/libc/machine/x86/CMakeLists.txt new file mode 100644 index 0000000000..1aa14b6629 --- /dev/null +++ b/libs/libc/machine/x86/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# libs/libc/machine/x86/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. +# +# ############################################################################## +if(CONFIG_LIBC_ARCH_ELF) + target_sources(c PRIVATE arch_elf.c) +endif() diff --git a/libs/libc/machine/xtensa/CMakeLists.txt b/libs/libc/machine/xtensa/CMakeLists.txt new file mode 100644 index 0000000000..25fbb0291f --- /dev/null +++ b/libs/libc/machine/xtensa/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# libs/libc/machine/xtensa/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. +# +# ############################################################################## +if(CONFIG_LIBC_ARCH_ELF) + target_sources(c PRIVATE arch_elf.c) +endif() diff --git a/libs/libc/misc/CMakeLists.txt b/libs/libc/misc/CMakeLists.txt new file mode 100644 index 0000000000..4add363982 --- /dev/null +++ b/libs/libc/misc/CMakeLists.txt @@ -0,0 +1,101 @@ +# ############################################################################## +# libs/libc/misc/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 the internal C files to the build + +list( + APPEND + SRCS + lib_mknod.c + lib_umask.c + lib_utsname.c + lib_getrandom.c + lib_xorshift128.c + lib_tea_encrypt.c + lib_tea_decrypt.c + lib_cxx_initialize.c + lib_impure.c + lib_memfd.c + lib_mutex.c + lib_fchmodat.c + lib_fstatat.c + lib_getfullpath.c + lib_openat.c + lib_mkdirat.c + lib_utimensat.c) + +# Support for platforms that do not have long long types + +list( + APPEND + SRCS + lib_umul32.c + lib_umul64.c + lib_umul32x64.c + lib_uadd32x64.c + lib_uadd64.c + lib_usub64x32.c + lib_usub64.c) + +if(CONFIG_PIPES) + list(APPEND SRCS lib_mkfifo.c) +endif() + +# Add the miscellaneous C files to the build + +list( + APPEND + SRCS + lib_dumpbuffer.c + lib_dumpvbuffer.c + lib_fnmatch.c + lib_debug.c + lib_crc64.c + lib_crc32.c + lib_crc16.c + lib_crc16ccitt.c + lib_crc8.c + lib_crc8ccitt.c + lib_crc8table.c + lib_glob.c + lib_execinfo.c + lib_ftok.c + lib_err.c) + +# Keyboard driver encoder/decoder + +if(CONFIG_LIBC_KBDCODEC) + list(APPEND SRCS lib_kbdencode.c lib_kbddecode.c) +endif() + +# SLCD driver encoder/decoder + +if(CONFIG_LIBC_SLCDCODEC) + list(APPEND SRCS lib_slcdencode.c lib_slcddecode.c) +endif() + +# Environment search path support + +if(CONFIG_LIBC_ENVPATH) + list(APPEND SRCS lib_envpath.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/modlib/CMakeLists.txt b/libs/libc/modlib/CMakeLists.txt new file mode 100644 index 0000000000..1e62937bef --- /dev/null +++ b/libs/libc/modlib/CMakeLists.txt @@ -0,0 +1,40 @@ +# ############################################################################## +# libs/libc/modlib/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. +# +# ############################################################################## + +if(CONFIG_LIBC_MODLIB) + + target_sources( + c + PRIVATE modlib_bind.c + modlib_depend.c + modlib_init.c + modlib_iobuffer.c + modlib_load.c + modlib_loadshdrs.c + modlib_read.c + modlib_registry.c + modlib_sections.c + modlib_symbols.c + modlib_symtab.c + modlib_uninit.c + modlib_unload.c + modlib_verify.c) + +endif() diff --git a/libs/libc/net/CMakeLists.txt b/libs/libc/net/CMakeLists.txt new file mode 100644 index 0000000000..f14620cf08 --- /dev/null +++ b/libs/libc/net/CMakeLists.txt @@ -0,0 +1,61 @@ +# ############################################################################## +# libs/libc/net/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 + lib_addrconfig.c + lib_base64.c + lib_htons.c + lib_htonl.c + lib_inetaddr.c + lib_inetaton.c + lib_inetntoa.c + lib_inetntop.c + lib_inetpton.c + lib_inetnetwork.c + lib_etherntoa.c + lib_etheraton.c) + +if(CONFIG_NET) + list(APPEND SRCS lib_accept.c) +endif() + +if(CONFIG_NET_LOOPBACK) + list(APPEND SRCS lib_loopback.c) +endif() + +if(CONFIG_NETDEV_IFINDEX) + list( + APPEND + SRCS + lib_getifaddrs.c + lib_freeifaddrs.c + lib_indextoname.c + lib_nametoindex.c + lib_nameindex.c + lib_freenameindex.c) +endif() + +# Routing table support + +if(CONFIG_NET_ROUTE) + list(APPEND SRCS lib_addroute.c lib_delroute.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/netdb/CMakeLists.txt b/libs/libc/netdb/CMakeLists.txt new file mode 100644 index 0000000000..4ed5835e02 --- /dev/null +++ b/libs/libc/netdb/CMakeLists.txt @@ -0,0 +1,65 @@ +# ############################################################################## +# libs/libc/netdb/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. +# +# ############################################################################## + +if(CONFIG_LIBC_NETDB) + set(SRCS) + + # Add the netdb C files to the build + + list( + APPEND + SRCS + lib_netdb.c + lib_gethostbyname.c + lib_gethostbynamer.c + lib_gethostbyname2.c + lib_gethostbyname2r.c + lib_gethostentbynamer.c + lib_gethostbyaddr.c + lib_gethostbyaddrr.c + lib_getservbyname.c + lib_getservbynamer.c + lib_getservbyport.c + lib_getservbyportr.c + lib_gaistrerror.c + lib_freeaddrinfo.c + lib_getaddrinfo.c + lib_getnameinfo.c) + + # Add host file support + + if(CONFIG_NETDB_HOSTFILE) + list(APPEND SRCS lib_parsehostfile.c) + endif() + + # Add DNS lookup support + + if(CONFIG_NETDB_DNSCLIENT) + list(APPEND SRCS lib_dnsinit.c lib_dnsbind.c lib_dnsquery.c) + list(APPEND SRCS lib_dnsaddserver.c lib_dnsdefaultserver.c) + list(APPEND SRCS lib_dnsforeach.c lib_dnsnotify.c) + + if(NOT CONFIG_NETDB_DNSCLIENT_ENTRIES EQUAL 0) + list(APPEND SRCS lib_dnscache.c) + endif() + endif() + + target_sources(c PRIVATE ${SRCS}) +endif() diff --git a/libs/libc/pthread/CMakeLists.txt b/libs/libc/pthread/CMakeLists.txt new file mode 100644 index 0000000000..5395178949 --- /dev/null +++ b/libs/libc/pthread/CMakeLists.txt @@ -0,0 +1,110 @@ +# ############################################################################## +# libs/libc/pthread/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) + +if(NOT CONFIG_TLS_NELEM EQUAL 0) + list(APPEND SRCS pthread_keycreate.c pthread_setspecific.c + pthread_getspecific.c pthread_keydelete.c) +endif() + +if(NOT CONFIG_DISABLE_PTHREAD) + # Add the pthread C files to the build + + list( + APPEND + SRCS + pthread_attr_init.c + pthread_attr_destroy.c + pthread_attr_setschedpolicy.c + pthread_attr_getschedpolicy.c + pthread_attr_setinheritsched.c + pthread_attr_getinheritsched.c + pthread_attr_setdetachstate.c + pthread_attr_getdetachstate.c + pthread_attr_setstackaddr.c + pthread_attr_getstackaddr.c + pthread_attr_setstacksize.c + pthread_attr_getstacksize.c + pthread_attr_setstack.c + pthread_attr_getstack.c + pthread_attr_setschedparam.c + pthread_attr_getschedparam.c + pthread_barrierattr_init.c + pthread_barrierattr_destroy.c + pthread_barrierattr_getpshared.c + pthread_barrierattr_setpshared.c + pthread_barrierinit.c + pthread_barrierdestroy.c + pthread_condattr_init.c + pthread_condattr_destroy.c + pthread_condattr_getpshared.c + pthread_condattr_setpshared.c + pthread_condattr_setclock.c + pthread_condattr_getclock.c + pthread_condinit.c + pthread_conddestroy.c + pthread_condtimedwait.c + pthread_create.c + pthread_exit.c + pthread_kill.c + pthread_setname_np.c + pthread_getname_np.c + pthread_get_stackaddr_np.c + pthread_get_stacksize_np.c + pthread_mutexattr_init.c + pthread_mutexattr_destroy.c + pthread_mutexattr_getpshared.c + pthread_mutexattr_setpshared.c + pthread_mutexattr_setprotocol.c + pthread_mutexattr_getprotocol.c + pthread_mutexattr_settype.c + pthread_mutexattr_gettype.c + pthread_mutexattr_setrobust.c + pthread_mutexattr_getrobust.c + pthread_mutex_lock.c + pthread_once.c + pthread_yield.c + pthread_atfork.c + pthread_rwlockattr_init.c + pthread_rwlockattr_destroy.c + pthread_rwlockattr_getpshared.c + pthread_rwlockattr_setpshared.c + pthread_rwlock.c + pthread_rwlock_rdlock.c + pthread_rwlock_wrlock.c + pthread_setcancelstate.c + pthread_setcanceltype.c + pthread_testcancel.c) + + if(CONFIG_SMP) + list(APPEND SRCS pthread_attr_getaffinity.c pthread_attr_setaffinity.c) + endif() + + if(CONFIG_PTHREAD_SPINLOCKS) + list(APPEND SRCS pthread_spinlock.c) + endif() + + if(CONFIG_PTHREAD_CLEANUP) + list(APPEND SRCS pthread_cleanup.c) + endif() +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/pwd/CMakeLists.txt b/libs/libc/pwd/CMakeLists.txt new file mode 100644 index 0000000000..4225523d6d --- /dev/null +++ b/libs/libc/pwd/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# libs/libc/pwd/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 lib_getpwnam.c lib_getpwnamr.c lib_getpwuid.c lib_getpwuidr.c) + +if(CONFIG_LIBC_PASSWD_FILE) + list(APPEND SRCS lib_find_pwdfile.c lib_pwd_globals.c) +else() + list(APPEND SRCS lib_getpwbuf.c lib_getpwbufr.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/queue/CMakeLists.txt b/libs/libc/queue/CMakeLists.txt new file mode 100644 index 0000000000..5b9467347b --- /dev/null +++ b/libs/libc/queue/CMakeLists.txt @@ -0,0 +1,32 @@ +# ############################################################################## +# libs/libc/queue/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. +# +# ############################################################################## + +target_sources( + c + PRIVATE sq_addafter.c + sq_remlast.c + sq_remfirst.c + sq_remafter.c + sq_count.c + dq_addafter.c + dq_remlast.c + dq_remfirst.c + dq_remafter.c + dq_count.c) diff --git a/libs/libc/sched/CMakeLists.txt b/libs/libc/sched/CMakeLists.txt new file mode 100644 index 0000000000..a60c0e2990 --- /dev/null +++ b/libs/libc/sched/CMakeLists.txt @@ -0,0 +1,40 @@ +# ############################################################################## +# libs/libc/sched/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 sched_getprioritymax.c sched_getprioritymin.c clock_ticks2time.c + clock_time2ticks.c clock_timespec_add.c clock_timespec_subtract.c) + +if(NOT CONFIG_CANCELLATION_POINTS) + list(APPEND SRCS task_setcanceltype.c task_testcancel.c) +endif() + +if(CONFIG_SMP) + list(APPEND SRCS sched_cpucount.c) +endif() + +if(NOT CONFIG_BUILD_KERNEL) + list(APPEND SRCS task_startup.c) + + if(CONFIG_SCHED_BACKTRACE) + list(APPEND SRCS sched_dumpstack.c sched_backtrace.c) + endif() +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/semaphore/CMakeLists.txt b/libs/libc/semaphore/CMakeLists.txt new file mode 100644 index 0000000000..0a8ef02b92 --- /dev/null +++ b/libs/libc/semaphore/CMakeLists.txt @@ -0,0 +1,27 @@ +# ############################################################################## +# libs/libc/semaphore/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 sem_init.c sem_getprotocol.c sem_getvalue.c) + +if(NOT CONFIG_PRIORITY_INHERITANCE) + list(APPEND SRCS sem_setprotocol.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/signal/CMakeLists.txt b/libs/libc/signal/CMakeLists.txt new file mode 100644 index 0000000000..177d25c9ac --- /dev/null +++ b/libs/libc/signal/CMakeLists.txt @@ -0,0 +1,42 @@ +# ############################################################################## +# libs/libc/signal/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. +# +# ############################################################################## + +target_sources( + c + PRIVATE sig_addset.c + sig_delset.c + sig_emptyset.c + sig_fillset.c + sig_nandset.c + sig_andset.c + sig_orset.c + sig_xorset.c + sig_isemptyset.c + sig_hold.c + sig_ignore.c + sig_ismember.c + sig_pause.c + sig_psignal.c + sig_raise.c + sig_relse.c + sig_set.c + sig_signal.c + sig_wait.c + sig_killpg.c) diff --git a/libs/libc/spawn/CMakeLists.txt b/libs/libc/spawn/CMakeLists.txt new file mode 100644 index 0000000000..ac89bb7943 --- /dev/null +++ b/libs/libc/spawn/CMakeLists.txt @@ -0,0 +1,53 @@ +# ############################################################################## +# libs/libc/spawn/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 + lib_psfa_addaction.c + lib_psfa_addclose.c + lib_psfa_adddup2.c + lib_psfa_addopen.c + lib_psfa_destroy.c + lib_psfa_init.c + lib_psa_getflags.c + lib_psa_getschedparam.c + lib_psa_getschedpolicy.c + lib_psa_init.c + lib_psa_setflags.c + lib_psa_setschedparam.c + lib_psa_setschedpolicy.c + lib_psa_getsigmask.c + lib_psa_setsigmask.c) + +if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS lib_psfa_dump.c) +endif() + +if(NOT CONFIG_BUILD_KERNEL) + list(APPEND SRCS lib_psa_getstacksize.c lib_psa_setstacksize.c) + if(CONFIG_LIB_SYSCALL) + list(APPEND SRCS lib_task_spawn.c) + endif() +endif() + +if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS lib_psa_dump.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/stdio/CMakeLists.txt b/libs/libc/stdio/CMakeLists.txt new file mode 100644 index 0000000000..314ca36e22 --- /dev/null +++ b/libs/libc/stdio/CMakeLists.txt @@ -0,0 +1,106 @@ +# ############################################################################## +# libs/libc/stdio/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. +# +# ############################################################################## + +# This first group of C files do not depend on having C streams. + +set(SRCS + lib_fileno.c + lib_printf.c + lib_sprintf.c + lib_asprintf.c + lib_snprintf.c + lib_libsprintf.c + lib_vsprintf.c + lib_vasprintf.c + lib_vsnprintf.c + lib_dprintf.c + lib_vdprintf.c + lib_vprintf.c + lib_perror.c + lib_putchar.c + lib_getchar.c + lib_puts.c + lib_sscanf.c + lib_vsscanf.c + lib_libvscanf.c + lib_libvsprintf.c + lib_remove.c + lib_tempnam.c + lib_tmpnam.c + lib_ultoa_invert.c) + +if(CONFIG_LIBC_FLOATINGPOINT) + list(APPEND SRCS lib_dtoa_engine.c lib_dtoa_data.c) +endif() + +# The remaining sources files depend upon C streams + +if(CONFIG_FILE_STREAM) + list( + APPEND + SRCS + lib_fopen.c + lib_freopen.c + lib_fclose.c + lib_fread.c + lib_libfread.c + lib_fseek.c + lib_fseeko.c + lib_ftell.c + lib_ftello.c + lib_fsetpos.c + lib_getdelim.c + lib_fgetpos.c + lib_getc.c + lib_fgetc.c + lib_fgets.c + lib_gets_s.c + lib_gets.c + lib_libfgets.c + lib_fwrite.c + lib_libfwrite.c + lib_fflush.c + lib_libflushall.c + lib_libfflush.c + lib_rdflush.c + lib_wrflush.c + lib_putc.c + lib_fputc.c + lib_fputs.c + lib_ungetc.c + lib_fprintf.c + lib_vfprintf.c + lib_feof.c + lib_ferror.c + lib_rewind.c + lib_clearerr.c + lib_scanf.c + lib_vscanf.c + lib_fscanf.c + lib_vfscanf.c + lib_tmpfile.c + lib_setbuf.c + lib_setvbuf.c + lib_libstream.c + lib_libfilelock.c + lib_libgetstreams.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/stdlib/CMakeLists.txt b/libs/libc/stdlib/CMakeLists.txt new file mode 100644 index 0000000000..bc233a9b74 --- /dev/null +++ b/libs/libc/stdlib/CMakeLists.txt @@ -0,0 +1,67 @@ +# ############################################################################## +# libs/libc/stdlib/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 the stdlib C files to the build + +set(SRCS + lib_abs.c + lib_abort.c + lib_atof.c + lib_atoi.c + lib_getprogname.c + lib_atol.c + lib_atoll.c + lib_div.c + lib_ldiv.c + lib_lldiv.c + lib_exit.c + lib_itoa.c + lib_labs.c + lib_llabs.c + lib_realpath.c + lib_bsearch.c + lib_rand.c + lib_rand48.c + lib_qsort.c + lib_srand.c + lib_strtol.c + lib_strtoll.c + lib_strtoul.c + lib_strtoull.c + lib_strtold.c + lib_checkbase.c + lib_mktemp.c + lib_mkstemp.c + lib_mkdtemp.c + lib_aligned_alloc.c + lib_posix_memalign.c + lib_valloc.c + lib_mblen.c + lib_mbtowc.c + lib_wctomb.c + lib_mbstowcs.c + lib_wcstombs.c + lib_atexit.c) + +if(CONFIG_PSEUDOTERM) + list(APPEND SRCS lib_ptsname.c lib_ptsnamer.c lib_unlockpt.c lib_openpty.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/stream/CMakeLists.txt b/libs/libc/stream/CMakeLists.txt new file mode 100644 index 0000000000..fc6b53ad7b --- /dev/null +++ b/libs/libc/stream/CMakeLists.txt @@ -0,0 +1,56 @@ +# ############################################################################## +# libs/libc/stream/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. +# +# ############################################################################## +list( + APPEND + SRCS + lib_meminstream.c + lib_memoutstream.c + lib_memsistream.c + lib_memsostream.c + lib_lowoutstream.c + lib_rawinstream.c + lib_rawoutstream.c + lib_rawsistream.c + lib_rawsostream.c + lib_zeroinstream.c + lib_nullinstream.c + lib_nulloutstream.c + lib_mtdoutstream.c + lib_libnoflush.c + lib_libsnoflush.c + lib_syslogstream.c + lib_syslograwstream.c + lib_bufferedoutstream.c + lib_hexdumpstream.c) + +if(CONFIG_FILE_STREAM) + list(APPEND SRCS lib_stdinstream.c lib_stdoutstream.c lib_stdsistream.c + lib_stdsostream.c) +endif() + +if(CONFIG_LIBC_LZF) + list(APPEND SRCS lib_lzfcompress.c) +endif() + +if(NOT CONFIG_DISABLE_MOUNTPOINT) + list(APPEND SRCS lib_blkoutstream.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/string/CMakeLists.txt b/libs/libc/string/CMakeLists.txt new file mode 100644 index 0000000000..7d7e216f07 --- /dev/null +++ b/libs/libc/string/CMakeLists.txt @@ -0,0 +1,124 @@ +# ############################################################################## +# libs/libc/string/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 the string C files to the build + +set(SRCS + lib_ffs.c + lib_ffsl.c + lib_ffsll.c + lib_fls.c + lib_flsl.c + lib_flsll.c + lib_isbasedigit.c + lib_memccpy.c + lib_memrchr.c + lib_memmem.c + lib_popcount.c + lib_popcountl.c + lib_popcountll.c + lib_skipspace.c + lib_stpcpy.c + lib_stpncpy.c + lib_strcasecmp.c + lib_strcat.c + lib_strcspn.c + lib_strchrnul.c + lib_strdup.c + lib_strerror.c + lib_strncasecmp.c + lib_strncat.c + lib_strncmp.c + lib_strndup.c + lib_strcasestr.c + lib_strpbrk.c + lib_strrchr.c + lib_strspn.c + lib_strstr.c + lib_strtok.c + lib_strtokr.c + lib_strsep.c + lib_strerrorr.c + lib_explicit_bzero.c + lib_strsignal.c + lib_index.c + lib_rindex.c) + +if(NOT CONFIG_LIBC_ARCH_MEMCHR) + list(APPEND SRCS lib_memchr.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_MEMCMP) + list(APPEND SRCS lib_memcmp.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_MEMCPY) + if(CONFIG_MEMCPY_VIK) + list(APPEND SRCS lib_vikmemcpy.c) + else() + list(APPEND SRCS lib_memcpy.c) + endif() +endif() + +if(NOT CONFIG_LIBC_ARCH_MEMMOVE) + list(APPEND SRCS lib_memmove.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_MEMSET) + list(APPEND SRCS lib_memset.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRCHR) + list(APPEND SRCS lib_strchr.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRCMP) + list(APPEND SRCS lib_strcmp.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRCPY) + list(APPEND SRCS lib_strcpy.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRLCAT) + list(APPEND SRCS lib_strlcat.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRLCPY) + list(APPEND SRCS lib_strlcpy.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRLEN) + list(APPEND SRCS lib_strlen.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRNCPY) + list(APPEND SRCS lib_strncpy.c) +endif() + +if(NOT CONFIG_LIBC_ARCH_STRNLEN) + list(APPEND SRCS lib_strnlen.c) +endif() + +if(CONFIG_LIBC_LOCALE) + list(APPEND SRCS lib_strcoll.c lib_strxfrm.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/symtab/CMakeLists.txt b/libs/libc/symtab/CMakeLists.txt new file mode 100644 index 0000000000..d567382c41 --- /dev/null +++ b/libs/libc/symtab/CMakeLists.txt @@ -0,0 +1,27 @@ +# ############################################################################## +# libs/libc/symtab/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 symtab_findbyname.c symtab_findbyvalue.c symtab_sortbyname.c) + +if(CONFIG_ALLSYMS) + list(APPEND SRCS symtab_allsyms.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/syslog/CMakeLists.txt b/libs/libc/syslog/CMakeLists.txt new file mode 100644 index 0000000000..8db92ad415 --- /dev/null +++ b/libs/libc/syslog/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# libs/libc/syslog/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. +# +# ############################################################################## + +target_sources(c PRIVATE lib_setlogmask.c lib_syslog.c) diff --git a/libs/libc/termios/CMakeLists.txt b/libs/libc/termios/CMakeLists.txt new file mode 100644 index 0000000000..eefb89fa0b --- /dev/null +++ b/libs/libc/termios/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# libs/libc/termios/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. +# +# ############################################################################## + +target_sources( + c + PRIVATE lib_cfspeed.c + lib_cfmakeraw.c + lib_isatty.c + lib_tcflush.c + lib_tcdrain.c + lib_tcflow.c + lib_tcgetattr.c + lib_tcsetattr.c + lib_tcsendbreak.c + lib_ttyname.c + lib_ttynamer.c) diff --git a/libs/libc/time/CMakeLists.txt b/libs/libc/time/CMakeLists.txt new file mode 100644 index 0000000000..611dadfa93 --- /dev/null +++ b/libs/libc/time/CMakeLists.txt @@ -0,0 +1,47 @@ +# ############################################################################## +# libs/libc/time/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 + lib_strftime.c + lib_strptime.c + lib_calendar2utc.c + lib_daysbeforemonth.c + lib_gettimeofday.c + lib_isleapyear.c + lib_settimeofday.c + lib_time.c + lib_timespec_get.c + lib_nanosleep.c + lib_difftime.c + lib_dayofweek.c + lib_asctime.c + lib_asctimer.c + lib_ctime.c + lib_ctimer.c + lib_gethrtime.c) + +if(CONFIG_LIBC_LOCALTIME) + list(APPEND SRCS lib_localtime.c) +else() + list(APPEND SRCS lib_timegm.c lib_gmtime.c lib_gmtimer.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/tls/CMakeLists.txt b/libs/libc/tls/CMakeLists.txt new file mode 100644 index 0000000000..2f73278a0a --- /dev/null +++ b/libs/libc/tls/CMakeLists.txt @@ -0,0 +1,31 @@ +# ############################################################################## +# libs/libc/tls/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 task_getinfo.c tls_getinfo.c) + +if(NOT CONFIG_TLS_TASK_NELEM EQUAL 0) + list(APPEND SRCS task_tls.c) +endif() + +if(NOT CONFIG_TLS_NELEM EQUAL 0) + list(APPEND SRCS tls_destruct.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/uio/CMakeLists.txt b/libs/libc/uio/CMakeLists.txt new file mode 100644 index 0000000000..1226478466 --- /dev/null +++ b/libs/libc/uio/CMakeLists.txt @@ -0,0 +1,21 @@ +# ############################################################################## +# libs/libc/uio/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. +# +# ############################################################################## + +target_sources(c PRIVATE lib_readv.c lib_writev.c) diff --git a/libs/libc/unistd/CMakeLists.txt b/libs/libc/unistd/CMakeLists.txt new file mode 100644 index 0000000000..25a3d4d843 --- /dev/null +++ b/libs/libc/unistd/CMakeLists.txt @@ -0,0 +1,83 @@ +# ############################################################################## +# libs/libc/unistd/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 + lib_access.c + lib_daemon.c + lib_swab.c + lib_pathconf.c + lib_sysconf.c + lib_getentropy.c + lib_getopt_common.c + lib_getopt.c + lib_getopt_long.c + lib_getopt_longonly.c + lib_getoptvars.c + lib_getoptargp.c + lib_getopterrp.c + lib_getoptindp.c + lib_getoptoptp.c + lib_times.c + lib_alarm.c + lib_fstatvfs.c + lib_statvfs.c + lib_sleep.c + lib_nice.c + lib_usleep.c + lib_seteuid.c + lib_setegid.c + lib_geteuid.c + lib_getegid.c + lib_setreuid.c + lib_setregid.c + lib_getrusage.c + lib_utime.c + lib_utimes.c + lib_setrlimit.c + lib_getrlimit.c + lib_setpriority.c + lib_getpriority.c + lib_futimes.c + lib_lutimes.c + lib_gethostname.c + lib_sethostname.c + lib_fchownat.c + lib_linkat.c + lib_readlinkat.c + lib_symlinkat.c + lib_unlinkat.c) + +if(NOT CONFIG_SCHED_USER_IDENTITY) + list(APPEND SRCS lib_setuid.c lib_setgid.c lib_getuid.c lib_getgid.c) +endif() + +if(NOT CONFIG_DISABLE_ENVIRON) + list(APPEND SRCS lib_chdir.c lib_fchdir.c lib_getcwd.c lib_restoredir.c) +endif() + +if(CONFIG_LIBC_EXECFUNCS) + list(APPEND SRCS lib_execl.c lib_execle.c lib_execv.c) +endif() + +if(NOT CONFIG_DISABLE_MOUNTPOINTS) + list(APPEND SRCS lib_truncate.c lib_posix_fallocate.c) +endif() + +target_sources(c PRIVATE ${SRCS}) diff --git a/libs/libc/userfs/CMakeLists.txt b/libs/libc/userfs/CMakeLists.txt new file mode 100644 index 0000000000..96b737d465 --- /dev/null +++ b/libs/libc/userfs/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# libs/libc/userfs/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. +# +# ############################################################################## + +if(CONFIG_FS_USERFS) + target_sources(c PRIVATE lib_userfs.c) +endif() diff --git a/libs/libc/uuid/CMakeLists.txt b/libs/libc/uuid/CMakeLists.txt new file mode 100644 index 0000000000..13f02a6070 --- /dev/null +++ b/libs/libc/uuid/CMakeLists.txt @@ -0,0 +1,30 @@ +# ############################################################################## +# libs/libc/uuid/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. +# +# ############################################################################## +target_sources( + c + PRIVATE lib_uuid_compare.c + lib_uuid_create.c + lib_uuid_create_nil.c + lib_uuid_equal.c + lib_uuid_from_string.c + lib_uuid_hash.c + lib_uuid_is_nil.c + lib_uuid_stream.c + lib_uuid_to_string.c) diff --git a/libs/libc/wchar/CMakeLists.txt b/libs/libc/wchar/CMakeLists.txt new file mode 100644 index 0000000000..d0b728cea6 --- /dev/null +++ b/libs/libc/wchar/CMakeLists.txt @@ -0,0 +1,51 @@ +# ############################################################################## +# libs/libc/wchar/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. +# +# ############################################################################## + +target_sources( + c + PRIVATE lib_wcscmp.c + lib_wcslen.c + lib_wmemchr.c + lib_wmemcmp.c + lib_wmemcpy.c + lib_wmemmove.c + lib_wmemset.c + lib_btowc.c + lib_mbrtowc.c + lib_wctob.c + lib_wcslcpy.c + lib_wcsxfrm.c + lib_wcrtomb.c + lib_wcsftime.c + lib_wcscoll.c + lib_wcstol.c + lib_wcstoll.c + lib_wcstoul.c + lib_wcstoull.c + lib_wcstold.c + lib_wcstof.c + lib_wcstod.c + lib_swprintf.c + lib_mbsnrtowcs.c + lib_wcsnrtombs.c + lib_mbsinit.c + lib_mbrlen.c + lib_mbsrtowcs.c + lib_wcsrtombs.c) diff --git a/libs/libc/wctype/CMakeLists.txt b/libs/libc/wctype/CMakeLists.txt new file mode 100644 index 0000000000..d02a0b4b17 --- /dev/null +++ b/libs/libc/wctype/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# libs/libc/wctype/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. +# +# ############################################################################## + +target_sources(c PRIVATE lib_wctype.c lib_iswctype.c lib_towlower.c + lib_towupper.c) diff --git a/libs/libc/wqueue/CMakeLists.txt b/libs/libc/wqueue/CMakeLists.txt new file mode 100644 index 0000000000..673c9d06fe --- /dev/null +++ b/libs/libc/wqueue/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# libs/libc/wqueue/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. +# +# ############################################################################## + +if(CONFIG_LIB_USRWORK) + target_sources(c PRIVATE work_usrthread.c work_queue.c work_cancel.c + work_signal.c work_lock.c) +endif() diff --git a/libs/libc/zoneinfo/CMakeLists.txt b/libs/libc/zoneinfo/CMakeLists.txt new file mode 100644 index 0000000000..736c09fe1e --- /dev/null +++ b/libs/libc/zoneinfo/CMakeLists.txt @@ -0,0 +1,47 @@ +# ############################################################################## +# libs/libc/zoneinfo/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. +# +# ############################################################################## +if(CONFIG_LIB_ZONEINFO_ROMFS) + FetchContent_Declare(tzcode URL http://ftp.iana.org/tz/tzcode-latest.tar.gz) + FetchContent_Declare(tzdata URL http://ftp.iana.org/tz/tzdata-latest.tar.gz) + FetchContent_Populate(tzcode) + FetchContent_Populate(tzdata) + + file(COPY ${tzcode_SOURCE_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tz) + file(COPY ${tzdata_SOURCE_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tz) + + execute_process(COMMAND make -C ${CMAKE_CURRENT_BINARY_DIR}/tz install + TOPDIR=${CMAKE_CURRENT_BINARY_DIR}/tzbin) + + nuttx_add_romfs( + NAME + zoneinfo + PATH + ${CMAKE_CURRENT_BINARY_DIR}/tzbin/usr/share/zoneinfo + HEADER + PREFIX + zoneinfo + NONCONST) + + set_property(SOURCE romfs_zoneinfo.h PROPERTY GENERATED) + + nuttx_add_aux_library(zoneinfo tzromfs.c) + target_include_directories(zoneinfo PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(c PRIVATE zoneinfo) +endif() diff --git a/libs/libdsp/CMakeLists.txt b/libs/libdsp/CMakeLists.txt new file mode 100644 index 0000000000..a1f21c0e08 --- /dev/null +++ b/libs/libdsp/CMakeLists.txt @@ -0,0 +1,38 @@ +# ############################################################################## +# libs/libdsp/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. +# +# ############################################################################## +if(CONFIG_LIBDSP) + nuttx_add_library( + dsp + lib_pid.c + lib_svm.c + lib_transform.c + lib_observer.c + lib_foc.c + lib_misc.c + lib_motor.c + lib_pmsm_model.c + lib_pid_b16.c + lib_svm_b16.c + lib_transform_b16.c + lib_foc_b16.c + lib_misc_b16.c + lib_motor_b16.c + lib_pmsm_model_b16.c) +endif() diff --git a/libs/libm/libm/CMakeLists.txt b/libs/libm/libm/CMakeLists.txt new file mode 100644 index 0000000000..11d132b773 --- /dev/null +++ b/libs/libm/libm/CMakeLists.txt @@ -0,0 +1,175 @@ +# ############################################################################## +# libs/libc/math/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. +# +# ############################################################################## +if(CONFIG_LIBM) + # Add the floating point math C files to the build + + set(SRCS + lib_acosf.c + lib_asinf.c + lib_atan2f.c + lib_atanf.c + lib_cosf.c + lib_coshf.c + lib_expf.c + lib_fabsf.c + lib_fmodf.c + lib_frexpf.c + lib_ldexpf.c + lib_logf.c + lib_log10f.c + lib_log2f.c + lib_modff.c + lib_powf.c + lib_sinf.c + lib_sinhf.c + lib_sqrtf.c + lib_tanf.c + lib_tanhf.c + lib_asinhf.c + lib_acoshf.c + lib_atanhf.c + lib_erff.c + lib_copysignf.c + lib_acos.c + lib_asin.c + lib_atan.c + lib_atan2.c + lib_cos.c + lib_cosh.c + lib_exp.c + lib_fabs.c + lib_fmod.c + lib_frexp.c + lib_ldexp.c + lib_log.c + lib_log10.c + lib_log2.c + lib_modf.c + lib_pow.c + lib_sin.c + lib_sinh.c + lib_sqrt.c + lib_tan.c + lib_tanh.c + lib_asinh.c + lib_acosh.c + lib_atanh.c + lib_erf.c + lib_copysign.c + lib_cbrt.c + lib_acosl.c + lib_asinl.c + lib_atan2l.c + lib_atanl.c + lib_ceill.c + lib_cosl.c + lib_coshl.c + lib_expl.c + lib_fabsl.c + lib_floorl.c + lib_fmodl.c + lib_frexpl.c + lib_ldexpl.c + lib_logl.c + lib_log10l.c + lib_log2l.c + lib_modfl.c + lib_powl.c + lib_rintl.c + lib_roundl.c + lib_sinl.c + lib_sinhl.c + lib_sqrtl.c + lib_tanl.c + lib_tanhl.c + lib_asinhl.c + lib_acoshl.c + lib_atanhl.c + lib_erfl.c + lib_copysignl.c + lib_truncl.c + lib_libexpi.c + lib_libsqrtapprox.c + lib_libexpif.c + lib_erfc.c + lib_erfcf.c + lib_erfcl.c + lib_expm1.c + lib_expm1f.c + lib_expm1l.c + lib_lround.c + lib_lroundf.c + lib_lroundl.c + lib_llround.c + lib_llroundf.c + lib_llroundl.c + lib_nan.c + lib_nanf.c + lib_nanl.c + __cos.c + __sin.c + lib_gamma.c + lib_lgamma.c) + + # Use the C versions of some functions only if architecture specific optimized + # versions are not provided. + + if(NOT LIBM_ARCH_CEIL) + list(APPEND SRCS lib_ceil.c) + endif() + + if(NOT LIBM_ARCH_FLOOR) + list(APPEND SRCS lib_floor.c) + endif() + + if(NOT LIBM_ARCH_RINT) + list(APPEND SRCS lib_rint.c) + endif() + + if(NOT LIBM_ARCH_ROUND) + list(APPEND SRCS lib_round.c) + endif() + + if(NOT LIBM_ARCH_TRUNC) + list(APPEND SRCS lib_trunc.c) + endif() + + if(NOT LIBM_ARCH_CEILF) + list(APPEND SRCS lib_ceilf.c) + endif() + + if(NOT LIBM_ARCH_FLOORF) + list(APPEND SRCS lib_floorf.c) + endif() + + if(NOT LIBM_ARCH_RINTF) + list(APPEND SRCS lib_rintf.c) + endif() + + if(NOT LIBM_ARCH_ROUNDF) + list(APPEND SRCS lib_roundf.c) + endif() + + if(NOT LIBM_ARCH_TRUNCF) + list(APPEND SRCS lib_truncf.c) + endif() + + target_sources(c PRIVATE ${SRCS}) +endif() diff --git a/libs/libnx/CMakeLists.txt b/libs/libnx/CMakeLists.txt new file mode 100644 index 0000000000..5840d4434a --- /dev/null +++ b/libs/libnx/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# libs/libnx/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. +# +# ############################################################################## +if(CONFIG_NX) + nuttx_add_kernel_library(nx SPLIT) + target_include_directories(nx PRIVATE ${CMAKE_CURRENT_LIST_DIR}) + + nuttx_add_subdirectory() +endif() diff --git a/libs/libnx/bin/CMakeLists.txt b/libs/libnx/bin/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/libs/libnx/bin/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/libs/libnx/kbin/CMakeLists.txt b/libs/libnx/kbin/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/libs/libnx/kbin/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/libs/libnx/nx/CMakeLists.txt b/libs/libnx/nx/CMakeLists.txt new file mode 100644 index 0000000000..86f6f680b8 --- /dev/null +++ b/libs/libnx/nx/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# libs/libnx/nx/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. +# +# ############################################################################## + +if(CONFIG_NX) + target_sources(nx PRIVATE nx_drawcircle.c nx_drawline.c nx_fillcircle.c + nx_ishidden.c) +endif() diff --git a/libs/libnx/nxfonts/CMakeLists.txt b/libs/libnx/nxfonts/CMakeLists.txt new file mode 100644 index 0000000000..d7c100d2e4 --- /dev/null +++ b/libs/libnx/nxfonts/CMakeLists.txt @@ -0,0 +1,248 @@ +# ############################################################################## +# libs/libnx/nxfonts/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. +# +# ############################################################################## +function(add_font name id) + string(REPLACE "-" "_" prefix "g_${name}") + configure_file(nxfonts_bitmaps.c.in nxfonts_bitmaps_${name}.c) + target_sources(nxfonts + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/nxfonts_bitmaps_${name}.c) + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/nxfonts_bitmaps_${name}.c + PROPERTIES COMPILE_FLAGS -DNXFONTS_FONTID=${id}) +endfunction() + +if(CONFIG_NXFONTS) + nuttx_add_aux_library(nxfonts) + target_include_directories(nxfonts PRIVATE ${CMAKE_CURRENT_LIST_DIR}) + target_include_directories(nxfonts PRIVATE ${NUTTX_DIR}/libs/libnx) + + # Font conversion operations ############################################### + + set(SRCS nxfonts_getfont.c nxfonts_cache.c) + + set(BPPS + 1 + 2 + 4 + 8 + 16 + 24 + 32) + foreach(bpp ${BPPS}) + configure_file(nxfonts_convert.c.in nxfonts_convert_${bpp}bpp.c) + set_source_files_properties( + ${CMAKE_CURRENT_BINARY_DIR}/nxfonts_convert_${bpp}bpp.c + PROPERTIES COMPILE_FLAGS -DNXFONTS_BITSPERPIXEL=${bpp}) + list(APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/nxfonts_convert_${bpp}bpp.c) + endforeach() + + target_sources(nxfonts PRIVATE ${SRCS}) + + # Fonts bitmaps ############################################################ + + # Monospace fonts + + if(CONFIG_NXFONT_MONO5X8) + add_font(mono5x8 18) + endif() + + # Sans serif fonts + + if(CONFIG_NXFONT_SANS17X22) + add_font(sans17x22 14) + endif() + + if(CONFIG_NXFONT_SANS20X26) + add_font(sans20x26 15) + endif() + + if(CONFIG_NXFONT_SANS23X27) + add_font(sans23x27 1) + endif() + + if(CONFIG_NXFONT_SANS22X29) + add_font(sans22x29 2) + endif() + + if(CONFIG_NXFONT_SANS28X37) + add_font(sans28x37 3) + endif() + + if(CONFIG_NXFONT_SANS39X48) + add_font(sans39x48 4) + endif() + + # Sans serif bold fonts + + if(CONFIG_NXFONT_SANS17X23B) + add_font(sans17x23b 16) + endif() + + if(CONFIG_NXFONT_SANS20X27B) + add_font(sans20x27b 17) + endif() + + if(CONFIG_NXFONT_SANS22X29B) + add_font(sans22x29b 5) + endif() + + if(CONFIG_NXFONT_SANS28X37B) + add_font(sans28x37b 6) + endif() + + if(CONFIG_NXFONT_SANS40X49B) + add_font(sans40x49b 7) + endif() + + # Serif fonts + + if(CONFIG_NXFONT_SERIF22X29) + add_font(serif22x29 8) + endif() + + if(CONFIG_NXFONT_SERIF29X37) + add_font(serif29x37 9) + endif() + + if(CONFIG_NXFONT_SERIF38X48) + add_font(serif38x48 10) + endif() + + # Serif bold fonts + + if(CONFIG_NXFONT_SERIF22X28B) + add_font(serif22x28b 11) + endif() + + if(CONFIG_NXFONT_SERIF27X38B) + add_font(serif27x38b 12) + endif() + + if(CONFIG_NXFONT_SERIF38X49B) + add_font(serif38x49b 13) + endif() + + # Pixel fonts + + if(CONFIG_NXFONT_PIXEL_UNICODE) + add_font(pixel-unicode 19) + endif() + + if(CONFIG_NXFONT_PIXEL_LCD_MACHINE) + add_font(pixel-lcd-machine 20) + endif() + + # X11 misc fixed fonts + + if(CONFIG_NXFONT_X11_MISC_FIXED_4X6) + add_font(x11-misc-fixed-4x6 21) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_5X7) + add_font(x11-misc-fixed-5x7 22) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_5X8) + add_font(x11-misc-fixed-5x8 23) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_6X9) + add_font(x11-misc-fixed-6x9 24) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_6X10) + add_font(x11-misc-fixed-6x10 25) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_6X12) + add_font(x11-misc-fixed-6x12 26) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_6X13) + add_font(x11-misc-fixed-6x13 27) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_6X13B) + add_font(x11-misc-fixed-6x13b 28) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_6X13O) + add_font(x11-misc-fixed-6x13o 29) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_7X13) + add_font(x11-misc-fixed-7x13 30) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_7X13B) + add_font(x11-misc-fixed-7x13b 31) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_7X13O) + add_font(x11-misc-fixed-7x13o 32) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_7X14) + add_font(x11-misc-fixed-7x14 33) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_7X14B) + add_font(x11-misc-fixed-7x14b 34) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_8X13) + add_font(x11-misc-fixed-8x13 35) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_8X13B) + add_font(x11-misc-fixed-8x13b 36) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_8X13O) + add_font(x11-misc-fixed-8x13o 37) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_9X15) + add_font(x11-misc-fixed-9x15 38) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_9X15B) + add_font(x11-misc-fixed-9x15b 39) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_9X18) + add_font(x11-misc-fixed-9x18 40) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_9X18B) + add_font(x11-misc-fixed-9x18b 41) + endif() + + if(CONFIG_NXFONT_X11_MISC_FIXED_10X20) + add_font(x11-misc-fixed-10x20 42) + endif() + + # Tom Thumb mono-space 4x6 font + + if(CONFIG_NXFONT_TOM_THUMB_4X6) + add_font(tom-thumb-4x6 43) + endif() + + target_link_libraries(nx PRIVATE nxfonts) +endif() diff --git a/libs/libnx/nxglib/CMakeLists.txt b/libs/libnx/nxglib/CMakeLists.txt new file mode 100644 index 0000000000..9b2efd5b79 --- /dev/null +++ b/libs/libnx/nxglib/CMakeLists.txt @@ -0,0 +1,65 @@ +# ############################################################################## +# libs/libnx/nxglib/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. +# +# ############################################################################## + +# Expose NXGL interfaces to applications + +if(CONFIG_NXGLIB) + + # Files needed by both NX and NXFONTS + set(SRCS nxglib_rgbblend.c) + + # Files needed only by NX + + if(CONFIG_NX) + list( + APPEND + SRCS + nxgl_area2rect.c + nxglib_circlepts.c + nxglib_circletraps.c + nxglib_intersecting.c + nxglib_nonintersecting.c + nxglib_nullrect.c + nxgl_rect2area.c + nxglib_rectadd.c + nxglib_rectcopy.c + nxglib_rectinside.c + nxglib_rectintersect.c + nxglib_rectoffset.c + nxglib_rectoverlap.c + nxglib_rectsize.c + nxglib_rectunion.c + nxglib_rgb2yuv.c + nxglib_runcopy.c + nxglib_runoffset.c + nxglib_splitline.c + nxglib_trapcopy.c + nxglib_trapoffset.c + nxglib_vectoradd.c + nxglib_vectsubtract.c + nxglib_yuv2rgb.c) + + if(NOT CONFIG_NX_NPLANES EQUAL 1) + list(APPEND SRCS nxglib_colorcmp.c nxglib_colorcopy.c) + endif() + endif() + + target_sources(nx PRIVATE ${SRCS}) +endif() diff --git a/libs/libnx/nxmu/CMakeLists.txt b/libs/libnx/nxmu/CMakeLists.txt new file mode 100644 index 0000000000..c55a027a91 --- /dev/null +++ b/libs/libnx/nxmu/CMakeLists.txt @@ -0,0 +1,67 @@ +# ############################################################################## +# libs/libnx/nxmu/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. +# +# ############################################################################## + +# All of user-space hooks must be built in for the multi-user NX implementation +# so that they are available to the application in the kernel build (single use +# mode cannot be used with the kernel build) + +if(CONFIG_NX) + set(SRCS + nxmu_sendserver.c + nx_connect.c + nx_disconnect.c + nx_eventhandler.c + nx_eventnotify.c + nxmu_semtake.c + nx_block.c + nx_synch.c + nx_kbdchin.c + nx_kbdin.c + nx_mousein.c + nx_releasebkgd.c + nx_requestbkgd.c + nx_setbgcolor.c + nxmu_sendwindow.c + nx_closewindow.c + nx_constructwindow.c + nx_bitmap.c + nx_fill.c + nx_filltrapezoid.c + nx_getposition.c + nx_getrectangle.c + nx_lower.c + nx_modal.c + nx_move.c + nx_openwindow.c + nx_raise.c + nx_redrawreq.c + nx_setpixel.c + nx_setposition.c + nx_setsize.c + nx_setvisibility.c) + + if(CONFIG_NX_HWCURSOR) + list(APPEND SRCS nx_cursor.c) + elseif(CONFIG_NX_SWCURSOR) + list(APPEND SRCS nx_cursor.c) + endif() + + target_sources(nx PRIVATE ${SRCS}) +endif() diff --git a/libs/libnx/nxtk/CMakeLists.txt b/libs/libnx/nxtk/CMakeLists.txt new file mode 100644 index 0000000000..1ac53f1632 --- /dev/null +++ b/libs/libnx/nxtk/CMakeLists.txt @@ -0,0 +1,62 @@ +# ############################################################################## +# libs/libnx/nxtk/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. +# +# ############################################################################## + +if(CONFIG_NX) + set(SRCS + nxtk_setsubwindows.c + nxtk_events.c + nxtk_block.c + nxtk_synch.c + nxtk_subwindowclip.c + nxtk_containerclip.c + nxtk_subwindowmove.c + nxtk_drawframe.c + nxtk_raise.c + nxtk_lower.c + nxtk_modal.c + nxtk_setvisibility.c + nxtk_ishidden.c + nxtk_setposition.c + nxtk_getposition.c + nxtk_setsize.c + nxtk_openwindow.c + nxtk_closewindow.c + nxtk_fillwindow.c + nxtk_getwindow.c + nxtk_filltrapwindow.c + nxtk_movewindow.c + nxtk_bitmapwindow.c + nxtk_drawcirclewindow.c + nxtk_drawlinewindow.c + nxtk_fillcirclewindow.c + nxtk_opentoolbar.c + nxtk_closetoolbar.c + nxtk_filltoolbar.c + nxtk_gettoolbar.c + nxtk_filltraptoolbar.c + nxtk_movetoolbar.c + nxtk_bitmaptoolbar.c + nxtk_drawcircletoolbar.c + nxtk_drawlinetoolbar.c + nxtk_fillcircletoolbar.c + nxtk_toolbarbounds.c) + + target_sources(nx PRIVATE ${SRCS}) +endif() diff --git a/libs/libxx/.gitignore b/libs/libxx/.gitignore index 7f0bb21bec..318167c570 100644 --- a/libs/libxx/.gitignore +++ b/libs/libxx/.gitignore @@ -4,3 +4,5 @@ /libcxx-*.src.tar.xz /libcxxabi-*.src.tar.xz /etl +/.libcxx_patch +/.libcxxabi_patch diff --git a/libs/libxx/CMakeLists.txt b/libs/libxx/CMakeLists.txt new file mode 100644 index 0000000000..f9856903b9 --- /dev/null +++ b/libs/libxx/CMakeLists.txt @@ -0,0 +1,42 @@ +# ############################################################################## +# libs/libxx/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 the uClibc++ Make.defs file if selected. If it is included, the +# uClibc++/Make.defs file will add its files to the source file list, add its +# DEPPATH info, and will add the appropriate paths to the VPATH variable +# +# Note that an error will occur if you select CONFIG_LIBXX_UCLIBCXX without +# installing the uClibc++ package. This is intentional to let you know about +# the configuration problem. Refer to the README.txt file in the NuttX uClibc++ +# GIT repository for more information + +if(CONFIG_HAVE_CXX) + if(CONFIG_UCLIBCXX) + include(uClibc++.cmake) + elseif(CONFIG_LIBCXX) + include(libcxx.cmake) + else() + include(libcxxmini.cmake) + endif() + + if(CONFIG_LIBCXXABI) + include(libcxxabi.cmake) + endif() +endif() diff --git a/libs/libxx/libcxx.cmake b/libs/libxx/libcxx.cmake new file mode 100644 index 0000000000..0f3c64f1c4 --- /dev/null +++ b/libs/libxx/libcxx.cmake @@ -0,0 +1,119 @@ +# ############################################################################## +# libs/libxx/libcxx.cmake +# +# 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. +# +# ############################################################################## + +if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx/.git) + + set(LIBCXX_VERSION 12.0.0) + + FetchContent_Declare( + libcxx + DOWNLOAD_NAME "libcxx-${LIBCXX_VERSION}.src.tar.xz" + DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR} + URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LIBCXX_VERSION}/libcxx-${LIBCXX_VERSION}.src.tar.xz" + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/libcxx + BINARY_DIR + ${CMAKE_BINARY_DIR}/libs/libc/libcxx + CONFIGURE_COMMAND + "" + BUILD_COMMAND + "" + INSTALL_COMMAND + "" + TEST_COMMAND + "" + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(libcxx) + + if(NOT libcxx_POPULATED) + FetchContent_Populate(libcxx) + endif() + + add_custom_target(libcxx_patch) + + if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/.libcxx_patch) + add_custom_command( + TARGET libcxx_patch + PRE_BUILD + COMMAND touch ${CMAKE_CURRENT_LIST_DIR}/.libcxx_patch + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-Remove-the-locale-fallback-for-NuttX.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-libc-avoid-the-waring-__EXCEPTIONS-is-not-defined-ev.patch + > /dev/null || (exit 0) + COMMAND + patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-Rename-PS-macro-to-avoid-clashing-with-Xtensa.patch + > /dev/null || (exit 0) DEPENDS libcxx) + + if(CONFIG_LIBC_ARCH_ATOMIC) + add_custom_command( + TARGET libcxx_patch + POST_BUILD + COMMAND + patch -p1 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0002-Omit-atomic_-un-signed_lock_free-if-unsupported.patch + > /dev/null || (exit 0)) + endif() + + endif() + +endif() + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/libcxx/include) + +add_compile_definitions(_LIBCPP_BUILDING_LIBRARY) +if(CONFIG_LIBSUPCXX) + add_compile_definitions(__GLIBCXX__) +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(SRCS) +set(SRCSTMP) + +file(GLOB SRCS ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/*.cpp) +file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/experimental/*.cpp) +list(APPEND SRCS ${SRCSTMP}) +file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/filesystem/*.cpp) +list(APPEND SRCS ${SRCSTMP}) + +set_source_files_properties(libcxx/src/barrier.cpp PROPERTIES COMPILE_FLAGS + -Wno-shadow) +set_source_files_properties(libcxx/src/locale.cpp PROPERTIES COMPILE_FLAGS + -Wno-shadow) +set_source_files_properties(libcxx/src/filesystem/directory_iterator.cpp + PROPERTIES COMPILE_FLAGS -Wno-shadow) +set_source_files_properties(libcxx/src/filesystem/operations.cpp + PROPERTIES COMPILE_FLAGS -Wno-shadow) + +nuttx_add_system_library(libcxx) +target_sources(libcxx PRIVATE ${SRCS}) + +add_dependencies(libcxx libcxx_patch) diff --git a/libs/libxx/libcxxabi.cmake b/libs/libxx/libcxxabi.cmake new file mode 100644 index 0000000000..7d2f779a5c --- /dev/null +++ b/libs/libxx/libcxxabi.cmake @@ -0,0 +1,116 @@ +# ############################################################################## +# libs/libxx/libcxxabi.cmake +# +# 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. +# +# ############################################################################## + +if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxxabi) + + set(LIBCXXABI_VERSION 12.0.0) + + FetchContent_Declare( + libcxxabi + DOWNLOAD_NAME "libcxxabi-${LIBCXXABI_VERSION}.src.tar.xz" + DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR} + URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LIBCXXABI_VERSION}/libcxxabi-${LIBCXXABI_VERSION}.src.tar.xz" + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/libcxxabi + BINARY_DIR + ${CMAKE_BINARY_DIR}/libs/libc/libcxxabi + CONFIGURE_COMMAND + "" + BUILD_COMMAND + "" + INSTALL_COMMAND + "" + TEST_COMMAND + "" + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(libcxxabi) + + if(NOT libcxxabi_POPULATED) + FetchContent_Populate(libcxxabi) + endif() +endif() + +add_custom_target(libcxxabi_patch) + +if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxxabi/.libcxxabi_patch) + add_custom_command( + TARGET libcxxabi_patch + PRE_BUILD + COMMAND touch ${CMAKE_CURRENT_LIST_DIR}/libcxxabi/.libcxxabi_patch + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-libc-abi-avoid-the-waring-__EXCEPTIONS-is-not-define.patch + > /dev/null || (exit 0) DEPENDS libcxxabi) +endif() + +nuttx_add_system_library(libcxxabi) + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_INCLUDE_DIRECTORIES + ${CMAKE_CURRENT_LIST_DIR}/libcxxabi/include) + +set(SRCS) + +# C++ABI files +list( + APPEND + SRCS + cxa_aux_runtime.cpp + cxa_default_handlers.cpp + cxa_demangle.cpp + cxa_exception_storage.cpp + cxa_guard.cpp + cxa_handlers.cpp + cxa_thread_atexit.cpp + cxa_vector.cpp + cxa_virtual.cpp) + +# C++ STL files +list(APPEND SRCS stdlib_exception.cpp stdlib_new_delete.cpp + stdlib_stdexcept.cpp stdlib_typeinfo.cpp) + +# Internal files +list(APPEND SRCS abort_message.cpp fallback_malloc.cpp private_typeinfo.cpp) + +if(CONFIG_CXX_EXCEPTION) + add_compile_definitions(LIBCXXABI_ENABLE_EXCEPTIONS) + list(APPEND SRCS cxa_exception.cpp cxa_personality.cpp) +else() + list(APPEND SRCS cxa_noexception.cpp) +endif() + +if(CONFIG_LIBCXXABI) + add_compile_definitions(LIBCXX_BUILDING_LIBCXXABI) +endif() + +set(TARGET_SRCS) + +foreach(src ${SRCS}) + string(PREPEND src libcxxabi/src/) + list(APPEND TARGET_SRCS ${src}) +endforeach() + +target_sources(libcxxabi PRIVATE ${TARGET_SRCS}) + +add_dependencies(libcxxabi libcxxabi_patch) diff --git a/libs/libxx/libcxxmini.cmake b/libs/libxx/libcxxmini.cmake new file mode 100644 index 0000000000..df053e9746 --- /dev/null +++ b/libs/libxx/libcxxmini.cmake @@ -0,0 +1,50 @@ +# ############################################################################## +# libs/libxx/libcxxmini.cmake +# +# 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_system_library(libcxxmini) + +set_source_files_properties( + libcxxmini/libxx_new.cxx PROPERTIES COMPILE_FLAGS -Wno-missing-exception-spec) +set_source_files_properties( + libcxxmini/libxx_newa.cxx PROPERTIES COMPILE_FLAGS + -Wno-missing-exception-spec) + +target_sources( + libcxxmini + PRIVATE libcxxmini/libxx_cxa_guard.cxx + libcxxmini/libxx_cxapurevirtual.cxx + libcxxmini/libxx_delete.cxx + libcxxmini/libxx_delete_sized.cxx + libcxxmini/libxx_deletea.cxx + libcxxmini/libxx_deletea_sized.cxx + libcxxmini/libxx_new.cxx + libcxxmini/libxx_newa.cxx) + +# Why c++14? * libcxx seems to require c++11. * The compiler defaults varies: +# clang/macOS (from xcode): 199711L gcc/ubuntu: 201402L * There is +# a precedent to use c++14. (boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_INCLUDE_DIRECTORIES ${NUTTX_DIR}/include/cxx) diff --git a/mm/CMakeLists.txt b/mm/CMakeLists.txt new file mode 100644 index 0000000000..d952c1a624 --- /dev/null +++ b/mm/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# mm/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_kernel_library(mm SPLIT) +nuttx_add_subdirectory() +target_include_directories(mm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/mm/bin/CMakeLists.txt b/mm/bin/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/mm/bin/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/mm/circbuf/CMakeLists.txt b/mm/circbuf/CMakeLists.txt new file mode 100644 index 0000000000..04e0577f51 --- /dev/null +++ b/mm/circbuf/CMakeLists.txt @@ -0,0 +1,20 @@ +# ############################################################################## +# mm/circbuf/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. +# +# ############################################################################## +target_sources(mm PRIVATE circbuf.c) diff --git a/mm/iob/CMakeLists.txt b/mm/iob/CMakeLists.txt new file mode 100644 index 0000000000..87e05fc829 --- /dev/null +++ b/mm/iob/CMakeLists.txt @@ -0,0 +1,66 @@ +# ############################################################################## +# mm/iob/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. +# +# ############################################################################## + +if(CONFIG_MM_IOB) + + set(SRCS) + + list( + APPEND + SRCS + iob_add_queue.c + iob_alloc.c + iob_alloc_qentry.c + iob_clone.c + iob_concat.c + iob_copyin.c + iob_copyout.c + iob_contig.c + iob_free.c + iob_free_chain.c + iob_free_qentry.c + iob_free_queue.c + iob_initialize.c + iob_pack.c + iob_peek_queue.c + iob_remove_queue.c + iob_statistics.c + iob_trimhead.c + iob_trimhead_queue.c + iob_trimtail.c + iob_navail.c + iob_free_queue_qentry.c + iob_tailroom.c + iob_get_queue_size.c + iob_reserve.c + iob_update_pktlen.c + iob_count.c) + + if(CONFIG_IOB_NOTIFIER) + list(APPEND SRCS iob_notifier.c) + endif() + + if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS iob_dump.c) + endif() + + target_sources(mm PRIVATE ${SRCS}) + +endif() diff --git a/mm/kasan/CMakeLists.txt b/mm/kasan/CMakeLists.txt new file mode 100644 index 0000000000..3ccf404de7 --- /dev/null +++ b/mm/kasan/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# mm/kasan/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. +# +# ############################################################################## +if(CONFIG_MM_KASAN) + target_sources(mm PRIVATE kasan.c) + target_compile_options(kasan PRIVATE -fno-sanitize=kernel-address) +endif() diff --git a/mm/kbin/CMakeLists.txt b/mm/kbin/CMakeLists.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/mm/kbin/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/mm/kmm_heap/CMakeLists.txt b/mm/kmm_heap/CMakeLists.txt new file mode 100644 index 0000000000..a571c806bc --- /dev/null +++ b/mm/kmm_heap/CMakeLists.txt @@ -0,0 +1,50 @@ +# ############################################################################## +# mm/kmm_heap/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. +# +# ############################################################################## + +# Kernel heap allocator + +if(CONFIG_MM_KERNEL_HEAP) + + set(SRCS) + + list( + APPEND + SRCS + kmm_initialize.c + kmm_addregion.c + kmm_malloc_size.c + kmm_brkaddr.c + kmm_calloc.c + kmm_extend.c + kmm_free.c + kmm_mallinfo.c + kmm_malloc.c + kmm_memalign.c + kmm_realloc.c + kmm_zalloc.c + kmm_heapmember.c) + + if(CONFIG_DEBUG_MM) + list(APPEND SRCS kmm_checkcorruption.c) + endif() + + target_sources(mm PRIVATE ${SRCS}) + +endif() diff --git a/mm/map/CMakeLists.txt b/mm/map/CMakeLists.txt new file mode 100644 index 0000000000..80bf022b8d --- /dev/null +++ b/mm/map/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# mm/map/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) +list(APPEND SRCS mm_map.c) + +if(CONFIG_ARCH_VMA_MAPPING) + list(APPEND SRCS vm_region.c) +endif() +target_sources(mm PRIVATE ${SRCS}) diff --git a/mm/mempool/CMakeLists.txt b/mm/mempool/CMakeLists.txt new file mode 100644 index 0000000000..49d108b5c2 --- /dev/null +++ b/mm/mempool/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# mm/mempool/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) +list(APPEND SRCS mempool.c mempool_multiple.c) + +if(CONFIG_FS_PROCFS) + if(NOT CONFIG_FS_PROCFS_EXCLUDE_MEMPOOL) + list(APPEND SRCS mempool_procfs.c) + endif() +endif() +target_sources(mm PRIVATE ${SRCS}) diff --git a/mm/mm_gran/CMakeLists.txt b/mm/mm_gran/CMakeLists.txt new file mode 100644 index 0000000000..6f6cfcad7b --- /dev/null +++ b/mm/mm_gran/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# mm/mm_gran/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. +# +# ############################################################################## + +# An optional granule allocator + +if(CONFIG_GRAN) + set(SRCS) + + list( + APPEND + SRCS + mm_graninit.c + mm_granrelease.c + mm_granreserve.c + mm_granalloc.c + mm_granmark.c + mm_granfree.c + mm_graninfo.c + mm_grancritical.c) + + # A page allocator based on the granule allocator + + if(CONFIG_MM_PGALLOC) + list(APPEND SRCS mm_pgalloc.c) + endif() + + target_sources(mm PRIVATE ${SRCS}) +endif() diff --git a/mm/mm_heap/CMakeLists.txt b/mm/mm_heap/CMakeLists.txt new file mode 100644 index 0000000000..6402c590b2 --- /dev/null +++ b/mm/mm_heap/CMakeLists.txt @@ -0,0 +1,55 @@ +# ############################################################################## +# mm/mm_heap/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. +# +# ############################################################################## + +# Kernel heap allocator + +if(CONFIG_MM_DEFAULT_MANAGER) + + set(SRCS) + + list( + APPEND + SRCS + mm_initialize.c + mm_lock.c + mm_addfreechunk.c + mm_size2ndx.c + mm_malloc_size.c + mm_shrinkchunk.c + mm_brkaddr.c + mm_calloc.c + mm_extend.c + mm_free.c + mm_mallinfo.c + mm_malloc.c + mm_foreach.c + mm_memalign.c + mm_realloc.c + mm_zalloc.c + mm_heapmember.c + mm_memdump.c) + + if(CONFIG_DEBUG_MM) + list(APPEND SRCS mm_checkcorruption.c) + endif() + + target_sources(mm PRIVATE ${SRCS}) + +endif() diff --git a/mm/shm/CMakeLists.txt b/mm/shm/CMakeLists.txt new file mode 100644 index 0000000000..98ee100283 --- /dev/null +++ b/mm/shm/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# mm/shm/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. +# +# ############################################################################## + +# Shared memory allocator + +if(CONFIG_MM_SHM) + target_sources(mm PRIVATE shm_initialize.c shmat.c shmctl.c shmdt.c shmget.c) +endif() diff --git a/mm/umm_heap/CMakeLists.txt b/mm/umm_heap/CMakeLists.txt new file mode 100644 index 0000000000..0df7edd7d2 --- /dev/null +++ b/mm/umm_heap/CMakeLists.txt @@ -0,0 +1,50 @@ +# ############################################################################## +# mm/umm_heap/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. +# +# ############################################################################## + +# User heap allocator + +set(SRCS) + +list( + APPEND + SRCS + umm_initialize.c + umm_addregion.c + umm_brkaddr.c + umm_calloc.c + umm_extend.c + umm_free.c + umm_mallinfo.c + umm_malloc.c + umm_memalign.c + umm_realloc.c + umm_zalloc.c + umm_heapmember.c + umm_globals.c) + +if(CONFIG_BUILD_KERNEL) + list(APPEND SRCS umm_sbrk.c) +endif() + +if(CONFIG_DEBUG_MM) + list(APPEND SRCS umm_checkcorruption.c) +endif() + +target_sources(mm PRIVATE ${SRCS}) diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt new file mode 100644 index 0000000000..7929a4c354 --- /dev/null +++ b/net/CMakeLists.txt @@ -0,0 +1,28 @@ +# ############################################################################## +# net/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. +# +# ############################################################################## + +if(CONFIG_NET) + nuttx_add_kernel_library(net) + + nuttx_add_subdirectory() + + target_sources(net PRIVATE net_initialize.c) + target_include_directories(net PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +endif() diff --git a/net/arp/CMakeLists.txt b/net/arp/CMakeLists.txt new file mode 100644 index 0000000000..4b91c48951 --- /dev/null +++ b/net/arp/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# net/arp/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. +# +# ############################################################################## + +if(CONFIG_NET_ARP) + set(SRCS arp_input.c arp_out.c arp_format.c arp_table.c) + + if(CONFIG_NET_ARP_IPIN) + list(APPEND SRCS arp_ipin.c) + endif() + + if(CONFIG_NET_ARP_SEND) + list(APPEND SRCS arp_send.c arp_poll.c arp_notify.c) + endif() + + if(CONFIG_NET_ARP_DUMP) + list(APPEND SRCS arp_dump.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/bluetooth/CMakeLists.txt b/net/bluetooth/CMakeLists.txt new file mode 100644 index 0000000000..8cb13ae7cf --- /dev/null +++ b/net/bluetooth/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# net/bluetooth/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. +# +# ############################################################################## + +if(CONFIG_NET_BLUETOOTH) + target_sources( + net + PRIVATE # Initialization / resource management + bluetooth_initialize.c + bluetooth_conn.c + bluetooth_container.c + # Socket layer + bluetooth_sockif.c + bluetooth_sendmsg.c + bluetooth_recvmsg.c + # Device interface + bluetooth_input.c + bluetooth_callback.c + bluetooth_poll.c + bluetooth_finddev.c) +endif() diff --git a/net/can/CMakeLists.txt b/net/can/CMakeLists.txt new file mode 100644 index 0000000000..d77a2cac72 --- /dev/null +++ b/net/can/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# net/can/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. +# +# ############################################################################## +if(CONFIG_NET_CAN) + set(SRCS) + + # Socket layer + list(APPEND SRCS can_sockif.c can_sendmsg.c can_recvmsg.c) + + if(CONFIG_NET_CAN_NOTIFIER) + list(APPEND SRCS can_notifier.c) + endif() + + if(CONFIG_NET_CANPROTO_OPTIONS) + list(APPEND SRCS can_setsockopt.c can_getsockopt.c) + endif() + + list(APPEND SRCS can_conn.c can_input.c can_callback.c can_poll.c) + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/devif/CMakeLists.txt b/net/devif/CMakeLists.txt new file mode 100644 index 0000000000..d7c0d17c36 --- /dev/null +++ b/net/devif/CMakeLists.txt @@ -0,0 +1,47 @@ +# ############################################################################## +# net/devif/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 devif_initialize.c devif_callback.c) + +# Device driver IP packet receipt interfaces + +if(CONFIG_MM_IOB) + + list(APPEND SRCS devif_send.c devif_loopback.c) + + if(CONFIG_NET_IPv4) + list(APPEND SRCS ipv4_input.c) + endif() + + if(CONFIG_NET_IPv6) + list(APPEND SRCS ipv6_input.c) + endif() + + # IP forwarding + + if(CONFIG_NET_IPFORWARD) + list(APPEND SRCS devif_forward.c) + endif() + + list(APPEND SRCS devif_poll.c devif_iobsend.c devif_filesend.c) + +endif() + +target_sources(net PRIVATE ${SRCS}) diff --git a/net/icmp/CMakeLists.txt b/net/icmp/CMakeLists.txt new file mode 100644 index 0000000000..427008b145 --- /dev/null +++ b/net/icmp/CMakeLists.txt @@ -0,0 +1,39 @@ +# ############################################################################## +# net/icmp/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. +# +# ############################################################################## + +if(CONFIG_NET_ICMP AND NOT CONFIG_NET_ICMP_NO_STACK) + # ICMP source files + set(SRCS icmp_input.c icmp_reply.c) + + if(CONFIG_NET_ICMP_SOCKET) + list( + APPEND + SRCS + icmp_sockif.c + icmp_poll.c + icmp_conn.c + icmp_sendmsg.c + icmp_recvmsg.c + icmp_netpoll.c + icmp_ioctl.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/icmpv6/CMakeLists.txt b/net/icmpv6/CMakeLists.txt new file mode 100644 index 0000000000..2d92113813 --- /dev/null +++ b/net/icmpv6/CMakeLists.txt @@ -0,0 +1,56 @@ +# ############################################################################## +# net/icmpv6/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. +# +# ############################################################################## + +if(CONFIG_NET_ICMPv6 AND NOT CONFIG_NET_ICMPv6_NO_STACK) + # ICMPv6 source files + + set(SRCS icmpv6_input.c icmpv6_solicit.c icmpv6_advertise.c + icmpv6_linkipaddr.c icmpv6_reply.c) + + if(CONFIG_NET_ICMPv6_SOCKET) + list( + APPEND + SRCS + icmpv6_sockif.c + icmpv6_conn.c + icmpv6_sendmsg.c + icmpv6_recvmsg.c + icmpv6_netpoll.c + icmpv6_ioctl.c) + endif() + + if(CONFIG_NET_ICMPv6_NEIGHBOR) + list(APPEND SRCS icmpv6_neighbor.c icmpv6_notify.c) + endif() + + if(CONFIG_NET_ICMPv6_SOCKET OR CONFIG_NET_ICMPv6_NEIGHBOR) + list(APPEND SRCS icmpv6_poll.c) + endif() + + if(CONFIG_NET_ICMPv6_AUTOCONF) + list(APPEND SRCS icmpv6_autoconfig.c icmpv6_rsolicit.c icmpv6_rnotify.c) + endif() + + if(CONFIG_NET_ICMPv6_ROUTER) + list(APPEND SRCS icmpv6_radvertise.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/ieee802154/CMakeLists.txt b/net/ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..7bb3d68f6d --- /dev/null +++ b/net/ieee802154/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# net/ieee802154/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. +# +# ############################################################################## + +if(CONFIG_NET_IEEE802154) + target_sources( + net + PRIVATE # Initialization / resource management + ieee802154_initialize.c + ieee802154_conn.c + ieee802154_container.c + # Socket layer + ieee802154_sockif.c + ieee802154_sendmsg.c + ieee802154_recvmsg.c + # Device interface + ieee802154_input.c + ieee802154_callback.c + ieee802154_poll.c + ieee802154_finddev.c) +endif() diff --git a/net/igmp/CMakeLists.txt b/net/igmp/CMakeLists.txt new file mode 100644 index 0000000000..c9b2aafd8f --- /dev/null +++ b/net/igmp/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# net/igmp/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. +# +# ############################################################################## + +if(CONFIG_NET_IGMP) + target_sources( + net + PRIVATE igmp_group.c + igmp_initialize.c + igmp_input.c + igmp_join.c + igmp_leave.c + igmp_mcastmac.c + igmp_msg.c + igmp_poll.c + igmp_send.c + igmp_timer.c) +endif() diff --git a/net/inet/CMakeLists.txt b/net/inet/CMakeLists.txt new file mode 100644 index 0000000000..2cabfe5c75 --- /dev/null +++ b/net/inet/CMakeLists.txt @@ -0,0 +1,51 @@ +# ############################################################################## +# net/inet/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 inet_txdrain.c) + +if(CONFIG_NET_IPv4) + list(APPEND SRCS inet_sockif.c inet_globals.c) +elseif(CONFIG_NET_IPv6) + list(APPEND SRCS inet_sockif.c inet_globals.c) +endif() + +if(CONFIG_NET_IPv4) + list( + APPEND + SRCS + ipv4_setsockopt.c + ipv4_getsockopt.c + ipv4_getsockname.c + ipv4_getpeername.c + ipv4_build_header.c) +endif() + +if(CONFIG_NET_IPv6) + list( + APPEND + SRCS + ipv6_setsockopt.c + ipv6_getsockname.c + ipv6_getpeername.c + ipv6_build_header.c + ipv6_getsockopt.c) +endif() + +target_sources(net PRIVATE ${SRCS}) diff --git a/net/ipforward/CMakeLists.txt b/net/ipforward/CMakeLists.txt new file mode 100644 index 0000000000..e767775f26 --- /dev/null +++ b/net/ipforward/CMakeLists.txt @@ -0,0 +1,39 @@ +# ############################################################################## +# net/ipforward/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. +# +# ############################################################################## + +# IP forwarding source files + +if(CONFIG_NET_IPFORWARD) + set(SRCS ipfwd_alloc.c ipfwd_forward.c ipfwd_poll.c) + + if(CONFIG_NET_IPv4) + list(APPEND SRCS ipv4_forward.c) + endif() + + if(CONFIG_NET_IPv6) + list(APPEND SRCS ipv6_forward.c) + endif() + + if(CONFIG_NET_STATISTICS) + list(APPEND SRCS ipfwd_dropstats.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/ipfrag/CMakeLists.txt b/net/ipfrag/CMakeLists.txt new file mode 100644 index 0000000000..4d2b258fa1 --- /dev/null +++ b/net/ipfrag/CMakeLists.txt @@ -0,0 +1,36 @@ +# ############################################################################## +# net/tcp/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. +# +# ############################################################################## + +if(CONFIG_NET_IPFRAG) + + # fragment processing source files + + set(SRCS ipfrag.c) + + if(CONFIG_NET_IPv4) + list(APPEND SRCS ipv4_frag.c) + endif() + + if(CONFIG_NET_IPv6) + list(APPEND SRCS ipv6_frag.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() # CONFIG_NET_IPFRAG diff --git a/net/local/CMakeLists.txt b/net/local/CMakeLists.txt new file mode 100644 index 0000000000..36108065a8 --- /dev/null +++ b/net/local/CMakeLists.txt @@ -0,0 +1,41 @@ +# ############################################################################## +# net/local/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. +# +# ############################################################################## + +# Unix domain socket source files + +if(CONFIG_NET_LOCAL) + set(SRCS + local_conn.c + local_release.c + local_bind.c + local_fifo.c + local_recvmsg.c + local_sendpacket.c + local_recvutils.c + local_sockif.c + local_netpoll.c + local_sendmsg.c) + + if(CONFIG_NET_LOCAL_STREAM) + list(APPEND SRCS local_connect.c local_listen.c local_accept.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/mld/CMakeLists.txt b/net/mld/CMakeLists.txt new file mode 100644 index 0000000000..a7137f795c --- /dev/null +++ b/net/mld/CMakeLists.txt @@ -0,0 +1,38 @@ +# ############################################################################## +# net/mld/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. +# +# ############################################################################## + +# Logic specific to Multicast Listener Discovery (MLD) + +if(CONFIG_NET_MLD) + target_sources( + net + PRIVATE mld_done.c + mld_initialize.c + mld_leave.c + mld_msg.c + mld_query.c + mld_send.c + mld_group.c + mld_join.c + mld_mcastmac.c + mld_poll.c + mld_report.c + mld_timer.c) +endif() diff --git a/net/nat/CMakeLists.txt b/net/nat/CMakeLists.txt new file mode 100644 index 0000000000..0e8dd83f5c --- /dev/null +++ b/net/nat/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# net/nat/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. +# +# ############################################################################## + +# NAT source files + +if(CONFIG_NET_NAT) + + if(CONFIG_NET_IPv4) + target_sources(net PRIVATE ipv4_nat.c ipv4_nat_entry.c) + endif() + +endif() diff --git a/net/neighbor/CMakeLists.txt b/net/neighbor/CMakeLists.txt new file mode 100644 index 0000000000..055559a2c5 --- /dev/null +++ b/net/neighbor/CMakeLists.txt @@ -0,0 +1,43 @@ +# ############################################################################## +# net/neighbor/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. +# +# ############################################################################## + +# Logic specific to IPv6 Neighbor Discovery Protocol + +if(CONFIG_NET_IPv6) + set(SRCS neighbor_globals.c neighbor_add.c neighbor_lookup.c + neighbor_update.c neighbor_findentry.c neighbor_out.c) + + # Link layer specific support + if(CONFIG_NET_ETHERNET) + list(APPEND SRCS neighbor_ethernet_out.c) + endif() + + # if (CONFIG_NET_6LOWPAN) list(APPEND SRCS neighbor_6lowpan_out.c) endif() + + if(CONFIG_DEBUG_NET_INFO) + list(APPEND SRCS neighbor_dumpentry.c) + endif() + + if(CONFIG_NETLINK_ROUTE) + list(APPEND SRCS neighbor_snapshot.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/netdev/CMakeLists.txt b/net/netdev/CMakeLists.txt new file mode 100644 index 0000000000..a20df4d684 --- /dev/null +++ b/net/netdev/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# net/netdev/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 + netdev_register.c + netdev_ioctl.c + netdev_txnotify.c + netdev_findbyname.c + netdev_findbyaddr.c + netdev_findbyindex.c + netdev_count.c + netdev_ifconf.c + netdev_foreach.c + netdev_unregister.c + netdev_carrier.c + netdev_default.c + netdev_verify.c + netdev_lladdrsize.c) + +if(CONFIG_MM_IOB) + list(APPEND SRCS netdev_input.c netdev_iob.c) +endif() + +if(CONFIG_NETDOWN_NOTIFIER) + list(APPEND SRCS netdown_notifier.c) +endif() + +target_sources(net PRIVATE ${SRCS}) diff --git a/net/netfilter/CMakeLists.txt b/net/netfilter/CMakeLists.txt new file mode 100644 index 0000000000..e68d60015c --- /dev/null +++ b/net/netfilter/CMakeLists.txt @@ -0,0 +1,32 @@ +# ############################################################################## +# net/netfilter/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. +# +# ############################################################################## + +# Netfilter source files + +if(CONFIG_NET_IPTABLES) + + set(SRCS ipt_sockopt.c) + + if(CONFIG_NET_NAT) + list(APPEND SRCS ipt_nat.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/netlink/CMakeLists.txt b/net/netlink/CMakeLists.txt new file mode 100644 index 0000000000..feb14b41af --- /dev/null +++ b/net/netlink/CMakeLists.txt @@ -0,0 +1,31 @@ +# ############################################################################## +# net/netlink/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. +# +# ############################################################################## + +# Logic specific to NETLINK + +if(CONFIG_NET_NETLINK) + set(SRCS netlink_sockif.c netlink_conn.c netlink_notifier.c) + + if(CONFIG_NETLINK_ROUTE) + list(APPEND SRCS netlink_route.c netlink_attr.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/pkt/CMakeLists.txt b/net/pkt/CMakeLists.txt new file mode 100644 index 0000000000..d1cb3e3f57 --- /dev/null +++ b/net/pkt/CMakeLists.txt @@ -0,0 +1,36 @@ +# ############################################################################## +# net/pkt/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. +# +# ############################################################################## + +# Packet socket support + +if(CONFIG_NET_PKT) + target_sources( + net + PRIVATE # Socket layer + pkt_sockif.c + pkt_sendmsg.c + pkt_recvmsg.c + # Transport layer + pkt_conn.c + pkt_input.c + pkt_callback.c + pkt_poll.c + pkt_finddev.c) +endif() diff --git a/net/procfs/CMakeLists.txt b/net/procfs/CMakeLists.txt new file mode 100644 index 0000000000..4f7ae58264 --- /dev/null +++ b/net/procfs/CMakeLists.txt @@ -0,0 +1,59 @@ +# ############################################################################## +# net/procfs/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. +# +# ############################################################################## + +# Network procfs support + +if(NOT CONFIG_DISABLE_MOUNTPOINT + AND CONFIG_FS_PROCFS + AND NOT CONFIG_FS_PROCFS_EXCLUDE_NET) + + set(SRCS net_procfs.c netdev_statistics.c) + + # General network statistics + + if(CONFIG_NET_STATISTICS) + list(APPEND SRCS net_statistics.c) + + if(CONFIG_NET_MLD) + list(APPEND SRCS net_mld.c) + endif() + endif() + + if(CONFIG_NET_STATISTICS) + list(APPEND SRCS net_statistics.c) + if(CONFIG_NET_MLD) + list(APPEND SRCS net_mld.c) + endif() + if(CONFIG_NET_TCP) + list(APPEND SRCS net_tcp.c) + endif() + if(CONFIG_NET_UDP) + list(APPEND SRCS net_udp.c) + endif() + endif() + + # Routing table + + if(CONFIG_NET_ROUTE) + list(APPEND SRCS net_procfs_route.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/route/CMakeLists.txt b/net/route/CMakeLists.txt new file mode 100644 index 0000000000..274668792c --- /dev/null +++ b/net/route/CMakeLists.txt @@ -0,0 +1,80 @@ +# ############################################################################## +# net/route/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. +# +# ############################################################################## + +if(CONFIG_NET_ROUTE) + + # General routing table support + + set(SRCS net_initroute.c net_router.c netdev_router.c) + + # Support in-memory, RAM-based routing tables + + if(CONFIG_ROUTE_IPv4_RAMROUTE) + list( + APPEND + SRCS + net_alloc_ramroute.c + net_add_ramroute.c + net_del_ramroute.c + net_queue_ramroute.c + net_foreach_ramroute.c) + elseif(CONFIG_ROUTE_IPv6_RAMROUTE) + list( + APPEND + SRCS + net_alloc_ramroute.c + net_add_ramroute.c + net_del_ramroute.c + net_queue_ramroute.c + net_foreach_ramroute.c) + endif() + + # Support for in-memory, read-only (ROM) routing tables + + if(CONFIG_ROUTE_IPv4_ROMROUTE) + list(APPEND SRCS net_foreach_romroute.c) + elseif(CONFIG_ROUTE_IPv6_ROMROUTE) + list(APPEND SRCS net_foreach_romroute.c) + endif() + + # Support for routing tables in files + + if(CONFIG_ROUTE_IPv4_FILEROUTE) + list(APPEND SRCS net_fileroute.c net_add_fileroute.c net_del_fileroute.c + net_foreach_fileroute.c) + elseif(CONFIG_ROUTE_IPv6_FILEROUTE) + list(APPEND SRCS net_fileroute.c net_add_fileroute.c net_del_fileroute.c + net_foreach_fileroute.c) + endif() + + # In-memory cache for file-based routing tables + + if(CONFIG_ROUTE_IPv4_CACHEROUTE) + list(APPEND SRCS net_cacheroute.c) + elseif(CONFIG_ROUTE_IPv6_CACHEROUTE) + list(APPEND SRCS net_cacheroute.c) + endif() + + if(CONFIG_DEBUG_NET_INFO) + list(APPEND SRCS net_dumproute.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/rpmsg/CMakeLists.txt b/net/rpmsg/CMakeLists.txt new file mode 100644 index 0000000000..4dae39a0af --- /dev/null +++ b/net/rpmsg/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# net/rpmsg/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. +# +# ############################################################################## +if(CONFIG_NET_RPMSG) + target_sources(net PRIVATE rpmsg_sockif.c) +endif() diff --git a/net/sixlowpan/CMakeLists.txt b/net/sixlowpan/CMakeLists.txt new file mode 100644 index 0000000000..4677eed5bf --- /dev/null +++ b/net/sixlowpan/CMakeLists.txt @@ -0,0 +1,62 @@ +# ############################################################################## +# net/sixlowpan/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. +# +# ############################################################################## + +# IEEE 802.15.4 support + +if(CONFIG_NET_6LOWPAN) + # Include IEEE 802.15.4 file in the build + + set(SRCS + sixlowpan_initialize.c + sixlowpan_globals.c + sixlowpan_utils.c + sixlowpan_input.c + sixlowpan_framer.c + sixlowpan_framelist.c + sixlowpan_reassbuf.c) + + if(CONFIG_NET_TCP) + list(APPEND SRCS sixlowpan_tcpsend.c) + endif() + + if(CONFIG_NET_UDP) + list(APPEND SRCS sixlowpan_udpsend.c) + endif() + + if(CONFIG_NET_ICMPv6) + list(APPEND SRCS sixlowpan_icmpv6send.c) + endif() + + if(CONFIG_NET_UDP) + list(APPEND SRCS sixlowpan_send.c) + elseif(CONFIG_NET_ICMPv6) + list(APPEND SRCS sixlowpan_send.c) + endif() + + if(CONFIG_NET_6LOWPAN_COMPRESSION_HC1) + list(APPEND SRCS sixlowpan_hc1.c) + endif() + + if(CONFIG_NET_6LOWPAN_COMPRESSION_HC06) + list(APPEND SRCS sixlowpan_hc06.c) + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/socket/CMakeLists.txt b/net/socket/CMakeLists.txt new file mode 100644 index 0000000000..0c661fc4f1 --- /dev/null +++ b/net/socket/CMakeLists.txt @@ -0,0 +1,56 @@ +# ############################################################################## +# net/socket/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 socket source files + +set(SRCS + accept.c + bind.c + connect.c + getsockname.c + getpeername.c + listen.c + recv.c + recvfrom.c + send.c + sendto.c + socket.c + socketpair.c + net_close.c + recvmsg.c + sendmsg.c + net_dup2.c + net_sockif.c + net_poll.c + net_fstat.c) + +# Socket options + +if(CONFIG_NET_SOCKOPTS) + list(APPEND SRCS setsockopt.c getsockopt.c net_timeo.c) +endif() + +# Support for sendfile() + +if(CONFIG_NET_SENDFILE) + list(APPEND SRCS net_sendfile.c) +endif() + +target_sources(net PRIVATE ${SRCS}) diff --git a/net/tcp/CMakeLists.txt b/net/tcp/CMakeLists.txt new file mode 100644 index 0000000000..b2d9de5491 --- /dev/null +++ b/net/tcp/CMakeLists.txt @@ -0,0 +1,86 @@ +# ############################################################################## +# net/tcp/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. +# +# ############################################################################## + +# TCP/IP source files + +if(CONFIG_NET_TCP AND NOT CONFIG_NET_TCP_NO_STACK) + + # Socket layer + + set(SRCS tcp_connect.c tcp_accept.c tcp_recvfrom.c) + + if(CONFIG_NET_TCP_WRITE_BUFFERS) + list(APPEND SRCS tcp_send_buffered.c) + else() + list(APPEND SRCS tcp_send_unbuffered.c) + endif() + + if(CONFIG_NET_SENDFILE) + list(APPEND SRCS tcp_sendfile.c) + endif() + + if(CONFIG_NET_TCP_NOTIFIER) + list(APPEND SRCS tcp_notifier.c) + + if(CONFIG_NET_TCP_WRITE_BUFFERS) + list(APPEND SRCS tcp_txdrain.c) + endif() + endif() + + if(CONFIG_NET_TCPPROTO_OPTIONS) + list(APPEND SRCS tcp_setsockopt.c tcp_getsockopt.c) + endif() + + # Transport layer + + list( + APPEND + SRCS + tcp_conn.c + tcp_seqno.c + tcp_devpoll.c + tcp_finddev.c + tcp_timer.c + tcp_send.c + tcp_input.c + tcp_appsend.c + tcp_listen.c + tcp_close.c + tcp_monitor.c + tcp_callback.c + tcp_backlog.c + tcp_ipselect.c + tcp_recvwindow.c + tcp_netpoll.c + tcp_ioctl.c + tcp_shutdown.c) + + # TCP write buffering + + if(CONFIG_NET_TCP_WRITE_BUFFERS) + list(APPEND SRCS tcp_wrbuffer.c) + + if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS tcp_dump.c) + endif() + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/udp/CMakeLists.txt b/net/udp/CMakeLists.txt new file mode 100644 index 0000000000..7f7f3075fc --- /dev/null +++ b/net/udp/CMakeLists.txt @@ -0,0 +1,73 @@ +# ############################################################################## +# net/udp/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. +# +# ############################################################################## + +# UDP source files + +if(CONFIG_NET_UDP AND NOT CONFIG_NET_UDP_NO_STACK) + # Socket layer + + set(SRCS udp_recvfrom.c) + + if(CONFIG_NET_UDPPROTO_OPTIONS) + list(APPEND SRCS udp_setsockopt.c) + endif() + + if(CONFIG_NET_UDP_WRITE_BUFFERS) + list(APPEND SRCS udp_sendto_buffered.c) + else() + list(APPEND SRCS udp_sendto_unbuffered.c) + endif() + + if(CONFIG_NET_UDP_NOTIFIER) + list(APPEND SRCS udp_notifier.c) + + if(CONFIG_NET_UDP_WRITE_BUFFERS) + list(APPEND SRCS udp_txdrain.c) + endif() + endif() + + # Transport layer + + list( + APPEND + SRCS + udp_conn.c + udp_devpoll.c + udp_send.c + udp_input.c + udp_finddev.c + udp_close.c + udp_callback.c + udp_ipselect.c + udp_netpoll.c + udp_ioctl.c) + + # UDP write buffering + + if(CONFIG_NET_UDP_WRITE_BUFFERS) + list(APPEND SRCS udp_wrbuffer.c) + + if(CONFIG_DEBUG_FEATURES) + list(APPEND SRCS udp_wrbuffer_dump.c) + endif() + endif() + + target_sources(net PRIVATE ${SRCS}) +endif() diff --git a/net/usrsock/CMakeLists.txt b/net/usrsock/CMakeLists.txt new file mode 100644 index 0000000000..969489e235 --- /dev/null +++ b/net/usrsock/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# net/usrsock/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. +# +# ############################################################################## + +# User Socket source files + +if(CONFIG_NET_USRSOCK) + target_sources( + net + PRIVATE usrsock_close.c + usrsock_conn.c + usrsock_bind.c + usrsock_connect.c + usrsock_getpeername.c + usrsock_devif.c + usrsock_shutdown.c + usrsock_event.c + usrsock_getsockname.c + usrsock_getsockopt.c + usrsock_poll.c + usrsock_recvmsg.c + usrsock_sendmsg.c + usrsock_setsockopt.c + usrsock_socket.c + usrsock_sockif.c + usrsock_accept.c + usrsock_listen.c + usrsock_ioctl.c) +endif() diff --git a/net/utils/CMakeLists.txt b/net/utils/CMakeLists.txt new file mode 100644 index 0000000000..307a348c19 --- /dev/null +++ b/net/utils/CMakeLists.txt @@ -0,0 +1,60 @@ +# ############################################################################## +# net/utils/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. +# +# ############################################################################## + +# Common utilities + +set(SRCS + net_dsec2tick.c + net_dsec2timeval.c + net_timeval2dsec.c + net_chksum.c + net_ipchksum.c + net_incr32.c + net_lock.c + net_snoop.c + net_cmsg.c) + +# IPv6 utilities + +if(CONFIG_NET_IPv6) + list(APPEND SRCS net_ipv6_maskcmp.c net_ipv6_mask2pref.c net_ipv6_pref2mask.c) +endif() + +# TCP utilities + +if(CONFIG_NET_TCP) + list(APPEND SRCS net_tcpchksum.c) +endif() + +# UDP utilities + +if(CONFIG_NET_UDP) + list(APPEND SRCS net_udpchksum.c) +endif() + +# ICMP utilities + +if(CONFIG_NET_ICMP AND NOT CONFIG_NET_ICMP_NO_STACK) + list(APPEND SRCS net_icmpchksum.c) +elseif(CONFIG_NET_ICMPv6 AND NOT CONFIG_NET_ICMPv6_NO_STACK) + list(APPEND SRCS net_icmpchksum.c) +endif() + +target_sources(net PRIVATE ${SRCS}) diff --git a/openamp/.gitignore b/openamp/.gitignore index 0b63e0b118..fe119e1d71 100644 --- a/openamp/.gitignore +++ b/openamp/.gitignore @@ -3,3 +3,4 @@ /libmetal /open-amp /*.zip +/.openamp_patch diff --git a/openamp/CMakeLists.txt b/openamp/CMakeLists.txt new file mode 100644 index 0000000000..808cd85b61 --- /dev/null +++ b/openamp/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# openamp/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. +# +# ############################################################################## +if(CONFIG_OPENAMP) + + set(OPENAMP_VERSION 2022.04.0) + + include(libmetal.cmake) + include(open-amp.cmake) +endif() diff --git a/openamp/libmetal.cmake b/openamp/libmetal.cmake new file mode 100644 index 0000000000..6f58439859 --- /dev/null +++ b/openamp/libmetal.cmake @@ -0,0 +1,130 @@ +# ############################################################################## +# openamp/libmetal.cmake +# +# 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. +# +# ############################################################################## +if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libmetal) + FetchContent_Declare( + libmetal + DOWNLOAD_NAME "libmetal-v${OPENAMP_VERSION}.zip" + DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR} + URL "https://github.com/OpenAMP/libmetal/archive/v${OPENAMP_VERSION}.zip" + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/libmetal + BINARY_DIR + ${CMAKE_BINARY_DIR}/openamp/libmetal + CONFIGURE_COMMAND + "" + BUILD_COMMAND + "" + INSTALL_COMMAND + "" + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(libmetal) + + if(NOT libmetal_target_POPULATED) + FetchContent_Populate(libmetal) + endif() +endif() + +if("${CONFIG_ARCH}" STREQUAL "sim") + set(LIBMETAL_ARCH x86_64) +elseif("${CONFIG_ARCH}" STREQUAL "risc-v") + set(LIBMETAL_ARCH riscv) +else() + set(LIBMETAL_ARCH ${CONFIG_ARCH}) +endif() + +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 1) +set(PROJECT_VERSION_PATCH 0) +set(PROJECT_VERSION 0.1.0) +set(PROJECT_SYSTEM nuttx) +set(PROJECT_PROCESSOR ${LIBMETAL_ARCH}) +set(PROJECT_MACHINE ${CONFIG_ARCH_CHIP}) +set(PROJECT_SYSTEM_UPPER nuttx) +set(PROJECT_PROCESSOR_UPPER ${LIBMETAL_ARCH}) +set(PROJECT_MACHINE_UPPER ${CONFIG_ARCH_CHIP}) + +set(headers) +file( + GLOB headers + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib + ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/*.h) +foreach(header ${headers}) + configure_file(${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/${header} + ${CMAKE_BINARY_DIR}/include/metal/${header}) +endforeach() + +set(headers) +file( + GLOB headers + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/system/nuttx + ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/system/nuttx/*.h) +foreach(header ${headers}) + configure_file(${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/system/nuttx/${header} + ${CMAKE_BINARY_DIR}/include/metal/system/nuttx/${header}) +endforeach() + +set(headers) +file( + GLOB headers + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/processor/${LIBMETAL_ARCH} + ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/processor/${LIBMETAL_ARCH}/*.h) +foreach(header ${headers}) + configure_file( + ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/processor/${LIBMETAL_ARCH}/${header} + ${CMAKE_BINARY_DIR}/include/metal/processor/${LIBMETAL_ARCH}/${header}) +endforeach() + +set(headers) +file( + GLOB headers + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/compiler/gcc + ${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/compiler/gcc/*.h) +foreach(header ${headers}) + configure_file(${CMAKE_CURRENT_LIST_DIR}/libmetal/lib/compiler/gcc/${header} + ${CMAKE_BINARY_DIR}/include/metal/compiler/gcc/${header}) +endforeach() + +nuttx_add_kernel_library(lib_metal) + +target_sources( + lib_metal + PRIVATE libmetal/lib/system/nuttx/condition.c + libmetal/lib/system/nuttx/device.c + libmetal/lib/system/nuttx/init.c + libmetal/lib/system/nuttx/io.c + libmetal/lib/system/nuttx/irq.c + libmetal/lib/system/nuttx/shmem.c + libmetal/lib/system/nuttx/time.c + libmetal/lib/device.c + libmetal/lib/dma.c + libmetal/lib/init.c + libmetal/lib/io.c + libmetal/lib/irq.c + libmetal/lib/log.c + libmetal/lib/shmem.c + libmetal/lib/version.c) + +target_compile_definitions(lib_metal PRIVATE METAL_INTERNAL) diff --git a/openamp/open-amp.cmake b/openamp/open-amp.cmake new file mode 100644 index 0000000000..8d1bbe5fba --- /dev/null +++ b/openamp/open-amp.cmake @@ -0,0 +1,119 @@ +# ############################################################################## +# openamp/open-amp.cmake +# +# 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. +# +# ############################################################################## +if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/open-amp/.git) + FetchContent_Declare( + open-amp + DOWNLOAD_NAME "libopen-amp-v${OPENAMP_VERSION}.zip" + DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR} + URL "https://github.com/OpenAMP/open-amp/archive/v${OPENAMP_VERSION}.zip" + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/open-amp + BINARY_DIR + ${CMAKE_BINARY_DIR}/openamp/open-amp + CONFIGURE_COMMAND + "" + BUILD_COMMAND + "" + INSTALL_COMMAND + "" + TEST_COMMAND + "" + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(open-amp) + + if(NOT open-amp_POPULATED) + FetchContent_Populate(open-amp) + endif() + + if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/.openamp_patch) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_LIST_DIR}/.openamp_patch + 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 + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0002-ns-acknowledge-the-received-creation-message.patch + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0003-Negotiate-individual-buffer-size-dynamically.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 + > /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 + > /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 + > /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 + > /dev/null || (exit 0) + COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0008-openamp-add-available_idx-to-dump.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 + > /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 + > /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 + > /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 + > /dev/null || (exit 0) + DEPENDS open-amp) + add_custom_target(openamp_patch + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/.openamp_patch) + endif() +endif() + +nuttx_add_kernel_library(openamp) +target_sources( + openamp + PRIVATE open-amp/lib/remoteproc/elf_loader.c + open-amp/lib/remoteproc/remoteproc.c + open-amp/lib/remoteproc/remoteproc_virtio.c + open-amp/lib/remoteproc/rsc_table_parser.c + open-amp/lib/rpmsg/rpmsg.c + open-amp/lib/rpmsg/rpmsg_virtio.c + open-amp/lib/virtio/virtio.c + open-amp/lib/virtio/virtqueue.c) + +if(TARGET openamp_patch) + add_dependencies(openamp openamp_patch) +endif() diff --git a/sched/CMakeLists.txt b/sched/CMakeLists.txt new file mode 100644 index 0000000000..cc8dcfc3a6 --- /dev/null +++ b/sched/CMakeLists.txt @@ -0,0 +1,24 @@ +# ############################################################################## +# sched/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_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +nuttx_add_kernel_library(sched) +nuttx_add_subdirectory() +target_include_directories(sched INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/sched/clock/CMakeLists.txt b/sched/clock/CMakeLists.txt new file mode 100644 index 0000000000..6a9a712221 --- /dev/null +++ b/sched/clock/CMakeLists.txt @@ -0,0 +1,39 @@ +# ############################################################################## +# sched/clock/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) + +if(CONFIG_CLOCK_TIMEKEEPING) + list(APPEND SRCS clock_timekeeping.c) +endif() + +list( + APPEND + SRCS + clock_initialize.c + clock_settime.c + clock_gettime.c + clock_getres.c + clock_abstime2ticks.c + clock_systime_ticks.c + clock_systime_timespec.c + clock.c) + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/environ/CMakeLists.txt b/sched/environ/CMakeLists.txt new file mode 100644 index 0000000000..d93c15c941 --- /dev/null +++ b/sched/environ/CMakeLists.txt @@ -0,0 +1,35 @@ +# ############################################################################## +# sched/environ/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. +# +# ############################################################################## + +if(NOT CONFIG_DISABLE_ENVIRON) + target_sources( + sched + PRIVATE env_getenvironptr.c + env_dup.c + env_release.c + env_findvar.c + env_removevar.c + env_clearenv.c + env_getenv.c + env_putenv.c + env_setenv.c + env_unsetenv.c + env_foreach.c) +endif() diff --git a/sched/group/CMakeLists.txt b/sched/group/CMakeLists.txt new file mode 100644 index 0000000000..03b1ac816c --- /dev/null +++ b/sched/group/CMakeLists.txt @@ -0,0 +1,62 @@ +# ############################################################################## +# sched/group/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 + group_create.c + group_join.c + group_leave.c + group_find.c + group_setupstreams.c + group_setupidlefiles.c + group_setuptaskfiles.c + group_foreachchild.c + group_killchildren.c + group_signal.c + group_argvstr.c) + +if(CONFIG_SCHED_HAVE_PARENT) + if(CONFIG_SCHED_CHILD_STATUS) + list(APPEND SRCS group_childstatus.c) + endif() +elseif(CONFIG_SCHED_WAITPID) + list(APPEND SRCS group_waiter.c) +endif() + +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() + +if(CONFIG_BINFMT_LOADABLE) + list(APPEND SRCS group_exitinfo.c) +endif() + +if(NOT CONFIG_BUILD_FLAT) + list(APPEND SRCS group_malloc.c group_realloc.c group_zalloc.c group_free.c) +endif() + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/init/CMakeLists.txt b/sched/init/CMakeLists.txt new file mode 100644 index 0000000000..dec8aaf650 --- /dev/null +++ b/sched/init/CMakeLists.txt @@ -0,0 +1,27 @@ +# ############################################################################## +# sched/init/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 nx_start.c nx_bringup.c) + +if(CONFIG_SMP) + list(APPEND SRCS nx_smpstart.c) +endif() + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/irq/CMakeLists.txt b/sched/irq/CMakeLists.txt new file mode 100644 index 0000000000..00e362950e --- /dev/null +++ b/sched/irq/CMakeLists.txt @@ -0,0 +1,45 @@ +# ############################################################################## +# sched/irq/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) + +if(CONFIG_SMP) + list(APPEND SRCS irq_spinlock.c) +endif() + +if(CONFIG_IRQCOUNT) + list(APPEND SRCS irq_csection.c) +endif() + +if(CONFIG_SCHED_IRQMONITOR) + list(APPEND SRCS irq_foreach.c) + if(CONFIG_FS_PROCFS) + list(APPEND SRCS irq_procfs.c) + endif() +endif() + +if(CONFIG_IRQCHAIN) + list(APPEND SRCS irq_chain.c) +endif() + +list(APPEND SRCS irq_initialize.c irq_attach.c irq_dispatch.c + irq_unexpectedisr.c) + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/misc/CMakeLists.txt b/sched/misc/CMakeLists.txt new file mode 100644 index 0000000000..86120f08ac --- /dev/null +++ b/sched/misc/CMakeLists.txt @@ -0,0 +1,20 @@ +# ############################################################################## +# sched/sched/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. +# +# ############################################################################## +target_sources(sched PRIVATE assert.c panic_notifier.c reboot_notifier.c) diff --git a/sched/module/CMakeLists.txt b/sched/module/CMakeLists.txt new file mode 100644 index 0000000000..afa2c8f24f --- /dev/null +++ b/sched/module/CMakeLists.txt @@ -0,0 +1,31 @@ +# ############################################################################## +# sched/module/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. +# +# ############################################################################## + +if(CONFIG_MODULE) + set(SRCS) + + if(CONFIG_FS_PROCFS AND NOT CONFIG_FS_PROCFS_EXCLUDE_MODULE) + list(APPEND SRCS mod_procfs.c) + endif() + + list(APPEND SRCS mod_insmod.c mod_rmmod.c mod_modsym.c mod_modhandle.c) + + target_sources(sched PRIVATE ${SRCS}) +endif() diff --git a/sched/mqueue/CMakeLists.txt b/sched/mqueue/CMakeLists.txt new file mode 100644 index 0000000000..75d51e76d2 --- /dev/null +++ b/sched/mqueue/CMakeLists.txt @@ -0,0 +1,57 @@ +# ############################################################################## +# sched/mqueue/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) +if(NOT CONFIG_DISABLE_MQUEUE) + + list( + APPEND + SRCS + mq_send.c + mq_timedsend.c + mq_sndinternal.c + mq_receive.c + mq_timedreceive.c + mq_rcvinternal.c + mq_initialize.c + mq_msgfree.c + mq_msgqalloc.c + mq_msgqfree.c + mq_recover.c + mq_setattr.c + mq_waitirq.c + mq_notify.c + mq_getattr.c) + +endif() + +if(NOT CONFIG_DISABLE_MQUEUE) + + list( + APPEND + SRCS + msgctl.c + msgget.c + msginternal.c + msgrcv.c + msgsnd.c) + +endif() +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/paging/CMakeLists.txt b/sched/paging/CMakeLists.txt new file mode 100644 index 0000000000..2130aaeb20 --- /dev/null +++ b/sched/paging/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# sched/paging/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. +# +# ############################################################################## + +if(CONFIG_PAGING) + + target_sources(sched PRIVATE pg_miss.c pg_worker.c) + +endif() diff --git a/sched/pthread/CMakeLists.txt b/sched/pthread/CMakeLists.txt new file mode 100644 index 0000000000..84b3517a81 --- /dev/null +++ b/sched/pthread/CMakeLists.txt @@ -0,0 +1,61 @@ +# ############################################################################## +# sched/pthread/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. +# +# ############################################################################## + +if(NOT CONFIG_DISABLE_PTHREAD) + set(SRCS) + + list( + APPEND + SRCS + pthread_create.c + pthread_exit.c + pthread_join.c + pthread_detach.c + pthread_getschedparam.c + pthread_setschedparam.c + pthread_mutexinit.c + pthread_mutexdestroy.c + pthread_mutextimedlock.c + pthread_mutextrylock.c + pthread_mutexunlock.c + pthread_condwait.c + pthread_condsignal.c + pthread_condbroadcast.c + pthread_condclockwait.c + pthread_sigmask.c + pthread_cancel.c + pthread_initialize.c + pthread_completejoin.c + pthread_findjoininfo.c + pthread_release.c + pthread_setschedprio.c + pthread_barrierwait.c) + + if(NOT CONFIG_PTHREAD_MUTEX_UNSAFE) + list(APPEND SRCS pthread_mutex.c pthread_mutexconsistent.c + pthread_mutexinconsistent.c) + endif() + + if(CONFIG_SMP) + list(APPEND SRCS pthread_setaffinity.c pthread_getaffinity.c) + endif() + + target_sources(sched PRIVATE ${SRCS}) +endif() diff --git a/sched/sched/CMakeLists.txt b/sched/sched/CMakeLists.txt new file mode 100644 index 0000000000..1934cb8621 --- /dev/null +++ b/sched/sched/CMakeLists.txt @@ -0,0 +1,122 @@ +# ############################################################################## +# sched/sched/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 + sched_getfiles.c + sched_addreadytorun.c + sched_removereadytorun.c + sched_addprioritized.c + sched_mergeprioritized.c + sched_mergepending.c + sched_addblocked.c + sched_removeblocked.c + sched_gettcb.c + sched_verifytcb.c + sched_releasetcb.c + sched_setparam.c + sched_setpriority.c + sched_getparam.c + sched_setscheduler.c + sched_getscheduler.c + sched_yield.c + sched_rrgetinterval.c + sched_foreach.c + sched_lock.c + sched_unlock.c + sched_lockcount.c + sched_idletask.c + sched_self.c + sched_get_stackinfo.c + sched_sysinfo.c + sched_reprioritizertr.c + sched_get_stateinfo.c) + +if(CONFIG_PRIORITY_INHERITANCE) + list(APPEND SRCS sched_reprioritize.c) +endif() + +if(CONFIG_SMP) + list( + APPEND + SRCS + sched_cpuselect.c + sched_cpupause.c + sched_getcpu.c + sched_getaffinity.c + sched_setaffinity.c) +endif() + +if(CONFIG_SIG_SIGSTOP_ACTION) + list(APPEND SRCS sched_suspend.c) +endif() + +if(CONFIG_SCHED_WAITPID) + list(APPEND SRCS sched_waitpid.c) + if(CONFIG_SCHED_HAVE_PARENT) + list(APPEND SRCS sched_waitid.c sched_wait.c) + endif() +endif() + +if(NOT "${CONFIG_RR_INTERVAL}" STREQUAL "0") + list(APPEND SRCS sched_roundrobin.c) +endif() + +if(CONFIG_SCHED_SPORADIC) + list(APPEND SRCS sched_sporadic.c) +endif() + +if(CONFIG_SCHED_SUSPENDSCHEDULER) + list(APPEND SRCS sched_suspendscheduler.c) +endif() + +if(NOT "${CONFIG_RR_INTERVAL}" STREQUAL "0") + list(APPEND SRCS sched_resumescheduler.c) +elseif(CONFIG_SCHED_RESUMESCHEDULER) + list(APPEND SRCS sched_resumescheduler.c) +endif() + +if(CONFIG_SCHED_CPULOAD) + list(APPEND SRCS sched_cpuload.c) + if(CONFIG_CPULOAD_ONESHOT) + list(APPEND SRCS sched_cpuload_oneshot.c) + endif() + if(CONFIG_CPULOAD_PERIOD) + list(APPEND SRCS sched_cpuload_period.c) + endif() +endif() + +if(CONFIG_SCHED_TICKLESS) + list(APPEND SRCS sched_timerexpiration.c) +else() + list(APPEND SRCS sched_processtimer.c) +endif() + +if(CONFIG_SMP) + list(APPEND SRCS sched_thistask.c) +endif() + +if(CONFIG_SCHED_CRITMONITOR) + list(APPEND SRCS sched_critmonitor.c) +endif() + +if(CONFIG_SCHED_BACKTRACE) + list(APPEND SRCS sched_backtrace.c) +endif() + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/semaphore/CMakeLists.txt b/sched/semaphore/CMakeLists.txt new file mode 100644 index 0000000000..8c74e0978a --- /dev/null +++ b/sched/semaphore/CMakeLists.txt @@ -0,0 +1,48 @@ +# ############################################################################## +# sched/semaphore/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 semaphore-related files to the build + +if(CONFIG_PRIORITY_INHERITANCE) + list(APPEND CSRCS sem_initialize.c sem_holder.c sem_setprotocol.c) +endif() + +if(CONFIG_SPINLOCK) + list(APPEND CSRCS spinlock.c) +endif() + +# Include semaphore build support + +list( + APPEND + CSRCS + sem_destroy.c + sem_wait.c + sem_trywait.c + sem_tickwait.c + sem_timedwait.c + sem_clockwait.c + sem_timeout.c + sem_post.c + sem_recover.c + sem_reset.c + sem_waitirq.c) + +target_sources(sched PRIVATE ${CSRCS}) diff --git a/sched/signal/CMakeLists.txt b/sched/signal/CMakeLists.txt new file mode 100644 index 0000000000..bdee756dcf --- /dev/null +++ b/sched/signal/CMakeLists.txt @@ -0,0 +1,58 @@ +# ############################################################################## +# sched/signal/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) + +if(CONFIG_SIG_DEFAULT) + list(APPEND SRCS sig_default.c) +endif() + +list( + APPEND + SRCS + sig_initialize.c + sig_action.c + sig_procmask.c + sig_pending.c + sig_suspend.c + sig_kill.c + sig_tgkill.c + sig_queue.c + sig_waitinfo.c + sig_timedwait.c + sig_findaction.c + sig_allocpendingsigaction.c + sig_releasependingsigaction.c + sig_unmaskpendingsignal.c + sig_removependingsignal.c + sig_releasependingsignal.c + sig_lowest.c + sig_notification.c + sig_cleanup.c + sig_dispatch.c + sig_deliver.c + sig_pause.c + sig_nanosleep.c + sig_usleep.c + sig_sleep.c + sig_ppoll.c + sig_pselect.c) + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/task/CMakeLists.txt b/sched/task/CMakeLists.txt new file mode 100644 index 0000000000..092197f29a --- /dev/null +++ b/sched/task/CMakeLists.txt @@ -0,0 +1,75 @@ +# ############################################################################## +# sched/task/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) + +list( + APPEND + SRCS + task_create.c + task_init.c + task_setup.c + task_activate.c + task_start.c + task_delete.c + task_exit.c + task_exithook.c + task_getgroup.c + task_getpid.c + task_prctl.c + task_recover.c + task_restart.c + task_spawnparms.c + task_setcancelstate.c + task_cancelpt.c + task_terminate.c + task_gettid.c + exit.c + task_tls_alloc.c) + +if(CONFIG_SCHED_HAVE_PARENT) + list(APPEND SRCS task_getppid.c task_reparent.c) +endif() + +if(CONFIG_ARCH_HAVE_VFORK) + if(CONFIG_SCHED_WAITPID) + list(APPEND SRCS task_vfork.c) + endif() +endif() + +if(NOT CONFIG_BUILD_KERNEL) + list(APPEND SRCS task_spawn.c) +endif() + +if(CONFIG_CANCELLATION_POINTS) + list(APPEND SRCS task_setcanceltype.c task_testcancel.c) +endif() + +if(NOT CONFIG_BINFMT_DISABLE) + if(CONFIG_LIBC_EXECFUNCS) + list(APPEND SRCS task_execve.c task_posixspawn.c) + endif() +endif() + +if(CONFIG_SCHED_STARTHOOK) + list(APPEND SRCS task_starthook.c) +endif() + +target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/timer/CMakeLists.txt b/sched/timer/CMakeLists.txt new file mode 100644 index 0000000000..04e065a1e3 --- /dev/null +++ b/sched/timer/CMakeLists.txt @@ -0,0 +1,34 @@ +# ############################################################################## +# sched/timer/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. +# +# ############################################################################## + +if(NOT CONFIG_DISABLE_POSIX_TIMERS) + + target_sources( + sched + PRIVATE timer_initialize.c + timer_create.c + timer_delete.c + timer_getoverrun.c + timer_getitimer.c + timer_gettime.c + timer_setitimer.c + timer_settime.c + timer_release.c) +endif() diff --git a/sched/tls/CMakeLists.txt b/sched/tls/CMakeLists.txt new file mode 100644 index 0000000000..2420a040c8 --- /dev/null +++ b/sched/tls/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# sched/tls/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. +# +# ############################################################################## + +target_sources(sched PRIVATE task_initinfo.c task_uninitinfo.c tls_initinfo.c + tls_dupinfo.c) diff --git a/sched/wdog/CMakeLists.txt b/sched/wdog/CMakeLists.txt new file mode 100644 index 0000000000..920885a66d --- /dev/null +++ b/sched/wdog/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# sched/wdog/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. +# +# ############################################################################## + +target_sources(sched PRIVATE wd_initialize.c wd_start.c wd_cancel.c + wd_gettime.c wd_recover.c) diff --git a/sched/wqueue/CMakeLists.txt b/sched/wqueue/CMakeLists.txt new file mode 100644 index 0000000000..2ee1d9f186 --- /dev/null +++ b/sched/wqueue/CMakeLists.txt @@ -0,0 +1,42 @@ +# ############################################################################## +# sched/wqueue/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 work queue files + +if(CONFIG_SCHED_WORKQUEUE) + set(SRCS) + + list(APPEND SRCS kwork_queue.c kwork_cancel.c kwork_thread.c) + + # Add low priority work queue files + + if(CONFIG_PRIORITY_INHERITANCE) + list(APPEND SRCS kwork_inherit.c) + endif() + + # Add work queue notifier support + + if(CONFIG_WQUEUE_NOTIFIER) + list(APPEND SRCS kwork_notifier.c) + endif() + + target_sources(sched PRIVATE ${SRCS}) + +endif() diff --git a/syscall/CMakeLists.txt b/syscall/CMakeLists.txt new file mode 100644 index 0000000000..53fdbb1768 --- /dev/null +++ b/syscall/CMakeLists.txt @@ -0,0 +1,44 @@ +# ############################################################################## +# syscall/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. +# +# ############################################################################## +# Parse CSV file to get expected output source files for each target +file(STRINGS syscall.csv SYSCALLS) +list(TRANSFORM SYSCALLS REPLACE "^\"([^,]+)\",.+" "\\1") +list(TRANSFORM SYSCALLS APPEND ".c") + +if(CONFIG_LIB_SYSCALL) + add_subdirectory(proxies) + add_subdirectory(stubs) + + target_sources(stubs PRIVATE syscall_stublookup.c) +endif() + +# TODO: should CONFIG_SCHED_INSTRUMENTATION_SYSCALL depend on +# CONFIG_LIB_SYSCALL? +if(CONFIG_SCHED_INSTRUMENTATION_SYSCALL) + if(CONFIG_LIB_SYSCALL) + target_sources(proxies PRIVATE syscall_names.c) + else() + target_sources(proxies PRIVATE syscall_names.c) + endif() +endif() + +if(CONFIG_SCHED_INSTRUMENTATION_SYSCALL) + add_subdirectory(wraps) +endif() diff --git a/syscall/proxies/CMakeLists.txt b/syscall/proxies/CMakeLists.txt new file mode 100644 index 0000000000..a36a285284 --- /dev/null +++ b/syscall/proxies/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# syscall/proxies/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_system_library(proxies) + +list(TRANSFORM SYSCALLS PREPEND "${CMAKE_CURRENT_BINARY_DIR}/PROXY_") + +# generate files +add_custom_command( + OUTPUT ${SYSCALLS} + COMMAND ${CMAKE_BINARY_DIR}/bin/mksyscall -p + ${CMAKE_CURRENT_LIST_DIR}/../syscall.csv + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS nuttx_host_tools) + +# add sources to target +target_sources(proxies PRIVATE ${SYSCALLS}) diff --git a/syscall/stubs/CMakeLists.txt b/syscall/stubs/CMakeLists.txt new file mode 100644 index 0000000000..b3ce6d8b89 --- /dev/null +++ b/syscall/stubs/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# syscall/stubs/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_kernel_library(stubs) + +list(TRANSFORM SYSCALLS PREPEND "${CMAKE_CURRENT_BINARY_DIR}/STUB_") + +# generate files +add_custom_command( + OUTPUT ${SYSCALLS} + COMMAND ${CMAKE_BINARY_DIR}/bin/mksyscall -s + ${CMAKE_CURRENT_LIST_DIR}/../syscall.csv + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS nuttx_host_tools) + +# add sources to target +target_sources(stubs PRIVATE ${SYSCALLS}) diff --git a/syscall/wraps/CMakeLists.txt b/syscall/wraps/CMakeLists.txt new file mode 100644 index 0000000000..2be30de35e --- /dev/null +++ b/syscall/wraps/CMakeLists.txt @@ -0,0 +1,36 @@ +# ############################################################################## +# syscall/wraps/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_kernel_library(wraps) + +list(TRANSFORM SYSCALLS PREPEND "${CMAKE_CURRENT_BINARY_DIR}/WRAPS_") + +# generate files +execute_process( + OUTPUT ${SYSCALLS} + COMMAND ${CMAKE_BINARY_DIR}/bin/mksyscall -w + ${CMAKE_CURRENT_LIST_DIR}/../syscall.csv + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS nuttx_host_tools) + +# TODO: SYSCALLWRAPS = syscall_wraps.ldcmd $(Q) $(CPP) $(CPPFLAGS) +# $(SYSCALLWRAPS:.ldcmd=.h) | \ sed -e '1,/WRAPOPTSTARTS/d' -e '/^#/d' > +# $(SYSCALLWRAPS) + +# add sources to target +target_sources(wraps PRIVATE ${SYSCALLS}) diff --git a/tools/.gitignore b/tools/.gitignore index 6d6b124ab8..59c05a7e27 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -20,3 +20,4 @@ /.k2h-body.dat /.k2h-apndx.dat /jlink-nuttx.so +__pycache__ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000000..41f6f8e388 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,64 @@ +# ############################################################################## +# tools/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. +# +# ############################################################################## +# Configure project +cmake_minimum_required(VERSION 3.16) +project(nuttx_tools LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING "Build type" FORCE) +endif() + +message(STATUS "NuttX Host Tools") + +# set basic warnings + +add_compile_options(-Wall -Wstrict-prototypes -Wshadow -Wundef) + +# configure according to platform + +if(MSYS) + add_compile_definitions(CONFIG_WINDOWS_NATIVE=y) +else() + # GCC or clang is assumed in all other POSIX environments (Linux, Cygwin, + # MSYS2, macOS). strtok_r is used in some tools, but does not seem to be + # available in the MinGW environment. + + add_compile_definitions(HAVE_STRTOK_C=1) + + if(CYGWIN) + add_compile_definitions(HOST_CYGWIN=1) + endif() +endif() + +# define targets + +add_library(csvparser csvparser.c) + +add_executable(mksyscall mksyscall.c) +target_link_libraries(mksyscall PRIVATE csvparser) +install(TARGETS mksyscall DESTINATION bin) + +add_executable(nxstyle nxstyle.c) +install(TARGETS nxstyle DESTINATION bin) + +add_executable(gencromfs gencromfs.c) +install(TARGETS gencromfs DESTINATION bin) diff --git a/tools/cxd56/CMakeLists.txt b/tools/cxd56/CMakeLists.txt new file mode 100644 index 0000000000..997e932688 --- /dev/null +++ b/tools/cxd56/CMakeLists.txt @@ -0,0 +1,53 @@ +# ############################################################################## +# tools/cxd56/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. +# +# ############################################################################## + +cmake_minimum_required(VERSION 3.16) +project(nuttx_postbuild LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING "Build type" FORCE) +endif() + +# set basic warnings + +add_compile_options(-O2 -Wall) + +# configure according to platform + +if(MSYS) + add_compile_definitions(CONFIG_WINDOWS_NATIVE=y) +else() + # GCC or clang is assumed in all other POSIX environments (Linux, Cygwin, + # MSYS2, macOS). strtok_r is used in some tools, but does not seem to be + # available in the MinGW environment. + + add_compile_definitions(HAVE_STRTOK_C=1) + + if(CYGWIN) + add_compile_definitions(HOST_CYGWIN=1) + endif() +endif() + +# define targets + +add_executable(mkspk mkspk.c clefia.c) +install(TARGETS mkspk DESTINATION bin) diff --git a/video/CMakeLists.txt b/video/CMakeLists.txt new file mode 100644 index 0000000000..8adcdf39ab --- /dev/null +++ b/video/CMakeLists.txt @@ -0,0 +1,22 @@ +# ############################################################################## +# video/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_kernel_library(video) + +nuttx_add_subdirectory() diff --git a/video/videomode/CMakeLists.txt b/video/videomode/CMakeLists.txt new file mode 100644 index 0000000000..754ea77499 --- /dev/null +++ b/video/videomode/CMakeLists.txt @@ -0,0 +1,23 @@ +# ############################################################################## +# video/videomode/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. +# +# ############################################################################## +if(CONFIG_VIDEO_EDID) + target_sources(video PRIVATE edid_parse.c edid_dump.c videomode_lookup.c + videomode_sort.c videomode_dump.c vesagtf.c) +endif() diff --git a/wireless/CMakeLists.txt b/wireless/CMakeLists.txt new file mode 100644 index 0000000000..9fc2919e61 --- /dev/null +++ b/wireless/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# wireless/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. +# +# ############################################################################## + +if(CONFIG_WIRELESS) + nuttx_add_kernel_library(wireless) + + nuttx_add_subdirectory() + + if(NOT EXISTS ${CMAKE_BINARY_DIR}/wireless) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/wireless) + endif() + if(NOT EXISTS ${CMAKE_BINARY_DIR}/wireless/dummy.c) + file(TOUCH ${CMAKE_BINARY_DIR}/wireless/dummy.c) + endif() + target_sources(wireless PRIVATE ${CMAKE_BINARY_DIR}/wireless/dummy.c) +endif() diff --git a/wireless/bluetooth/CMakeLists.txt b/wireless/bluetooth/CMakeLists.txt new file mode 100644 index 0000000000..bc609afa2e --- /dev/null +++ b/wireless/bluetooth/CMakeLists.txt @@ -0,0 +1,42 @@ +# ############################################################################## +# wireless/bluetooth/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. +# +# ############################################################################## + +if(CONFIG_WIRELESS_BLUETOOTH) + set(SRCS bt_buf.c bt_netdev.c bt_queue.c bt_hcicore.c) + + # Host-layer + + if(CONFIG_WIRELESS_BLUETOOTH_HOST) + list( + APPEND + SRCS + bt_atomic.c + bt_att.c + bt_conn.c + bt_gatt.c + bt_ioctl.c + bt_keys.c + bt_l2cap.c + bt_smp.c + bt_uuid.c) + endif() + + target_sources(wireless PRIVATE ${SRCS}) +endif() diff --git a/wireless/ieee802154/CMakeLists.txt b/wireless/ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..63883f78fa --- /dev/null +++ b/wireless/ieee802154/CMakeLists.txt @@ -0,0 +1,63 @@ +# ############################################################################## +# wireless/ieee802154/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. +# +# ############################################################################## + +if(CONFIG_WIRELESS_IEEE802154) + set(SRCS ieee802154_primitive.c) + + if(CONFIG_IEEE802154_MAC) + + list( + APPEND + SRCS + mac802154.c + mac802154_assoc.c + mac802154_disassoc.c + mac802154_bind.c + mac802154_data.c + mac802154_get_mhrlen.c + mac802154_getset.c + mac802154_gts.c + mac802154_ioctl.c + mac802154_orphan.c + mac802154_poll.c + mac802154_purge.c + mac802154_reset.c + mac802154_rxenable.c + mac802154_scan.c + mac802154_start.c + mac802154_sync.c) + + # Include wireless devices build support + + if(CONFIG_IEEE802154_MACDEV) + list(APPEND SRCS mac802154_device.c) + endif() + + if(CONFIG_IEEE802154_NETDEV) + list(APPEND SRCS mac802154_netdev.c) + endif() + endif() + + if(CONFIG_IEEE802154_LOOPBACK) + list(APPEND SRCS mac802154_loopback.c) + endif() + + target_sources(wireless PRIVATE ${SRCS}) +endif() diff --git a/wireless/pktradio/CMakeLists.txt b/wireless/pktradio/CMakeLists.txt new file mode 100644 index 0000000000..a1fa20e17b --- /dev/null +++ b/wireless/pktradio/CMakeLists.txt @@ -0,0 +1,29 @@ +# ############################################################################## +# wireless/pktradio/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. +# +# ############################################################################## + +if(CONFIG_WIRELESS_PKTRADIO) + set(SRCS pktradio_metadata.c) + + if(CONFIG_PKTRADIO_LOOPBACK) + list(APPEND SRCS pktradio_loopback.c) + endif() + + target_sources(wireless PRIVATE ${SRCS}) +endif()