diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..30dd6f7172 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,731 @@ +project(Zephyr-Kernel VERSION ${PROJECT_VERSION}) +enable_language(C CXX ASM) + +# *DOCUMENTATION* +# +# Note that this is *NOT* the top-level CMakeLists.txt. That's in the +# application. See the Application Development Primer documentation +# for details. +# +# To see a list of typical targets execute "make usage" +# More info can be located in ./README.rst +# Comments in this file are targeted only to the developer, do not +# expect to learn how to build the kernel reading this file. + +# Verify that the toolchain can compile a dummy file, if it is not we +# won't be able to test for compatiblity with certain C flags. +check_c_compiler_flag("" toolchain_is_ok) +assert(toolchain_is_ok "The toolchain is unable to build a dummy C file. See CMakeError.log.") + +# Do not generate make install target. +set(CMAKE_SKIP_INSTALL_RULES ON) + +set(CMAKE_EXECUTABLE_SUFFIX .elf) + +set(SOC_NAME ${CONFIG_SOC}) +set(SOC_SERIES ${CONFIG_SOC_SERIES}) +set(SOC_FAMILY ${CONFIG_SOC_FAMILY}) + +if("${SOC_SERIES}" STREQUAL "") + set(SOC_PATH ${SOC_NAME}) +else() + set(SOC_PATH ${SOC_FAMILY}/${SOC_SERIES}) +endif() + +if(NOT PROPERTY_LINKER_SCRIPT_DEFINES) + set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__GCC_LINKER_CMD__) +endif() + +define_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT BRIEF_DOCS " " FULL_DOCS " ") +set_property( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH}) + +# zephyr_interface is a source-less library that has all the global +# compiler options needed by all source files. All zephyr libraries, +# including the library named "zephyr" link with this library to +# obtain these flags. +add_library(zephyr_interface INTERFACE) + +# zephyr is a catchall CMake library for source files that can be +# built purely with the include paths, defines, and other compiler +# flags that come with zephyr_interface. +zephyr_library_named(zephyr) + +zephyr_include_directories( + kernel/include + arch/${ARCH}/include + arch/${ARCH}/soc/${SOC_PATH} + arch/${ARCH}/soc/${SOC_PATH}/include + arch/${ARCH}/soc/${SOC_FAMILY}/include + ${BOARD_DIR} + include + include/drivers + ${PROJECT_BINARY_DIR}/include/generated + ${USERINCLUDE} + ${STDINCLUDE} +) + + +zephyr_compile_definitions( + KERNEL + __ZEPHYR__=1 + _FORTIFY_SOURCE=2 +) + +# We need to set an optimization level. +# Default to -Os +# unless CONFIG_DEBUG is set, then it is -Og +# +# also, some toolchain's break with -Os, and some toolchain's break +# with -Og so allow them to override what flag to use +# +# Finally, the user can use Kconfig to add compiler options that will +# come after these options and override them +set_ifndef(OPTIMIZE_FOR_SIZE_FLAG "-Os") +set_ifndef(OPTIMIZE_FOR_DEBUG_FLAG "-Og") +if(CONFIG_DEBUG) + set(OPTIMIZATION_FLAG ${OPTIMIZE_FOR_DEBUG_FLAG}) +else() + set(OPTIMIZATION_FLAG ${OPTIMIZE_FOR_SIZE_FLAG}) # Default +endif() + +zephyr_compile_options( + ${OPTIMIZATION_FLAG} # Usually -Os + -g # TODO: build configuration enough? + -Wall + -Wformat + -Wformat-security + -Wno-format-zero-length + -Wno-main + -ffreestanding + -include ${AUTOCONF_H} +) + +zephyr_compile_options( + $<$:-std=c99> + + $<$:-std=c++11> + $<$:-fcheck-new> + $<$:-ffunction-sections> + $<$:-fdata-sections> + $<$:-fno-rtti> + $<$:-fno-exceptions> + + $<$:-xassembler-with-cpp> + $<$:-D_ASMLANGUAGE> +) + +zephyr_ld_options( + -nostartfiles + -nodefaultlibs + -nostdlib + -static + -no-pie + ) + +# ========================================================================== +# +# cmake -DW=... settings +# +# W=1 - warnings that may be relevant and does not occur too often +# W=2 - warnings that occur quite often but may still be relevant +# W=3 - the more obscure warnings, can most likely be ignored +# ========================================================================== +if(W MATCHES "1") + zephyr_compile_options( + -Wextra + -Wunused + -Wno-unused-parameter + -Wmissing-declarations + -Wmissing-format-attribute + -Wold-style-definition + ) + zephyr_cc_option( + -Wmissing-prototypes + -Wmissing-include-dirs + -Wunused-but-set-variable + -Wno-missing-field-initializers + ) +endif() + +if(W MATCHES "2") + zephyr_compile_options( + -Waggregate-return + -Wcast-align + -Wdisabled-optimization + -Wnested-externs + -Wshadow + ) + zephyr_cc_option( + -Wlogical-op + -Wmissing-field-initializers + ) +endif() + +if(W MATCHES "3") + zephyr_compile_options( + -Wbad-function-cast + -Wcast-qual + -Wconversion + -Wpacked + -Wpadded + -Wpointer-arith + -Wredundant-decls + -Wswitch-default + ) + zephyr_cc_option( + -Wpacked-bitfield-compat + -Wvla + ) +endif() + +# Allow the user to inject options when calling cmake, e.g. +# 'cmake -DEXTRA_CFLAGS="-Werror -Wno-deprecated-declarations" ..' + +separate_arguments(EXTRA_CPPFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_CPPFLAGS}) +separate_arguments(EXTRA_LD_FLAGS_AS_LIST UNIX_COMMAND ${EXTRA_LD_FLAGS}) +separate_arguments(EXTRA_CFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_CFLAGS}) +separate_arguments(EXTRA_CXXFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_CXXFLAGS}) +separate_arguments(EXTRA_AFLAGS_AS_LIST UNIX_COMMAND ${EXTRA_AFLAGS}) + +if(EXTRA_CPPFLAGS) + zephyr_compile_definitions(${EXTRA_CPPFLAGS_AS_LIST}) +endif() +if(EXTRA_LDFLAGS) + zephyr_link_libraries(${EXTRA_LDFLAGS_AS_LIST}) +endif() +if(EXTRA_CFLAGS) + foreach(F ${EXTRA_CFLAGS_AS_LIST}) + zephyr_compile_options($<$:${F}>) + endforeach() +endif() +if(EXTRA_CXXFLAGS) + foreach(F ${EXTRA_CXXFLAGS_AS_LIST}) + zephyr_compile_options($<$:${F}>) + endforeach() +endif() +if(EXTRA_AFLAGS) + foreach(F ${EXTRA_AFLAGS_AS_LIST}) + zephyr_compile_options($<$:${F}>) + endforeach() +endif() + +if(CONFIG_READABLE_ASM) + zephyr_cc_option(-fno-reorder-blocks) + zephyr_cc_option(-fno-ipa-cp-clone) + zephyr_cc_option(-fno-partial-inlining) +endif() + +zephyr_cc_option(-fno-asynchronous-unwind-tables) +zephyr_cc_option(-fno-pie) +zephyr_cc_option(-fno-pic) +zephyr_cc_option(-fno-strict-overflow) +zephyr_cc_option(-Wno-pointer-sign) + +if(CONFIG_STACK_CANARIES) + zephyr_cc_option(-fstack-protector-all) +else() + zephyr_cc_option(-fno-stack-protector) +endif() + +if(CONFIG_OVERRIDE_FRAME_POINTER_DEFAULT) + if(CONFIG_OMIT_FRAME_POINTER) + zephyr_cc_option(-fomit-frame-pointer) + else() + zephyr_cc_option(-fno-omit-frame-pointer) + endif() +endif() + +zephyr_compile_options(${CONFIG_COMPILER_OPT}) + +# TODO: Include arch compiler options at this point. + +# TODO: This Clang check is broken +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + zephyr_cc_option( + -Wno-unknown-warning-option + -Wno-unused-variable + -Wno-format-invalid-specifier + -Wno-gnu + # comparison of unsigned expression < 0 is always false + -Wno-tautological-compare + ) +else() # GCC assumed + zephyr_cc_option( + -Wno-unused-but-set-variable + -fno-reorder-functions + ) + if(NOT ${ZEPHYR_GCC_VARIANT} STREQUAL "xcc") + zephyr_cc_option(-fno-defer-pop) + endif() +endif() + +zephyr_cc_option_ifdef(CONFIG_DEBUG_SECTION_MISMATCH -fno-inline-functions-called-once) +zephyr_cc_option_ifdef(CONFIG_STACK_USAGE -fstack-usage) + +zephyr_compile_options(-nostdinc) +zephyr_system_include_directories(${NOSTDINC}) + +# Force an error when things like SYS_INIT(foo, ...) occur with a missing header. +zephyr_cc_option(-Werror=implicit-int) + +# Prohibit date/time macros, which would make the build non-deterministic +# cc-option(-Werror=date-time) + +# TODO: Archiver arguments +# ar_option(D) + +if(IS_TEST) + add_subdirectory(cmake/test) +endif() + +set_ifndef(LINKERFLAGPREFIX -Wl) +zephyr_ld_options( + ${LINKERFLAGPREFIX},-X + ${LINKERFLAGPREFIX},-N + ${LINKERFLAGPREFIX},--gc-sections + ${LINKERFLAGPREFIX},--build-id=none + ) + +if(CONFIG_HAVE_CUSTOM_LINKER_SCRIPT) + set(LINKER_SCRIPT ${APPLICATION_SOURCE_DIR}/${CONFIG_CUSTOM_LINKER_SCRIPT}) + if(NOT EXISTS LINKER_SCRIPT) + set(LINKER_SCRIPT ${CONFIG_CUSTOM_LINKER_SCRIPT}) + if(NOT EXISTS LINKER_SCRIPT) + message(FATAL_ERROR "CONFIG_HAVE_CUSTOM_LINKER_SCRIPT was set, but no linker script was found at '${CONFIG_CUSTOM_LINKER_SCRIPT}'") + endif() + endif() +else() + # Try a board specific linker file + set(LINKER_SCRIPT ${BOARD_DIR}/linker.ld) + if(NOT EXISTS ${LINKER_SCRIPT}) + # If not available, try an SoC specific linker file + set(LINKER_SCRIPT $ENV{ZEPHYR_BASE}/arch/${ARCH}/soc/${SOC_PATH}/linker.ld) + endif() +endif() + +if(NOT EXISTS ${LINKER_SCRIPT}) + message(FATAL_ERROR "Could not find linker script: '${LINKER_SCRIPT}'. Corrupted configuration?") +endif() + +configure_file(version.h.in ${PROJECT_BINARY_DIR}/include/generated/version.h) + +add_subdirectory(lib) +add_subdirectory(misc) +# We use include instead of add_subdirectory to avoid creating a new directory scope. +# This is because source file properties are directory scoped, including the GENERATED +# property which is set implicitly for custom command outputs +include(misc/generated/CMakeLists.txt) +add_subdirectory(boards) +add_subdirectory(ext) +add_subdirectory(subsys) +add_subdirectory(arch) +add_subdirectory(drivers) +add_subdirectory(tests) + +# Generate offsets.c.obj from offsets.c +# Generate offsets.h from offsets.c.obj + +set(OFFSETS_C_PATH $ENV{ZEPHYR_BASE}/arch/${ARCH}/core/offsets/offsets.c) +set(OFFSETS_O_PATH ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/offsets.dir/arch/${ARCH}/core/offsets/offsets.c.obj) +set(OFFSETS_H_PATH ${PROJECT_BINARY_DIR}/include/generated/offsets.h) + +add_library(offsets STATIC ${OFFSETS_C_PATH}) +target_link_libraries(offsets zephyr_interface) + +add_custom_command( + OUTPUT ${OFFSETS_H_PATH} + COMMAND ${PYTHON_EXECUTABLE} $ENV{ZEPHYR_BASE}/scripts/gen_offset_header.py + -i ${OFFSETS_O_PATH} + -o ${OFFSETS_H_PATH} + DEPENDS offsets +) +add_custom_target(offsets_h DEPENDS ${OFFSETS_H_PATH}) + +zephyr_include_directories(${TOOLCHAIN_INCLUDES}) + +zephyr_get_include_directories(ZEPHYR_INCLUDES) + +add_subdirectory(kernel) + +# Read list content +get_property(ZEPHYR_LIBS_PROPERTY GLOBAL PROPERTY ZEPHYR_LIBS) + +foreach(zephyr_lib ${ZEPHYR_LIBS_PROPERTY}) + # TODO: Could this become an INTERFACE property of zephyr_interface? + add_dependencies(${zephyr_lib} offsets_h) +endforeach() + +get_property(OUTPUT_FORMAT GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT) + +# Run the pre-processor on the linker script +# +# Deal with the un-preprocessed linker scripts differently with +# different generators. +if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") + # Note that the IMPLICIT_DEPENDS option is currently supported only + # for Makefile generators and will be ignored by other generators. + set(LINKER_SCRIPT_DEP IMPLICIT_DEPENDS C ${LINKER_SCRIPT}) +elseif(CMAKE_GENERATOR STREQUAL "Ninja") + # Using DEPFILE with other generators than Ninja is an error. + set(LINKER_SCRIPT_DEP DEPFILE ${PROJECT_BINARY_DIR}/linker.cmd.dep) +else() + # TODO: How would the linker script dependencies work for non-linker + # script generators. + message(STATUS "Warning; this generator is not well supported. The + Linker script may not be regenerated when it should.") + set(LINKER_SCRIPT_DEP "") +endif() + +get_property(LINKER_SCRIPT_DEFINES GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES) + +if(CONFIG_APPLICATION_MEMORY) + # Objects default to being in kernel space, and then we exclude + # certain items. + set(kernel_object_file_list + ${ZEPHYR_LIBS_PROPERTY} + kernel + ) + list( + REMOVE_ITEM + kernel_object_file_list + app + ) + + # The zephyr libraries in zephyr/lib/ and zephyr/test/ belong in + # userspace. + + # NB: The business logic for determing what source files are in + # kernel space and what source files are in user space is + # fragile. Fix ASAP. + # + # The intended design is that certain directories are designated as + # containing userspace code and others for kernel space code. The + # implementation we have however is not working on directories of + # code, it is working on zephyr libraries. It is exploiting the fact + # that zephyr libraries follow a naming scheme as described in + # extensions.cmake:zephyr_library_get_current_dir_lib_name + # + # But code from test/ and lib/ that is placed in the "zephyr" + # library (with zephyr_sources()) will not be in a library that is + # prefixed with lib__ or test__ and will end up in the wrong address + # space. + set(application_space_dirs + lib + tests + ) + foreach(f ${kernel_object_file_list}) + foreach(app_dir ${application_space_dirs}) + if(${f} MATCHES "^${app_dir}__") # Begins with ${app_dir}__, e.g. lib__libc + list( + REMOVE_ITEM + kernel_object_file_list + ${f} + ) + endif() + endforeach() + endforeach() + + # Create a list ks, with relative paths to kernel space libs. + foreach(f ${kernel_object_file_list}) + get_target_property(target_name ${f} NAME) + get_target_property(target_binary_dir ${f} BINARY_DIR) + + string(REPLACE + ${PROJECT_BINARY_DIR} + "" + fixed_path + ${target_binary_dir} + ) + + # Append / if not empty + if(fixed_path) + set(fixed_path "${fixed_path}/") + endif() + + # Cut off leading / if present + if(fixed_path MATCHES "^/.+") + string(SUBSTRING ${fixed_path} 1 -1 fixed_path) + endif() + + list(APPEND ks "${fixed_path}lib${target_name}.a") + endforeach() + + # We are done constructing kernel_object_file_list, now we inject this + # information into the linker script through -D's + list(LENGTH kernel_object_file_list NUM_KERNEL_OBJECT_FILES) + list(APPEND LINKER_SCRIPT_DEFINES -DNUM_KERNEL_OBJECT_FILES=${NUM_KERNEL_OBJECT_FILES}) + set(i 0) + foreach(f ${ks}) + list(APPEND LINKER_SCRIPT_DEFINES -DKERNEL_OBJECT_FILE_${i}=${f}) + math(EXPR i "${i}+1") + endforeach() +endif() # CONFIG_APPLICATION_MEMORY + +get_filename_component(BASE_NAME ${CMAKE_CURRENT_BINARY_DIR} NAME) +add_custom_command( + OUTPUT linker.cmd + DEPENDS ${LINKER_SCRIPT} + ${LINKER_SCRIPT_DEP} + # NB: This COMMAND is copy-pasted to generate linker_pass2.cmd + # TODO: Remove duplication + COMMAND ${CMAKE_C_COMPILER} + -x assembler-with-cpp + -nostdinc + -undef + -MD -MF linker.cmd.dep -MT ${BASE_NAME}/linker.cmd + ${ZEPHYR_INCLUDES} + ${LINKER_SCRIPT_DEFINES} + -E ${LINKER_SCRIPT} -P + -o linker.cmd + VERBATIM + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} +) +add_custom_target( + linker_script + DEPENDS + linker.cmd + offsets_h +) + +set(zephyr_lnk + ${LINKERFLAGPREFIX},-Map=${PROJECT_BINARY_DIR}/${KERNEL_MAP_NAME} + -u_OffsetAbsSyms + -u_ConfigAbsSyms + -e__start + ${LINKERFLAGPREFIX},--start-group + ${LINKERFLAGPREFIX},--whole-archive + ${ZEPHYR_LIBS_PROPERTY} + ${LINKERFLAGPREFIX},--no-whole-archive + kernel + ${OFFSETS_O_PATH} + ${LINKERFLAGPREFIX},--end-group + ${LIB_INCLUDE_DIR} + -L${PROJECT_BINARY_DIR} + ${TOOLCHAIN_LIBS} + ) + +if(CONFIG_GEN_ISR_TABLES) + # isr_tables.c is generated from zephyr_prebuilt by + # gen_isr_tables.py + add_custom_command( + OUTPUT isr_tables.c + COMMAND ${CMAKE_OBJCOPY} + -I ${OUTPUT_FORMAT} + -O binary + --only-section=.intList + $ + isrList.bin + COMMAND ${PYTHON_EXECUTABLE} + $ENV{ZEPHYR_BASE}/arch/common/gen_isr_tables.py + --output-source isr_tables.c + --intlist isrList.bin + --debug + --sw-isr-table + --vector-table + DEPENDS zephyr_prebuilt + ) + set_property(GLOBAL APPEND PROPERTY GENERATED_KERNEL_SOURCE_FILES isr_tables.c) +endif() + +if(CONFIG_USERSPACE) + set(GEN_KOBJ_LIST $ENV{ZEPHYR_BASE}/scripts/gen_kobject_list.py) + set(PROCESS_GPERF $ENV{ZEPHYR_BASE}/scripts/process_gperf.py) + + set(OBJ_LIST kobject_hash.gperf) + set(OUTPUT_SRC_PRE kobject_hash_preprocessed.c) + set(OUTPUT_SRC kobject_hash.c) + set(OUTPUT_OBJ kobject_hash.c.obj) + set(OUTPUT_OBJ_RENAMED kobject_hash_renamed.o) + + # Essentially what we are doing here is extracting some information + # out of the nearly finished elf file, generating the source code + # for a hash table based on that information, and then compiling and + # linking the hash table back into a now even more nearly finished + # elf file. + + # Use the script GEN_KOBJ_LIST to scan the kernel binary's + # (zephyr_prebuilt) DWARF information to produce a table of kernel + # objects (OBJ_LIST) which we will then pass to gperf + add_custom_command( + OUTPUT ${OBJ_LIST} + COMMAND + ${PYTHON_EXECUTABLE} + ${GEN_KOBJ_LIST} + --kernel $ + --output ${OBJ_LIST} + $<$:--verbose> + DEPENDS zephyr_prebuilt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target(obj_list DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OBJ_LIST}) + + # Use gperf to generate C code (OUTPUT_SRC_PRE) which implements a + # perfect hashtable based on OBJ_LIST + add_custom_command( + OUTPUT ${OUTPUT_SRC_PRE} + COMMAND + ${GPERF} + --output-file ${OUTPUT_SRC_PRE} + ${OBJ_LIST} + DEPENDS obj_list + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target(output_src_pre DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SRC_PRE}) + + # For our purposes the code/data generated by gperf is not optimal. + # + # The script PROCESS_GPERF creates a new c file OUTPUT_SRC based on + # OUTPUT_SRC_PRE to greatly reduce the amount of code/data generated + # since we know we are always working with pointer values + add_custom_command( + OUTPUT ${OUTPUT_SRC} + COMMAND + ${PROCESS_GPERF} + -i ${OUTPUT_SRC_PRE} + -o ${OUTPUT_SRC} + $<$:--verbose> + DEPENDS output_src_pre + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target(output_src DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SRC}) + + # We need precise control of where generated text/data ends up in the final + # kernel image. Disable function/data sections and use objcopy to move + # generated data into special section names + add_library(output_lib STATIC + ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_SRC} + ) + + target_link_libraries(output_lib zephyr_interface) + + # Turn off -ffunction-sections, etc. + # NB: Using a library instead of target_compile_options(output_lib + # [...]) because a library's options have precedence + add_library(output_lib_interface INTERFACE) + target_compile_options(output_lib_interface INTERFACE + -fno-function-sections + -fno-data-sections + ) + target_link_libraries(output_lib output_lib_interface) + + set(OUTPUT_OBJ_PATH ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/output_lib.dir/${OUTPUT_OBJ}) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_OBJ_RENAMED} + COMMAND + ${CMAKE_OBJCOPY} + --rename-section .data=.kobject_data.data + --rename-section .text=.kobject_data.text + --rename-section .rodata=.kobject_data.rodata + ${OUTPUT_OBJ_PATH} + ${OUTPUT_OBJ_RENAMED} + DEPENDS output_lib + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target(output_obj_renamed DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_OBJ_RENAMED}) + + add_library(output_obj_renamed_lib STATIC IMPORTED GLOBAL) + set_property( + TARGET output_obj_renamed_lib + PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_OBJ_RENAMED} + ) + add_dependencies( + output_obj_renamed_lib + output_obj_renamed + ) + + set_property(GLOBAL APPEND PROPERTY GENERATED_KERNEL_OBJECT_FILES output_obj_renamed_lib) +endif() + +# Read global variables into local variables +get_property(GKOF GLOBAL PROPERTY GENERATED_KERNEL_OBJECT_FILES) +get_property(GKSF GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES) + +# FIXME: Is there any way to get rid of empty_file.c? +add_executable( zephyr_prebuilt misc/empty_file.c) +target_link_libraries(zephyr_prebuilt -T${PROJECT_BINARY_DIR}/linker.cmd ${zephyr_lnk}) +set_property(TARGET zephyr_prebuilt PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker.cmd) +add_dependencies( zephyr_prebuilt linker_script offsets) + +if(GKOF OR GKSF) + set(logical_target_for_zephyr_elf kernel_elf) + + # The second linker pass uses the same source linker script of the + # first pass (LINKER_SCRIPT), but this time preprocessed with the + # define LINKER_PASS2. + add_custom_command( + OUTPUT linker_pass2.cmd + DEPENDS ${LINKER_SCRIPT} + ${LINKER_SCRIPT_DEP} + COMMAND ${CMAKE_C_COMPILER} + -x assembler-with-cpp + -nostdinc + -undef + -MD -MF linker_pass2.cmd.dep -MT ${BASE_NAME}/linker_pass2.cmd + ${ZEPHYR_INCLUDES} + ${LINKER_SCRIPT_DEFINES} + -DLINKER_PASS2 + -E ${LINKER_SCRIPT} -P + -o linker_pass2.cmd + VERBATIM + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + add_custom_target( + linker_pass2_script + DEPENDS + linker_pass2.cmd + offsets_h + ) + + add_executable( kernel_elf misc/empty_file.c ${GKSF}) + target_link_libraries(kernel_elf ${GKOF} -T${PROJECT_BINARY_DIR}/linker_pass2.cmd ${zephyr_lnk}) + set_property(TARGET kernel_elf PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker_pass2.cmd) + add_dependencies( kernel_elf linker_pass2_script) +else() + set(logical_target_for_zephyr_elf zephyr_prebuilt) + # Use the prebuilt elf as the final elf since we don't have a + # generation stage. +endif() + +# To avoid having the same logical target name for the zephyr lib and +# the zephyr elf, we set the kernel_elf file name to zephyr.elf. +set_target_properties(${logical_target_for_zephyr_elf} PROPERTIES OUTPUT_NAME ${KERNEL_NAME}) + +add_custom_command( + TARGET ${logical_target_for_zephyr_elf} + POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} $ENV{ZEPHYR_BASE}/scripts/check_link_map.py ${KERNEL_MAP_NAME} + COMMAND ${CMAKE_OBJCOPY} -S -Oihex -R .comment -R COMMON -R .eh_frame ${KERNEL_ELF_NAME} ${KERNEL_HEX_NAME} + COMMAND ${CMAKE_OBJCOPY} -S -Obinary -R .comment -R COMMON -R .eh_frame ${KERNEL_ELF_NAME} ${KERNEL_BIN_NAME} + COMMAND ${CMAKE_OBJCOPY} --srec-len 1 --output-target=srec ${KERNEL_ELF_NAME} ${KERNEL_S19_NAME} + COMMAND ${CMAKE_OBJDUMP} -S ${KERNEL_ELF_NAME} > ${KERNEL_LST_NAME} + COMMAND ${CMAKE_READELF} -e ${KERNEL_ELF_NAME} > ${KERNEL_STAT_NAME} + COMMAND ${CMAKE_STRIP} --strip-all ${KERNEL_ELF_NAME} -o ${KERNEL_STRIP_NAME} + COMMENT "Generating zephyr.{hex,bin,lst,strip,stat,s19} from zephyr.elf for board: ${BOARD}" + # NB: COMMENT only works for some CMake-Generators +) + +add_subdirectory(cmake/qemu) +add_subdirectory(cmake/flash) + +add_subdirectory(cmake/usage) +add_subdirectory(cmake/reports) + +include(cmake/ccache.cmake) + +if(CONFIG_ASSERT) + message(WARNING " + ------------------------------------------------------------ + --- WARNING: __ASSERT() statements are globally ENABLED --- + --- The kernel will run more slowly and uses more memory --- + ------------------------------------------------------------" +) +endif() + +if(CONFIG_BOARD_DEPRECATED) + message(WARNING " + WARNING: The board '${BOARD}' is deprecated and will be + removed in version ${CONFIG_BOARD_DEPRECATED}" +) +endif() diff --git a/arch/CMakeLists.txt b/arch/CMakeLists.txt new file mode 100644 index 0000000000..00e3e0035b --- /dev/null +++ b/arch/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(common) +add_subdirectory(${ARCH}) diff --git a/arch/arc/CMakeLists.txt b/arch/arc/CMakeLists.txt new file mode 100644 index 0000000000..6edd56adfd --- /dev/null +++ b/arch/arc/CMakeLists.txt @@ -0,0 +1,14 @@ +# Enable debug support in mdb +# Dwarf version 2 can be recognized by mdb +# The default dwarf version in gdb is not recognized by mdb +zephyr_cc_option(-g3 -gdwarf-2) + +# Without this (poorly named) option, compiler may generate undefined +# references to abort(). +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63691 +zephyr_cc_option(-fno-delete-null-pointer-checks) + +zephyr_cc_option_ifdef (CONFIG_LTO -flto) + +add_subdirectory(soc/${SOC_PATH}) +add_subdirectory(core) diff --git a/arch/arc/core/CMakeLists.txt b/arch/arc/core/CMakeLists.txt new file mode 100644 index 0000000000..73beb87580 --- /dev/null +++ b/arch/arc/core/CMakeLists.txt @@ -0,0 +1,23 @@ +zephyr_sources( + thread.c + thread_entry_wrapper.S + cpu_idle.S + fast_irq.S + fatal.c + fault.c + fault_s.S + irq_manage.c + cache.c + timestamp.c + isr_wrapper.S + regular_irq.S + swap.S + sys_fatal_error_handler.c + prep_c.c + reset.S + vector_table.c + ) + +zephyr_sources_if_kconfig(irq_offload.c) +zephyr_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_CUSTOM atomic.c) +add_subdirectory_ifdef(CONFIG_CPU_HAS_MPU mpu) diff --git a/arch/arc/core/mpu/CMakeLists.txt b/arch/arc/core/mpu/CMakeLists.txt new file mode 100644 index 0000000000..1bc394ffa2 --- /dev/null +++ b/arch/arc/core/mpu/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_if_kconfig(arc_core_mpu.c) +zephyr_sources_if_kconfig(arc_mpu.c) diff --git a/arch/arc/soc/em11d/CMakeLists.txt b/arch/arc/soc/em11d/CMakeLists.txt new file mode 100644 index 0000000000..5216d580b6 --- /dev/null +++ b/arch/arc/soc/em11d/CMakeLists.txt @@ -0,0 +1,14 @@ +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_cc_option(-mcpu=em4_fpuda -mno-sdata -mdiv-rem -mswap -mnorm) +zephyr_cc_option(-mmpy-option=6 -mbarrel-shifter) +zephyr_cc_option(--param l1-cache-size=16384) +zephyr_cc_option(--param l1-cache-line-size=32) +zephyr_cc_option_ifdef(CONFIG_CODE_DENSITY -mcode-density) +zephyr_cc_option_ifdef(CONFIG_FLOAT -mfpu=fpuda_all) + + +zephyr_sources( + soc.c + soc_config.c + ) diff --git a/arch/arc/soc/em7d/CMakeLists.txt b/arch/arc/soc/em7d/CMakeLists.txt new file mode 100644 index 0000000000..1f62a6d48c --- /dev/null +++ b/arch/arc/soc/em7d/CMakeLists.txt @@ -0,0 +1,21 @@ +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_cc_option(-mcpu=-mcpu=em4_dmips -mno-sdata) +zephyr_cc_option(-mdiv-rem -mswap -mnorm) +zephyr_cc_option(-mmpy-option=6 -mbarrel-shifter) +zephyr_cc_option(--param l1-cache-size=16384) +zephyr_cc_option(--param l1-cache-line-size=32) + +zephyr_cc_option_ifdef(CONFIG_CODE_DENSITY -mcode-density) + +if(CONFIG_BOARD_EM_STARTERKIT_R23) + message(FATAL "em7d from em starterkit 2.3 is not supported") +endif() + + +zephyr_sources( + soc.c + soc_config.c + ) + +zephyr_source_ifdef(CONFIG_ARC_MPU_ENABLE arc_mpu_regions.c) diff --git a/arch/arc/soc/em9d/CMakeLists.txt b/arch/arc/soc/em9d/CMakeLists.txt new file mode 100644 index 0000000000..a3fd64f722 --- /dev/null +++ b/arch/arc/soc/em9d/CMakeLists.txt @@ -0,0 +1,14 @@ +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_cc_option(-mcpu=em4_fpus -mno-sdata -mdiv-rem -mswap -mnorm) +zephyr_cc_option(-mdiv-rem -mswap -mnorm) +zephyr_cc_option(-mmpy-option=6 -mbarrel-shifter) + +zephyr_cc_option_ifdef(CONFIG_CODE_DENSITY -mcode-density) +zephyr_cc_option_ifdef(CONFIG_FLOAT -mfpu=fpuda_all) + + +zephyr_sources( + soc.c + soc_config.c + ) diff --git a/arch/arc/soc/quark_se_c1000_ss/CMakeLists.txt b/arch/arc/soc/quark_se_c1000_ss/CMakeLists.txt new file mode 100644 index 0000000000..6513fa1207 --- /dev/null +++ b/arch/arc/soc/quark_se_c1000_ss/CMakeLists.txt @@ -0,0 +1,17 @@ +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) +zephyr_include_directories(${PROJECT_SOURCE_DIR}/arch/x86/soc/intel_quark) + +zephyr_cc_option(-mcpu=quarkse_em -mno-sdata) + +zephyr_compile_definitions_ifdef( + CONFIG_SOC_QUARK_SE_C1000_SS + QM_SENSOR=1 + SOC_SERIES=quark_se + ) + +zephyr_sources( + soc.c + soc_config.c + power.c + soc_power.S + ) diff --git a/arch/arm/CMakeLists.txt b/arch/arm/CMakeLists.txt new file mode 100644 index 0000000000..9ac491542a --- /dev/null +++ b/arch/arm/CMakeLists.txt @@ -0,0 +1,21 @@ +zephyr_cc_option_ifdef(CONFIG_LTO -flto) + +set(ARCH_FOR_cortex-m0 armv6-m ) +set(ARCH_FOR_cortex-m0plus armv6-m ) +set(ARCH_FOR_cortex-m3 armv7-m ) +set(ARCH_FOR_cortex-m4 armv7e-m ) +set(ARCH_FOR_cortex-m23 armv8-m.base) +set(ARCH_FOR_cortex-m33 armv8-m.main) + +if(${ARCH_FOR_${GCC_M_CPU}}) + set(ARCH_FLAG -march=${ARCH_FOR_${GCC_M_CPU}}) +endif() + +zephyr_compile_options( + -mabi=aapcs + ${TOOLCHAIN_C_FLAGS} + ${ARCH_FLAG} + ) + +add_subdirectory(soc) +add_subdirectory(core) diff --git a/arch/arm/core/CMakeLists.txt b/arch/arm/core/CMakeLists.txt new file mode 100644 index 0000000000..ae73f2b4d0 --- /dev/null +++ b/arch/arm/core/CMakeLists.txt @@ -0,0 +1,20 @@ +zephyr_sources( + exc_exit.S + irq_init.c + swap.S + fault.c + irq_manage.c + thread.c + cpu_idle.S + fault_s.S + fatal.c + sys_fatal_error_handler.c + thread_abort.c +) + +zephyr_sources_ifdef(CONFIG_GEN_SW_ISR_TABLE isr_wrapper.S) +zephyr_sources_ifdef(CONFIG_CPLUSPLUS __aeabi_atexit.c) +zephyr_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c) + +add_subdirectory_ifdef(CONFIG_CPU_CORTEX_M cortex_m) +add_subdirectory_ifdef(CONFIG_CPU_HAS_MPU cortex_m/mpu) diff --git a/arch/arm/core/cortex_m/CMakeLists.txt b/arch/arm/core/cortex_m/CMakeLists.txt new file mode 100644 index 0000000000..6a14d26b6b --- /dev/null +++ b/arch/arm/core/cortex_m/CMakeLists.txt @@ -0,0 +1,9 @@ +zephyr_sources( + vector_table.S + reset.S + nmi_on_reset.S + prep_c.c + scb.c + nmi.c + exc_manage.c + ) diff --git a/arch/arm/core/cortex_m/mpu/CMakeLists.txt b/arch/arm/core/cortex_m/mpu/CMakeLists.txt new file mode 100644 index 0000000000..3a7d2d1719 --- /dev/null +++ b/arch/arm/core/cortex_m/mpu/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources_ifdef(CONFIG_ARM_CORE_MPU arm_core_mpu.c) +zephyr_sources_if_kconfig( arm_mpu.c) +zephyr_sources_if_kconfig( nxp_mpu.c) diff --git a/arch/arm/soc/CMakeLists.txt b/arch/arm/soc/CMakeLists.txt new file mode 100644 index 0000000000..52e85a562c --- /dev/null +++ b/arch/arm/soc/CMakeLists.txt @@ -0,0 +1,6 @@ +if(SOC_FAMILY) + add_subdirectory(${SOC_FAMILY}) +else() + add_subdirectory(${SOC_NAME}) +endif() + diff --git a/arch/arm/soc/arm/CMakeLists.txt b/arch/arm/soc/arm/CMakeLists.txt new file mode 100644 index 0000000000..ac7ce7faba --- /dev/null +++ b/arch/arm/soc/arm/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(${SOC_SERIES}) diff --git a/arch/arm/soc/arm/beetle/CMakeLists.txt b/arch/arm/soc/arm/beetle/CMakeLists.txt new file mode 100644 index 0000000000..f4544967ce --- /dev/null +++ b/arch/arm/soc/arm/beetle/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_sources( + soc.c + power.c + ) +zephyr_sources_ifdef(CONFIG_ARM_MPU_ENABLE arm_mpu_regions.c) diff --git a/arch/arm/soc/arm/mps2/CMakeLists.txt b/arch/arm/soc/arm/mps2/CMakeLists.txt new file mode 100644 index 0000000000..b304980e28 --- /dev/null +++ b/arch/arm/soc/arm/mps2/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources( + soc.c + ) diff --git a/arch/arm/soc/atmel_sam/CMakeLists.txt b/arch/arm/soc/atmel_sam/CMakeLists.txt new file mode 100644 index 0000000000..d02e74e706 --- /dev/null +++ b/arch/arm/soc/atmel_sam/CMakeLists.txt @@ -0,0 +1,8 @@ +# Makefile - Atmel SAM MCU family +# +# Copyright (c) 2016 Piotr Mienkowski +# SPDX-License-Identifier: Apache-2.0 +# + +add_subdirectory(${SOC_SERIES}) +add_subdirectory_ifdef(CONFIG_ASF common) diff --git a/arch/arm/soc/atmel_sam/common/CMakeLists.txt b/arch/arm/soc/atmel_sam/common/CMakeLists.txt new file mode 100644 index 0000000000..10304cf1fd --- /dev/null +++ b/arch/arm/soc/atmel_sam/common/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories(.) +zephyr_sources( + soc_pmc.c + soc_gpio.c + ) diff --git a/arch/arm/soc/atmel_sam/sam3x/CMakeLists.txt b/arch/arm/soc/atmel_sam/sam3x/CMakeLists.txt new file mode 100644 index 0000000000..b304980e28 --- /dev/null +++ b/arch/arm/soc/atmel_sam/sam3x/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources( + soc.c + ) diff --git a/arch/arm/soc/atmel_sam/sam4s/CMakeLists.txt b/arch/arm/soc/atmel_sam/sam4s/CMakeLists.txt new file mode 100644 index 0000000000..b304980e28 --- /dev/null +++ b/arch/arm/soc/atmel_sam/sam4s/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources( + soc.c + ) diff --git a/arch/arm/soc/atmel_sam/same70/CMakeLists.txt b/arch/arm/soc/atmel_sam/same70/CMakeLists.txt new file mode 100644 index 0000000000..6584adb07b --- /dev/null +++ b/arch/arm/soc/atmel_sam/same70/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources( + soc.c + soc_config.c + ) diff --git a/arch/arm/soc/nordic_nrf5/CMakeLists.txt b/arch/arm/soc/nordic_nrf5/CMakeLists.txt new file mode 100644 index 0000000000..06227a5168 --- /dev/null +++ b/arch/arm/soc/nordic_nrf5/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories( + include +) + +add_subdirectory(${SOC_SERIES}) diff --git a/arch/arm/soc/nordic_nrf5/nrf51/CMakeLists.txt b/arch/arm/soc/nordic_nrf5/nrf51/CMakeLists.txt new file mode 100644 index 0000000000..82548794e6 --- /dev/null +++ b/arch/arm/soc/nordic_nrf5/nrf51/CMakeLists.txt @@ -0,0 +1,9 @@ +zephyr_compile_definitions_ifdef( + CONFIG_SOC_SERIES_NRF51X + NRF51 + NRF51822 + ) + +zephyr_sources( + soc.c + ) diff --git a/arch/arm/soc/nordic_nrf5/nrf52/CMakeLists.txt b/arch/arm/soc/nordic_nrf5/nrf52/CMakeLists.txt new file mode 100644 index 0000000000..807d585b96 --- /dev/null +++ b/arch/arm/soc/nordic_nrf5/nrf52/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52832 NRF52832_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF52840 NRF52840_XXAA) + +zephyr_sources( + mpu_regions.c + power.c + soc.c + ) diff --git a/arch/arm/soc/nxp_kinetis/CMakeLists.txt b/arch/arm/soc/nxp_kinetis/CMakeLists.txt new file mode 100644 index 0000000000..ac7ce7faba --- /dev/null +++ b/arch/arm/soc/nxp_kinetis/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(${SOC_SERIES}) diff --git a/arch/arm/soc/nxp_kinetis/k6x/CMakeLists.txt b/arch/arm/soc/nxp_kinetis/k6x/CMakeLists.txt new file mode 100644 index 0000000000..89f30153f9 --- /dev/null +++ b/arch/arm/soc/nxp_kinetis/k6x/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources( + soc.c + wdog.S + ) +zephyr_sources_ifdef( + CONFIG_HAS_SYSMPU + nxp_mpu_regions.c + ) diff --git a/arch/arm/soc/nxp_kinetis/kl2x/CMakeLists.txt b/arch/arm/soc/nxp_kinetis/kl2x/CMakeLists.txt new file mode 100644 index 0000000000..74945fd994 --- /dev/null +++ b/arch/arm/soc/nxp_kinetis/kl2x/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(soc.c) diff --git a/arch/arm/soc/nxp_kinetis/kwx/CMakeLists.txt b/arch/arm/soc/nxp_kinetis/kwx/CMakeLists.txt new file mode 100644 index 0000000000..59c7a62a49 --- /dev/null +++ b/arch/arm/soc/nxp_kinetis/kwx/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources_ifdef(CONFIG_SOC_MKW24D5 wdog.S soc_kw2xd.c) +zephyr_sources_ifdef(CONFIG_SOC_MKW22D5 wdog.S soc_kw2xd.c) +zephyr_sources_ifdef(CONFIG_SOC_MKW41Z4 soc_kw4xz.c) +zephyr_sources_ifdef(CONFIG_SOC_MKW40Z4 soc_kw4xz.c) diff --git a/arch/arm/soc/silabs_exx32/CMakeLists.txt b/arch/arm/soc/silabs_exx32/CMakeLists.txt new file mode 100644 index 0000000000..8bb88661f3 --- /dev/null +++ b/arch/arm/soc/silabs_exx32/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(${SOC_SERIES}) +add_subdirectory(common) diff --git a/arch/arm/soc/silabs_exx32/common/CMakeLists.txt b/arch/arm/soc/silabs_exx32/common/CMakeLists.txt new file mode 100644 index 0000000000..b8d37db9a1 --- /dev/null +++ b/arch/arm/soc/silabs_exx32/common/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(soc_gpio.c) diff --git a/arch/arm/soc/silabs_exx32/efm32wg/CMakeLists.txt b/arch/arm/soc/silabs_exx32/efm32wg/CMakeLists.txt new file mode 100644 index 0000000000..74945fd994 --- /dev/null +++ b/arch/arm/soc/silabs_exx32/efm32wg/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(soc.c) diff --git a/arch/arm/soc/st_stm32/CMakeLists.txt b/arch/arm/soc/st_stm32/CMakeLists.txt new file mode 100644 index 0000000000..8bb88661f3 --- /dev/null +++ b/arch/arm/soc/st_stm32/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(${SOC_SERIES}) +add_subdirectory(common) diff --git a/arch/arm/soc/st_stm32/common/CMakeLists.txt b/arch/arm/soc/st_stm32/common/CMakeLists.txt new file mode 100644 index 0000000000..7a318dd4e3 --- /dev/null +++ b/arch/arm/soc/st_stm32/common/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_STM32_ARM_MPU_ENABLE arm_mpu_regions.c) diff --git a/arch/arm/soc/st_stm32/stm32f0/CMakeLists.txt b/arch/arm/soc/st_stm32/stm32f0/CMakeLists.txt new file mode 100644 index 0000000000..253ef033f7 --- /dev/null +++ b/arch/arm/soc/st_stm32/stm32f0/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_include_directories($ENV{ZEPHYR_BASE}/drivers) +zephyr_sources(soc.c) +zephyr_sources_ifdef(CONFIG_GPIO soc_gpio.c) diff --git a/arch/arm/soc/st_stm32/stm32f1/CMakeLists.txt b/arch/arm/soc/st_stm32/stm32f1/CMakeLists.txt new file mode 100644 index 0000000000..20ff825a54 --- /dev/null +++ b/arch/arm/soc/st_stm32/stm32f1/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories($ENV{ZEPHYR_BASE}/drivers) +zephyr_sources( + soc.c + ) +zephyr_sources_ifdef(CONFIG_GPIO soc_gpio.c) diff --git a/arch/arm/soc/st_stm32/stm32f3/CMakeLists.txt b/arch/arm/soc/st_stm32/stm32f3/CMakeLists.txt new file mode 100644 index 0000000000..20ff825a54 --- /dev/null +++ b/arch/arm/soc/st_stm32/stm32f3/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories($ENV{ZEPHYR_BASE}/drivers) +zephyr_sources( + soc.c + ) +zephyr_sources_ifdef(CONFIG_GPIO soc_gpio.c) diff --git a/arch/arm/soc/st_stm32/stm32f4/CMakeLists.txt b/arch/arm/soc/st_stm32/stm32f4/CMakeLists.txt new file mode 100644 index 0000000000..20ff825a54 --- /dev/null +++ b/arch/arm/soc/st_stm32/stm32f4/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories($ENV{ZEPHYR_BASE}/drivers) +zephyr_sources( + soc.c + ) +zephyr_sources_ifdef(CONFIG_GPIO soc_gpio.c) diff --git a/arch/arm/soc/st_stm32/stm32l4/CMakeLists.txt b/arch/arm/soc/st_stm32/stm32l4/CMakeLists.txt new file mode 100644 index 0000000000..20ff825a54 --- /dev/null +++ b/arch/arm/soc/st_stm32/stm32l4/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories($ENV{ZEPHYR_BASE}/drivers) +zephyr_sources( + soc.c + ) +zephyr_sources_ifdef(CONFIG_GPIO soc_gpio.c) diff --git a/arch/arm/soc/ti_lm3s6965/CMakeLists.txt b/arch/arm/soc/ti_lm3s6965/CMakeLists.txt new file mode 100644 index 0000000000..6584adb07b --- /dev/null +++ b/arch/arm/soc/ti_lm3s6965/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources( + soc.c + soc_config.c + ) diff --git a/arch/arm/soc/ti_simplelink/CMakeLists.txt b/arch/arm/soc/ti_simplelink/CMakeLists.txt new file mode 100644 index 0000000000..ac7ce7faba --- /dev/null +++ b/arch/arm/soc/ti_simplelink/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(${SOC_SERIES}) diff --git a/arch/arm/soc/ti_simplelink/cc2650/CMakeLists.txt b/arch/arm/soc/ti_simplelink/cc2650/CMakeLists.txt new file mode 100644 index 0000000000..74945fd994 --- /dev/null +++ b/arch/arm/soc/ti_simplelink/cc2650/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(soc.c) diff --git a/arch/arm/soc/ti_simplelink/cc32xx/CMakeLists.txt b/arch/arm/soc/ti_simplelink/cc32xx/CMakeLists.txt new file mode 100644 index 0000000000..74945fd994 --- /dev/null +++ b/arch/arm/soc/ti_simplelink/cc32xx/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(soc.c) diff --git a/arch/arm/soc/ti_simplelink/msp432p4xx/CMakeLists.txt b/arch/arm/soc/ti_simplelink/msp432p4xx/CMakeLists.txt new file mode 100644 index 0000000000..edee2dce39 --- /dev/null +++ b/arch/arm/soc/ti_simplelink/msp432p4xx/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_compile_definitions(-D__MSP432P401R__) +zephyr_sources(soc.c) diff --git a/arch/common/CMakeLists.txt b/arch/common/CMakeLists.txt new file mode 100644 index 0000000000..7ef9d48c50 --- /dev/null +++ b/arch/common/CMakeLists.txt @@ -0,0 +1,13 @@ +# Put functions and data in their own binary sections so that ld can +# garbage collect them +zephyr_cc_option(-ffunction-sections -fdata-sections) + +zephyr_sources_ifdef( + CONFIG_GEN_ISR_TABLES + isr_tables.c + ) + +zephyr_sources_ifdef( + CONFIG_EXECUTION_BENCHMARKING + timing_info_bench.c + ) diff --git a/arch/nios2/CMakeLists.txt b/arch/nios2/CMakeLists.txt new file mode 100644 index 0000000000..adfe40bc6f --- /dev/null +++ b/arch/nios2/CMakeLists.txt @@ -0,0 +1,37 @@ +if(CONFIG_GP_NONE) +set(gpopt none) +elseif(CONFIG_GP_LOCAL) +set(gpopt local) +elseif(CONFIG_GP_GLOBAL) +set(gpopt global) +elseif(CONFIG_GP_ALL_DATA) +set(gpopt data) +endif() + +# Set Global Pointer option based on Kconfig. +zephyr_cc_option(-mgpopt=${gpopt}) + +# TODO Find a way to pull this out of system.h somehow +# instead of having Kconfig for it + +if(CONFIG_HAS_MUL_INSTRUCTION) +zephyr_cc_option(-mhw-mul) +else() +zephyr_cc_option(-mno-hw-mul) +endif() + +if(CONFIG_HAS_MULX_INSTRUCTION) +zephyr_cc_option(-mhw-mulx) +else() +zephyr_cc_option(-mno-hw-mulx) +endif() + +if(CONFIG_HAS_DIV_INSTRUCTION) +zephyr_cc_option(-mhw-div) +else() +zephyr_cc_option(-mno-hw-div) +endif() + + +add_subdirectory(soc/${SOC_PATH}) +add_subdirectory(core) diff --git a/arch/nios2/core/CMakeLists.txt b/arch/nios2/core/CMakeLists.txt new file mode 100644 index 0000000000..602ec398f0 --- /dev/null +++ b/arch/nios2/core/CMakeLists.txt @@ -0,0 +1,14 @@ +zephyr_sources( + thread.c + cpu_idle.c + fatal.c + irq_manage.c + swap.S + prep_c.c + reset.S + cache.c + exception.S + crt0.S + ) + +zephyr_sources_if_kconfig(irq_offload.c) diff --git a/arch/nios2/soc/nios2-qemu/CMakeLists.txt b/arch/nios2/soc/nios2-qemu/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt b/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt new file mode 100644 index 0000000000..92d5edf45a --- /dev/null +++ b/arch/nios2/soc/nios2f-zephyr/CMakeLists.txt @@ -0,0 +1,2 @@ + +set($ENV{NIOS2_CPU_SOF} $ENV{ZEPHYR_BASE}/arch/nios2/soc/nios2f-zephyr/cpu/ghrd_10m50da.sof) diff --git a/arch/riscv32/CMakeLists.txt b/arch/riscv32/CMakeLists.txt new file mode 100644 index 0000000000..7e2566e191 --- /dev/null +++ b/arch/riscv32/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(soc) +add_subdirectory(core) + +set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-littleriscv) diff --git a/arch/riscv32/core/CMakeLists.txt b/arch/riscv32/core/CMakeLists.txt new file mode 100644 index 0000000000..69c8e2693f --- /dev/null +++ b/arch/riscv32/core/CMakeLists.txt @@ -0,0 +1,11 @@ +zephyr_sources( + cpu_idle.c + fatal.c + irq_manage.c + irq_offload.c + isr.S + prep_c.c + reset.S + swap.S + thread.c +) diff --git a/arch/riscv32/soc/CMakeLists.txt b/arch/riscv32/soc/CMakeLists.txt new file mode 100644 index 0000000000..52e85a562c --- /dev/null +++ b/arch/riscv32/soc/CMakeLists.txt @@ -0,0 +1,6 @@ +if(SOC_FAMILY) + add_subdirectory(${SOC_FAMILY}) +else() + add_subdirectory(${SOC_NAME}) +endif() + diff --git a/arch/riscv32/soc/pulpino/CMakeLists.txt b/arch/riscv32/soc/pulpino/CMakeLists.txt new file mode 100644 index 0000000000..0117656adf --- /dev/null +++ b/arch/riscv32/soc/pulpino/CMakeLists.txt @@ -0,0 +1,13 @@ +zephyr_include_directories(.) + +zephyr_compile_options_ifndef( + CONFIG_RISCV_GENERIC_TOOLCHAIN + -march=IMXpulpv2 + ) + +zephyr_sources( + soc_irq.S + vector.S + pulpino_irq.c + pulpino_idle.c + ) diff --git a/arch/riscv32/soc/riscv-privilege/CMakeLists.txt b/arch/riscv32/soc/riscv-privilege/CMakeLists.txt new file mode 100644 index 0000000000..5173eec865 --- /dev/null +++ b/arch/riscv32/soc/riscv-privilege/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(common) +add_subdirectory(${SOC_SERIES}) diff --git a/arch/riscv32/soc/riscv-privilege/common/CMakeLists.txt b/arch/riscv32/soc/riscv-privilege/common/CMakeLists.txt new file mode 100644 index 0000000000..93bdc2345f --- /dev/null +++ b/arch/riscv32/soc/riscv-privilege/common/CMakeLists.txt @@ -0,0 +1,6 @@ +zephyr_include_directories(.) + +zephyr_sources( + soc_irq.S + soc_common_irq.c + ) diff --git a/arch/riscv32/soc/riscv-privilege/fe310/CMakeLists.txt b/arch/riscv32/soc/riscv-privilege/fe310/CMakeLists.txt new file mode 100644 index 0000000000..93df8307fd --- /dev/null +++ b/arch/riscv32/soc/riscv-privilege/fe310/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources( + vector.S + fe310_idle.c + ) diff --git a/arch/riscv32/soc/riscv-privilege/riscv32-qemu/CMakeLists.txt b/arch/riscv32/soc/riscv-privilege/riscv32-qemu/CMakeLists.txt new file mode 100644 index 0000000000..006a607cc8 --- /dev/null +++ b/arch/riscv32/soc/riscv-privilege/riscv32-qemu/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources( + qemu_irq.S + vector.S + ) diff --git a/arch/x86/CMakeLists.txt b/arch/x86/CMakeLists.txt new file mode 100644 index 0000000000..76dff9906b --- /dev/null +++ b/arch/x86/CMakeLists.txt @@ -0,0 +1,203 @@ + +# Find out if we are optimizing for size +get_target_property(zephyr_COMPILE_OPTIONS zephyr_interface INTERFACE_COMPILE_OPTIONS) +if ("-Os" IN_LIST zephyr_COMPILE_OPTIONS) + zephyr_cc_option(-mpreferred-stack-boundary=2) +else() + zephyr_compile_definitions(PERF_OPT) +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + if(CONFIG_X86_IAMCU) + zephyr_cc_option(-Qunused-arguments) + else() + zephyr_cc_option(-mmcu) + endif() + + zephyr_cc_option( + -m32 + -gdwarf-2 + ) +endif() + +zephyr_cc_option_ifdef (CONFIG_LTO -flto) +zephyr_cc_option_ifndef(CONFIG_SSE_FP_MATH -mno-sse) + +if(CMAKE_VERBOSE_MAKEFILE) + set(GENIDT_EXTRA_ARGS --verbose) +else() + set(GENIDT_EXTRA_ARGS "") +endif() + +set(GENIDT ${PROJECT_SOURCE_DIR}/scripts/gen_idt.py) + +define_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH BRIEF_DOCS " " FULL_DOCS " ") +set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "i386") + +set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-i386") + +# Use gen_idt.py and objcopy to generate irq_int_vector_map.o and +# staticIdt.o from the elf file zephyr_prebuilt +set(gen_idt_output_files + ${CMAKE_CURRENT_BINARY_DIR}/irq_int_vector_map.bin + ${CMAKE_CURRENT_BINARY_DIR}/staticIdt.bin + ) +add_custom_target( + gen_idt_output + DEPENDS + ${gen_idt_output_files} + ) +add_custom_command( + OUTPUT irq_int_vector_map.bin staticIdt.bin + COMMAND + ${PYTHON_EXECUTABLE} + ${GENIDT} + --kernel $ + --output-idt staticIdt.bin + --vector-map irq_int_vector_map.bin + ${GENIDT_EXTRA_ARGS} + DEPENDS zephyr_prebuilt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + +add_subdirectory_ifdef(CONFIG_GDB_SERVER debug) +add_subdirectory(soc/${SOC_PATH}) +# Must be last so that debug/ or soc/ can override default exception +# handlers +add_subdirectory(core) + +get_property(OUTPUT_ARCH GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH) +get_property(OUTPUT_FORMAT GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/irq_int_vector_map.o + COMMAND + ${CMAKE_OBJCOPY} + -I binary + -B ${OUTPUT_ARCH} + -O ${OUTPUT_FORMAT} + --rename-section .data=irq_int_vector_map + irq_int_vector_map.bin + irq_int_vector_map.o + DEPENDS gen_idt_output irq_int_vector_map.bin + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/staticIdt.o + COMMAND + ${CMAKE_OBJCOPY} + -I binary + -B ${OUTPUT_ARCH} + -O ${OUTPUT_FORMAT} + --rename-section .data=staticIdt + staticIdt.bin + staticIdt.o + DEPENDS gen_idt_output staticIdt.bin + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + +add_custom_target(irq_int_vector_map_o DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/irq_int_vector_map.o) +add_custom_target(staticIdt_o DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/staticIdt.o) + +add_library(irq_int_vector_map STATIC IMPORTED GLOBAL) +add_library(staticIdt STATIC IMPORTED GLOBAL) + +set_property(TARGET irq_int_vector_map PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/irq_int_vector_map.o) +set_property(TARGET staticIdt PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/staticIdt.o) + +add_dependencies(irq_int_vector_map irq_int_vector_map_o) +add_dependencies(staticIdt staticIdt_o) + +set_property(GLOBAL APPEND PROPERTY GENERATED_KERNEL_OBJECT_FILES irq_int_vector_map) +set_property(GLOBAL APPEND PROPERTY GENERATED_KERNEL_OBJECT_FILES staticIdt) + +if(CONFIG_X86_MMU) + # Use gen_mmu.py and objcopy to generate mmu_tables.o from from the + # elf file zephyr_prebuilt, creating the temp files mmu_tables.bin + # and mmulist.bin along the way. + # + # zephyr_prebuilt.elf -> mmulist.bin -> mmu_tables.bin -> mmu_tables.o + add_custom_command( + OUTPUT mmulist.bin + COMMAND + ${CMAKE_OBJCOPY} + -I ${OUTPUT_FORMAT} + -O binary + -j mmulist + $ + mmulist.bin + DEPENDS zephyr_prebuilt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_command( + OUTPUT mmu_tables.bin + COMMAND + ${PYTHON_EXECUTABLE} + ${PROJECT_SOURCE_DIR}/scripts/gen_mmu_x86.py + -i mmulist.bin + -k $ + -o mmu_tables.bin + $<$:-v> + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS mmulist.bin + DEPENDS zephyr_prebuilt + ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mmu_tables.o + COMMAND + ${CMAKE_OBJCOPY} + -I binary + -B ${OUTPUT_ARCH} + -O ${OUTPUT_FORMAT} + --rename-section .data=.mmu_data + mmu_tables.bin + mmu_tables.o + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS mmu_tables.bin + ) + + add_custom_target( mmu_tables_o DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mmu_tables.o) + add_library( mmu_tables STATIC IMPORTED GLOBAL) + set_property(TARGET mmu_tables PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/mmu_tables.o) + add_dependencies( mmu_tables mmu_tables_o) + set_property(GLOBAL APPEND PROPERTY GENERATED_KERNEL_OBJECT_FILES mmu_tables) +endif() + +if(CONFIG_GDT_DYNAMIC) + # Use gen_gdt.py and objcopy to generate gdt.o from from the elf + # file zephyr_prebuilt, creating the temp file gdt.bin along the + # way. + # + # zephyr_prebuilt.elf -> gdt.bin -> gdt.o + add_custom_command( + OUTPUT gdt.bin + COMMAND + ${PYTHON_EXECUTABLE} + ${PROJECT_SOURCE_DIR}/scripts/gen_gdt.py + --kernel $ + --output-gdt gdt.bin + $<$:--verbose> + DEPENDS zephyr_prebuilt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gdt.o + COMMAND + ${CMAKE_OBJCOPY} + -I binary + -B ${OUTPUT_ARCH} + -O ${OUTPUT_FORMAT} + --rename-section .data=gdt_ram_data + gdt.bin + gdt.o + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS gdt.bin + ) + + add_custom_target( gdt_o DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/gdt.o) + add_library( gdt STATIC IMPORTED GLOBAL) + set_property(TARGET gdt PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/gdt.o) + add_dependencies( gdt gdt_o) + set_property(GLOBAL APPEND PROPERTY GENERATED_KERNEL_OBJECT_FILES gdt) +endif() diff --git a/arch/x86/core/CMakeLists.txt b/arch/x86/core/CMakeLists.txt new file mode 100644 index 0000000000..e2a0d6725a --- /dev/null +++ b/arch/x86/core/CMakeLists.txt @@ -0,0 +1,31 @@ +if (COMPILER STREQUAL "clang") + # We rely on GAS for assembling, so don't use the integrated assembler + zephyr_compile_options_ifndef(CONFIG_X86_IAMCU $<$:-no-integrated-as>) +endif() + +zephyr_compile_options($<$:-Wa,--divide>) + +add_subdirectory_ifdef(CONFIG_DEBUG_INFO debug) + +zephyr_sources( + cache.c + cache_s.S + cpuhalt.c + crt0.S + excstub.S + intstub.S + irq_manage.c + msr.c + swap.S + sys_fatal_error_handler.c + thread.c + ) + +zephyr_sources_if_kconfig( irq_offload.c) +zephyr_sources_if_kconfig( x86_mmu.c) +zephyr_sources_if_kconfig( reboot_rst_cnt.c) +zephyr_sources_ifdef(CONFIG_FP_SHARING float.c) +zephyr_sources_ifdef(CONFIG_X86_USERSPACE userspace.S) + +# Last since we declare default exception handlers here +zephyr_sources(fatal.c) diff --git a/arch/x86/soc/atom/CMakeLists.txt b/arch/x86/soc/atom/CMakeLists.txt new file mode 100644 index 0000000000..0196d2127d --- /dev/null +++ b/arch/x86/soc/atom/CMakeLists.txt @@ -0,0 +1,7 @@ +zephyr_library() +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_cc_option(-march=atom) +zephyr_cc_option_fallback(-mtune=atom -mtune=generic) + +zephyr_library_sources(soc.c) diff --git a/arch/x86/soc/ia32/CMakeLists.txt b/arch/x86/soc/ia32/CMakeLists.txt new file mode 100644 index 0000000000..16223a6626 --- /dev/null +++ b/arch/x86/soc/ia32/CMakeLists.txt @@ -0,0 +1,13 @@ +zephyr_library() +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_cc_option(-march=pentium) + +if(CONFIG_X86_IAMCU) + set_property(GLOBAL APPEND PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__IAMCU) + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-iamcu") + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "iamcu:intel") + zephyr_cc_option(-msoft-float) +endif() + +zephyr_library_sources(soc.c) diff --git a/arch/x86/soc/intel_quark/quark_d2000/CMakeLists.txt b/arch/x86/soc/intel_quark/quark_d2000/CMakeLists.txt new file mode 100644 index 0000000000..a03dbd7de0 --- /dev/null +++ b/arch/x86/soc/intel_quark/quark_d2000/CMakeLists.txt @@ -0,0 +1,15 @@ +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_compile_definitions_ifdef( + CONFIG_SOC_QUARK_D2000 + QM_LAKEMONT + SOC_SERIES=quark_d2000 + ) + +zephyr_cc_option(-march=lakemont -mtune=lakemont -msoft-float) + +if(CONFIG_X86_IAMCU) + set_property(GLOBAL APPEND PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__IAMCU) + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-iamcu") + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "iamcu:intel") +endif() diff --git a/arch/x86/soc/intel_quark/quark_se/CMakeLists.txt b/arch/x86/soc/intel_quark/quark_se/CMakeLists.txt new file mode 100644 index 0000000000..161560fd02 --- /dev/null +++ b/arch/x86/soc/intel_quark/quark_se/CMakeLists.txt @@ -0,0 +1,23 @@ +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_compile_definitions_ifdef( + CONFIG_SOC_QUARK_SE_C1000 + QM_LAKEMONT + SOC_SERIES=quark_se + ) + +zephyr_cc_option(-march=lakemont -mtune=lakemont -msoft-float) + +if(CONFIG_X86_IAMCU) + set_property(GLOBAL APPEND PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__IAMCU) + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-iamcu") + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "iamcu:intel") +endif() + +zephyr_sources( + soc.c + soc_config.c + eoi.c + power.c + soc_power.S + ) diff --git a/arch/x86/soc/intel_quark/quark_x1000/CMakeLists.txt b/arch/x86/soc/intel_quark/quark_x1000/CMakeLists.txt new file mode 100644 index 0000000000..9fd4ebc227 --- /dev/null +++ b/arch/x86/soc/intel_quark/quark_x1000/CMakeLists.txt @@ -0,0 +1,6 @@ + +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + +zephyr_cc_option(-march=lakemont -mtune=lakemont -msoft-float) + +zephyr_sources(soc.c) diff --git a/arch/xtensa/CMakeLists.txt b/arch/xtensa/CMakeLists.txt new file mode 100644 index 0000000000..f697a7f5fb --- /dev/null +++ b/arch/xtensa/CMakeLists.txt @@ -0,0 +1,10 @@ +set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-xtensa-le) + + +if(SOC_FAMILY) + add_subdirectory(soc/${SOC_FAMILY}) +else() + add_subdirectory(soc/${SOC_PATH}) +endif() + +add_subdirectory(core) diff --git a/arch/xtensa/core/CMakeLists.txt b/arch/xtensa/core/CMakeLists.txt new file mode 100644 index 0000000000..ae93638c5d --- /dev/null +++ b/arch/xtensa/core/CMakeLists.txt @@ -0,0 +1,22 @@ +zephyr_cc_option(-mlongcalls) +zephyr_sources( + cpu_idle.c + fatal.c + irq_manage.c + swap.S + thread.c + xtensa_context.S + xtensa_intr_asm.S + xtensa_intr.c + xtensa_vectors.S + xt_zephyr.S + ) + +zephyr_sources_ifndef(CONFIG_ATOMIC_OPERATIONS_C atomic.S) +zephyr_sources_ifdef(CONFIG_XTENSA_USE_CORE_CRT1 + crt1.S +) +zephyr_sources_ifdef(CONFIG_IRQ_OFFLOAD + irq_offload.c +) +add_subdirectory(startup) diff --git a/arch/xtensa/core/startup/CMakeLists.txt b/arch/xtensa/core/startup/CMakeLists.txt new file mode 100644 index 0000000000..1af54e29e8 --- /dev/null +++ b/arch/xtensa/core/startup/CMakeLists.txt @@ -0,0 +1,13 @@ +if(CONFIG_XTENSA_RESET_VECTOR) + zephyr_library() + + zephyr_library_cc_option( + -c + -mtext-section-literals + -mlongcalls + ) + + zephyr_library_sources( + reset-vector.S + ) +endif() diff --git a/arch/xtensa/soc/esp32/CMakeLists.txt b/arch/xtensa/soc/esp32/CMakeLists.txt new file mode 100644 index 0000000000..b304980e28 --- /dev/null +++ b/arch/xtensa/soc/esp32/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources( + soc.c + ) diff --git a/arch/xtensa/soc/sample_controller/CMakeLists.txt b/arch/xtensa/soc/sample_controller/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/boards/CMakeLists.txt b/boards/CMakeLists.txt new file mode 100644 index 0000000000..9ef002020e --- /dev/null +++ b/boards/CMakeLists.txt @@ -0,0 +1,6 @@ +# To avoid a lot of empty CMakeLists.txt files we assume it is not an +# error if it is missing + +if(EXISTS ${BOARD_DIR}/CMakeLists.txt) + add_subdirectory(${BOARD_DIR}) +endif() diff --git a/boards/arc/arduino_101_sss/board.cmake b/boards/arc/arduino_101_sss/board.cmake new file mode 100644 index 0000000000..7fef7efca3 --- /dev/null +++ b/boards/arc/arduino_101_sss/board.cmake @@ -0,0 +1,20 @@ +if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU}) + set(FLASH_SCRIPT dfuutil.sh) + + set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + DFUUTIL_PID=8087:0aba + DFUUTIL_ALT=sensor_core + DFUUTIL_IMG=${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} + ) +else() + set(FLASH_SCRIPT openocd.sh) +endif() + +set(DEBUG_SCRIPT openocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + OPENOCD_LOAD_CMD="load_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + GDB_PORT=3334 + ) diff --git a/boards/arc/em_starterkit/board.cmake b/boards/arc/em_starterkit/board.cmake new file mode 100644 index 0000000000..80ba313bf5 --- /dev/null +++ b/boards/arc/em_starterkit/board.cmake @@ -0,0 +1,7 @@ +set(FLASH_SCRIPT arc_debugger.sh) +set(DEBUG_SCRIPT arc_debugger.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_LOAD_CMD="load_image ${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + ) diff --git a/boards/arc/panther_ss/board.cmake b/boards/arc/panther_ss/board.cmake new file mode 100644 index 0000000000..7f666d0d82 --- /dev/null +++ b/boards/arc/panther_ss/board.cmake @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + ) diff --git a/boards/arc/quark_se_c1000_ss_devboard/board.cmake b/boards/arc/quark_se_c1000_ss_devboard/board.cmake new file mode 100644 index 0000000000..7f666d0d82 --- /dev/null +++ b/boards/arc/quark_se_c1000_ss_devboard/board.cmake @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + ) diff --git a/boards/arm/96b_carbon/CMakeLists.txt b/boards/arm/96b_carbon/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/96b_carbon/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/96b_carbon/board.cmake b/boards/arm/96b_carbon/board.cmake new file mode 100644 index 0000000000..eab31f5a5a --- /dev/null +++ b/boards/arm/96b_carbon/board.cmake @@ -0,0 +1,8 @@ +set(FLASH_SCRIPT dfuutil.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + DFUUTIL_PID=0483:df11 + DFUUTIL_ALT=0 + DFUUTIL_IMG=${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} + DFUUTIL_DFUSE_ADDR=${CONFIG_FLASH_BASE_ADDRESS} + ) diff --git a/boards/arm/96b_neonkey/CMakeLists.txt b/boards/arm/96b_neonkey/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/96b_neonkey/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/96b_nitrogen/board.cmake b/boards/arm/96b_nitrogen/board.cmake new file mode 100644 index 0000000000..fe75c9af20 --- /dev/null +++ b/boards/arm/96b_nitrogen/board.cmake @@ -0,0 +1,6 @@ +set(FLASH_SCRIPT pyocd.sh) +set(DEBUG_SCRIPT pyocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + PYOCD_TARGET=nrf52 + ) diff --git a/boards/arm/arduino_101_ble/board.cmake b/boards/arm/arduino_101_ble/board.cmake new file mode 100644 index 0000000000..07894d8384 --- /dev/null +++ b/boards/arm/arduino_101_ble/board.cmake @@ -0,0 +1,9 @@ +if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU}) + set(FLASH_SCRIPT dfuutil.sh) + + set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + DFUUTIL_PID=8087:0aba + DFUUTIL_ALT=ble_core + DFUUTIL_IMG=${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} + ) +endif() diff --git a/boards/arm/arduino_due/CMakeLists.txt b/boards/arm/arduino_due/CMakeLists.txt new file mode 100644 index 0000000000..fe9a1dad51 --- /dev/null +++ b/boards/arm/arduino_due/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) +zephyr_library_sources_if_kconfig(pinmux.c) diff --git a/boards/arm/arduino_due/board.cmake b/boards/arm/arduino_due/board.cmake new file mode 100644 index 0000000000..8e4fb33ab1 --- /dev/null +++ b/boards/arm/arduino_due/board.cmake @@ -0,0 +1 @@ +set(FLASH_SCRIPT bossa-flash.sh) diff --git a/boards/arm/bbc_microbit/board.cmake b/boards/arm/bbc_microbit/board.cmake new file mode 100644 index 0000000000..279acb7edf --- /dev/null +++ b/boards/arm/bbc_microbit/board.cmake @@ -0,0 +1,6 @@ +set(FLASH_SCRIPT pyocd.sh) +set(DEBUG_SCRIPT pyocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + PYOCD_TARGET=nrf51 + ) diff --git a/boards/arm/cc2650_sensortag/CMakeLists.txt b/boards/arm/cc2650_sensortag/CMakeLists.txt new file mode 100644 index 0000000000..298e24d979 --- /dev/null +++ b/boards/arm/cc2650_sensortag/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_if_kconfig(pinmux.c) diff --git a/boards/arm/cc3220sf_launchxl/CMakeLists.txt b/boards/arm/cc3220sf_launchxl/CMakeLists.txt new file mode 100644 index 0000000000..ffcdb421ce --- /dev/null +++ b/boards/arm/cc3220sf_launchxl/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources( + pinmux.c + dbghdr.c + ) diff --git a/boards/arm/disco_l475_iot1/CMakeLists.txt b/boards/arm/disco_l475_iot1/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/disco_l475_iot1/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/disco_l475_iot1/board.cmake b/boards/arm/disco_l475_iot1/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/disco_l475_iot1/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/efm32wg_stk3800/CMakeLists.txt b/boards/arm/efm32wg_stk3800/CMakeLists.txt new file mode 100644 index 0000000000..0c35d352f4 --- /dev/null +++ b/boards/arm/efm32wg_stk3800/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_UART_GECKO) + zephyr_library() + zephyr_library_sources(board.c) + zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) +endif() diff --git a/boards/arm/frdm_k64f/CMakeLists.txt b/boards/arm/frdm_k64f/CMakeLists.txt new file mode 100644 index 0000000000..ab95e02903 --- /dev/null +++ b/boards/arm/frdm_k64f/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_PINMUX_MCUX) + zephyr_library() + zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + zephyr_library_sources(pinmux.c) +endif() diff --git a/boards/arm/frdm_k64f/board.cmake b/boards/arm/frdm_k64f/board.cmake new file mode 100644 index 0000000000..e41565a8e6 --- /dev/null +++ b/boards/arm/frdm_k64f/board.cmake @@ -0,0 +1,15 @@ +set_ifndef(OPENSDA_FW daplink) + +if(OPENSDA_FW STREQUAL jlink) + set_ifndef(DEBUG_SCRIPT jlink.sh) +elseif(OPENSDA_FW STREQUAL daplink) + set_ifndef(DEBUG_SCRIPT pyocd.sh) + set_ifndef(FLASH_SCRIPT pyocd.sh) +endif() + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + JLINK_DEVICE=MK64FN1M0xxx12 + PYOCD_TARGET=k64f + OPENOCD_LOAD_CMD="flash write_image erase ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + ) diff --git a/boards/arm/frdm_kl25z/CMakeLists.txt b/boards/arm/frdm_kl25z/CMakeLists.txt new file mode 100644 index 0000000000..ab95e02903 --- /dev/null +++ b/boards/arm/frdm_kl25z/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_PINMUX_MCUX) + zephyr_library() + zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + zephyr_library_sources(pinmux.c) +endif() diff --git a/boards/arm/frdm_kl25z/board.cmake b/boards/arm/frdm_kl25z/board.cmake new file mode 100644 index 0000000000..a61ec3e534 --- /dev/null +++ b/boards/arm/frdm_kl25z/board.cmake @@ -0,0 +1,13 @@ +set_ifndef(OPENSDA_FW daplink) + +if(OPENSDA_FW STREQUAL jlink) + set_ifndef(DEBUG_SCRIPT jlink.sh) +elseif(OPENSDA_FW STREQUAL daplink) + set_ifndef(DEBUG_SCRIPT pyocd.sh) + set_ifndef(FLASH_SCRIPT pyocd.sh) +endif() + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + JLINK_DEVICE=MKL25Z128xxx4 + PYOCD_TARGET=kl25z + ) diff --git a/boards/arm/frdm_kw41z/CMakeLists.txt b/boards/arm/frdm_kw41z/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/frdm_kw41z/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/frdm_kw41z/board.cmake b/boards/arm/frdm_kw41z/board.cmake new file mode 100644 index 0000000000..85157cf603 --- /dev/null +++ b/boards/arm/frdm_kw41z/board.cmake @@ -0,0 +1,13 @@ +set_ifndef(OPENSDA_FW jlink) + +if(OPENSDA_FW STREQUAL jlink) + set_ifndef(DEBUG_SCRIPT jlink.sh) +elseif(OPENSDA_FW STREQUAL daplink) + set_ifndef(DEBUG_SCRIPT pyocd.sh) + set_ifndef(FLASH_SCRIPT pyocd.sh) +endif() + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + JLINK_DEVICE=MKW41Z512xxx4 + PYOCD_TARGET=kw41z4 + ) diff --git a/boards/arm/hexiwear_k64/CMakeLists.txt b/boards/arm/hexiwear_k64/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/hexiwear_k64/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/hexiwear_k64/board.cmake b/boards/arm/hexiwear_k64/board.cmake new file mode 100644 index 0000000000..c046393dbb --- /dev/null +++ b/boards/arm/hexiwear_k64/board.cmake @@ -0,0 +1,13 @@ +set_ifndef(OPENSDA_FW daplink) + +if(OPENSDA_FW STREQUAL jlink) + set_ifndef(DEBUG_SCRIPT jlink.sh) +elseif(OPENSDA_FW STREQUAL daplink) + set_ifndef(DEBUG_SCRIPT pyocd.sh) + set_ifndef(FLASH_SCRIPT pyocd.sh) +endif() + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + JLINK_DEVICE=MK64FN1M0xxx12 + PYOCD_TARGET=k64f + ) diff --git a/boards/arm/hexiwear_kw40z/CMakeLists.txt b/boards/arm/hexiwear_kw40z/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/hexiwear_kw40z/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/hexiwear_kw40z/board.cmake b/boards/arm/hexiwear_kw40z/board.cmake new file mode 100644 index 0000000000..61fd837a1b --- /dev/null +++ b/boards/arm/hexiwear_kw40z/board.cmake @@ -0,0 +1,13 @@ +set_ifndef(OPENSDA_FW jlink) + +if(OPENSDA_FW STREQUAL jlink) + set_ifndef(DEBUG_SCRIPT jlink.sh) +elseif(OPENSDA_FW STREQUAL daplink) + set_ifndef(DEBUG_SCRIPT pyocd.sh) + set_ifndef(FLASH_SCRIPT pyocd.sh) +endif() + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + JLINK_DEVICE=MKW40Z160xxx4 + PYOCD_TARGET=kw40z4 + ) diff --git a/boards/arm/mps2_an385/CMakeLists.txt b/boards/arm/mps2_an385/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/mps2_an385/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nrf51_pca10028/board.cmake b/boards/arm/nrf51_pca10028/board.cmake new file mode 100644 index 0000000000..b8ab373a0c --- /dev/null +++ b/boards/arm/nrf51_pca10028/board.cmake @@ -0,0 +1,4 @@ +set(FLASH_SCRIPT nrf_flash.sh) +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + NRF_FAMILY=NRF51 + ) diff --git a/boards/arm/nrf51_vbluno51/board.cmake b/boards/arm/nrf51_vbluno51/board.cmake new file mode 100644 index 0000000000..279acb7edf --- /dev/null +++ b/boards/arm/nrf51_vbluno51/board.cmake @@ -0,0 +1,6 @@ +set(FLASH_SCRIPT pyocd.sh) +set(DEBUG_SCRIPT pyocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + PYOCD_TARGET=nrf51 + ) diff --git a/boards/arm/nrf52_blenano2/board.cmake b/boards/arm/nrf52_blenano2/board.cmake new file mode 100644 index 0000000000..fe75c9af20 --- /dev/null +++ b/boards/arm/nrf52_blenano2/board.cmake @@ -0,0 +1,6 @@ +set(FLASH_SCRIPT pyocd.sh) +set(DEBUG_SCRIPT pyocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + PYOCD_TARGET=nrf52 + ) diff --git a/boards/arm/nrf52_pca10040/board.cmake b/boards/arm/nrf52_pca10040/board.cmake new file mode 100644 index 0000000000..fc3f1bc503 --- /dev/null +++ b/boards/arm/nrf52_pca10040/board.cmake @@ -0,0 +1,4 @@ +set(FLASH_SCRIPT nrf_flash.sh) +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + NRF_FAMILY=NRF52 + ) diff --git a/boards/arm/nrf52_vbluno52/board.cmake b/boards/arm/nrf52_vbluno52/board.cmake new file mode 100644 index 0000000000..fe75c9af20 --- /dev/null +++ b/boards/arm/nrf52_vbluno52/board.cmake @@ -0,0 +1,6 @@ +set(FLASH_SCRIPT pyocd.sh) +set(DEBUG_SCRIPT pyocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + PYOCD_TARGET=nrf52 + ) diff --git a/boards/arm/nucleo_f030r8/CMakeLists.txt b/boards/arm/nucleo_f030r8/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f030r8/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_f030r8/board.cmake b/boards/arm/nucleo_f030r8/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/nucleo_f030r8/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/nucleo_f103rb/CMakeLists.txt b/boards/arm/nucleo_f103rb/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f103rb/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_f103rb/board.cmake b/boards/arm/nucleo_f103rb/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/nucleo_f103rb/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/nucleo_f334r8/CMakeLists.txt b/boards/arm/nucleo_f334r8/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f334r8/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_f334r8/board.cmake b/boards/arm/nucleo_f334r8/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/nucleo_f334r8/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/nucleo_f401re/CMakeLists.txt b/boards/arm/nucleo_f401re/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f401re/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_f401re/board.cmake b/boards/arm/nucleo_f401re/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/nucleo_f401re/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/nucleo_f411re/CMakeLists.txt b/boards/arm/nucleo_f411re/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f411re/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_f411re/board.cmake b/boards/arm/nucleo_f411re/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/nucleo_f411re/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/nucleo_f412zg/CMakeLists.txt b/boards/arm/nucleo_f412zg/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f412zg/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_f413zh/CMakeLists.txt b/boards/arm/nucleo_f413zh/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_f413zh/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_l432kc/CMakeLists.txt b/boards/arm/nucleo_l432kc/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_l432kc/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/nucleo_l476rg/CMakeLists.txt b/boards/arm/nucleo_l476rg/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/nucleo_l476rg/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/olimex_stm32_e407/CMakeLists.txt b/boards/arm/olimex_stm32_e407/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/olimex_stm32_e407/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/olimex_stm32_e407/board.cmake b/boards/arm/olimex_stm32_e407/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/olimex_stm32_e407/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/olimex_stm32_p405/CMakeLists.txt b/boards/arm/olimex_stm32_p405/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/olimex_stm32_p405/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/olimex_stm32_p405/board.cmake b/boards/arm/olimex_stm32_p405/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/olimex_stm32_p405/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/olimexino_stm32/CMakeLists.txt b/boards/arm/olimexino_stm32/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/olimexino_stm32/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/olimexino_stm32/board.cmake b/boards/arm/olimexino_stm32/board.cmake new file mode 100644 index 0000000000..9dbf0734ec --- /dev/null +++ b/boards/arm/olimexino_stm32/board.cmake @@ -0,0 +1,9 @@ +set(FLASH_SCRIPT openocd.sh) +set(DEBUG_SCRIPT openocd.sh) + +set(FLASH_BASE_ADDRESS 0x08000000) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_LOAD_CMD="flash write_image erase ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${FLASH_BASE_ADDRESS}" + ) diff --git a/boards/arm/qemu_cortex_m3/board.cmake b/boards/arm/qemu_cortex_m3/board.cmake new file mode 100644 index 0000000000..2f7f02372d --- /dev/null +++ b/boards/arm/qemu_cortex_m3/board.cmake @@ -0,0 +1,11 @@ +set(EMU_PLATFORM qemu) + +set(QEMU_CPU_TYPE_${ARCH} cortex-m3) +set(QEMU_FLAGS_${ARCH} + -cpu ${QEMU_CPU_TYPE_${ARCH}} + -machine lm3s6965evb + -nographic + -vga none + ) + +set(DEBUG_SCRIPT qemu.sh) diff --git a/boards/arm/sam_e70_xplained/board.cmake b/boards/arm/sam_e70_xplained/board.cmake new file mode 100644 index 0000000000..a399eab77e --- /dev/null +++ b/boards/arm/sam_e70_xplained/board.cmake @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_POST_CMD="atsamv gpnvm set 1" + ) diff --git a/boards/arm/stm3210c_eval/CMakeLists.txt b/boards/arm/stm3210c_eval/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm3210c_eval/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm3210c_eval/board.cmake b/boards/arm/stm3210c_eval/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm3210c_eval/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32373c_eval/CMakeLists.txt b/boards/arm/stm32373c_eval/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32373c_eval/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32373c_eval/board.cmake b/boards/arm/stm32373c_eval/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32373c_eval/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32_min_dev/CMakeLists.txt b/boards/arm/stm32_min_dev/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32_min_dev/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32_min_dev/board.cmake b/boards/arm/stm32_min_dev/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32_min_dev/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32_mini_a15/CMakeLists.txt b/boards/arm/stm32_mini_a15/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32_mini_a15/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f3_disco/CMakeLists.txt b/boards/arm/stm32f3_disco/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32f3_disco/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f3_disco/board.cmake b/boards/arm/stm32f3_disco/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32f3_disco/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32f411e_disco/CMakeLists.txt b/boards/arm/stm32f411e_disco/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32f411e_disco/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f411e_disco/board.cmake b/boards/arm/stm32f411e_disco/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32f411e_disco/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32f412g_disco/CMakeLists.txt b/boards/arm/stm32f412g_disco/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32f412g_disco/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f412g_disco/board.cmake b/boards/arm/stm32f412g_disco/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32f412g_disco/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32f429i_disc1/CMakeLists.txt b/boards/arm/stm32f429i_disc1/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32f429i_disc1/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f429i_disc1/board.cmake b/boards/arm/stm32f429i_disc1/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32f429i_disc1/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32f469i_disco/CMakeLists.txt b/boards/arm/stm32f469i_disco/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32f469i_disco/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f469i_disco/board.cmake b/boards/arm/stm32f469i_disco/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32f469i_disco/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32f4_disco/CMakeLists.txt b/boards/arm/stm32f4_disco/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32f4_disco/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/stm32f4_disco/board.cmake b/boards/arm/stm32f4_disco/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/arm/stm32f4_disco/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/arm/stm32l496g_disco/CMakeLists.txt b/boards/arm/stm32l496g_disco/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/arm/stm32l496g_disco/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/arm/usb_kw24d512/CMakeLists.txt b/boards/arm/usb_kw24d512/CMakeLists.txt new file mode 100644 index 0000000000..fbcbbd5484 --- /dev/null +++ b/boards/arm/usb_kw24d512/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_PINMUX_MCUX) + zephyr_library() + zephyr_library_sources(pinmux.c) + zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) +endif() diff --git a/boards/arm/usb_kw24d512/board.cmake b/boards/arm/usb_kw24d512/board.cmake new file mode 100644 index 0000000000..edf4ce1735 --- /dev/null +++ b/boards/arm/usb_kw24d512/board.cmake @@ -0,0 +1,5 @@ +set(DEBUG_SCRIPT jlink.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + JLINK_DEVICE=MKW24D512xxx5 + ) diff --git a/boards/arm/v2m_beetle/CMakeLists.txt b/boards/arm/v2m_beetle/CMakeLists.txt new file mode 100644 index 0000000000..3fe0127162 --- /dev/null +++ b/boards/arm/v2m_beetle/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_PINMUX_BEETLE) + zephyr_library() + zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) + zephyr_library_sources(pinmux.c) +endif() diff --git a/boards/arm/v2m_beetle/board.cmake b/boards/arm/v2m_beetle/board.cmake new file mode 100644 index 0000000000..ca2c812f80 --- /dev/null +++ b/boards/arm/v2m_beetle/board.cmake @@ -0,0 +1 @@ +set(DEBUG_SCRIPT openocd.sh) diff --git a/boards/common/openocd.board.cmake b/boards/common/openocd.board.cmake new file mode 100644 index 0000000000..65821e1d93 --- /dev/null +++ b/boards/common/openocd.board.cmake @@ -0,0 +1,7 @@ +set(FLASH_SCRIPT openocd.sh) +set(DEBUG_SCRIPT openocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_LOAD_CMD="flash write_image erase ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + ) diff --git a/boards/nios2/altera_max10/board.cmake b/boards/nios2/altera_max10/board.cmake new file mode 100644 index 0000000000..ba1aef2513 --- /dev/null +++ b/boards/nios2/altera_max10/board.cmake @@ -0,0 +1,2 @@ +set(FLASH_SCRIPT nios2.sh) +set(DEBUG_SCRIPT nios2.sh) diff --git a/boards/nios2/qemu_nios2/board.cmake b/boards/nios2/qemu_nios2/board.cmake new file mode 100644 index 0000000000..904d679630 --- /dev/null +++ b/boards/nios2/qemu_nios2/board.cmake @@ -0,0 +1,10 @@ +set(EMU_PLATFORM qemu) + +set(QEMU_CPU_TYPE_${ARCH} nios2) + +set(QEMU_FLAGS_${ARCH} + -machine altera_10m50_zephyr + -nographic + ) + +set(DEBUG_SCRIPT qemu.sh) diff --git a/boards/riscv32/qemu_riscv32/board.cmake b/boards/riscv32/qemu_riscv32/board.cmake new file mode 100644 index 0000000000..ab1d27c1b4 --- /dev/null +++ b/boards/riscv32/qemu_riscv32/board.cmake @@ -0,0 +1,11 @@ +set(EMU_PLATFORM qemu) + +set(QEMU_CPU_TYPE_${ARCH} riscv32) + +set(QEMU_FLAGS_${ARCH} + -m ${CONFIG_RISCV_RAM_SIZE_MB} + -nographic + -machine sifive + ) + +set(DEBUG_SCRIPT qemu.sh) diff --git a/boards/x86/arduino_101/CMakeLists.txt b/boards/x86/arduino_101/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/x86/arduino_101/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/x86/arduino_101/board.cmake b/boards/x86/arduino_101/board.cmake new file mode 100644 index 0000000000..86728264fe --- /dev/null +++ b/boards/x86/arduino_101/board.cmake @@ -0,0 +1,19 @@ +if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU}) + set(FLASH_SCRIPT dfuutil.sh) + + set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + DFUUTIL_PID=8087:0aba + DFUUTIL_ALT=x86_app + DFUUTIL_IMG=${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} + ) +else() + set(FLASH_SCRIPT openocd.sh) +endif() + +set(DEBUG_SCRIPT openocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + OPENOCD_LOAD_CMD="load_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + ) diff --git a/boards/x86/galileo/CMakeLists.txt b/boards/x86/galileo/CMakeLists.txt new file mode 100644 index 0000000000..81b9ca7035 --- /dev/null +++ b/boards/x86/galileo/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_PINMUX) + zephyr_library() + zephyr_library_sources(pinmux.c) + zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) +endif() diff --git a/boards/x86/panther/CMakeLists.txt b/boards/x86/panther/CMakeLists.txt new file mode 100644 index 0000000000..922f4b1685 --- /dev/null +++ b/boards/x86/panther/CMakeLists.txt @@ -0,0 +1,6 @@ +zephyr_library() +zephyr_library_sources( + pinmux.c + board.c + ) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/x86/panther/board.cmake b/boards/x86/panther/board.cmake new file mode 100644 index 0000000000..2c2e671d0c --- /dev/null +++ b/boards/x86/panther/board.cmake @@ -0,0 +1,8 @@ +set(FLASH_SCRIPT openocd.sh) +set(DEBUG_SCRIPT openocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + OPENOCD_LOAD_CMD="load_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_PHYS_LOAD_ADDR}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_PHYS_LOAD_ADDR}" + ) diff --git a/boards/x86/qemu_x86/board.cmake b/boards/x86/qemu_x86/board.cmake new file mode 100644 index 0000000000..cce924f5ef --- /dev/null +++ b/boards/x86/qemu_x86/board.cmake @@ -0,0 +1,28 @@ +set(EMU_PLATFORM qemu) + +if(NOT CONFIG_REBOOT) + set(REBOOT_FLAG -no-reboot) +endif() + +set(QEMU_CPU_TYPE_${ARCH} qemu32,+nx,+pae) +set(QEMU_FLAGS_${ARCH} + -m 8 + -cpu ${QEMU_CPU_TYPE_${ARCH}} + -device isa-debug-exit,iobase=0xf4,iosize=0x04 + ${REBOOT_FLAG} + -nographic + -vga none + -display none + -net none + -clock dynticks + -no-acpi + -balloon none + -L ${QEMU_BIOS} + -bios bios.bin + -machine type=pc-0.14 + ) + +# TODO: Support debug +# set(DEBUG_SCRIPT qemu.sh) +# debugserver: QEMU_EXTRA_FLAGS += -s -S +# debugserver: qemu diff --git a/boards/x86/quark_d2000_crb/CMakeLists.txt b/boards/x86/quark_d2000_crb/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/x86/quark_d2000_crb/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/x86/quark_d2000_crb/board.cmake b/boards/x86/quark_d2000_crb/board.cmake new file mode 100644 index 0000000000..2b06911ef7 --- /dev/null +++ b/boards/x86/quark_d2000_crb/board.cmake @@ -0,0 +1 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/x86/quark_se_c1000_devboard/CMakeLists.txt b/boards/x86/quark_se_c1000_devboard/CMakeLists.txt new file mode 100644 index 0000000000..04f398df84 --- /dev/null +++ b/boards/x86/quark_se_c1000_devboard/CMakeLists.txt @@ -0,0 +1,6 @@ +zephyr_library() +zephyr_library_sources( + pinmux.c + board.c + ) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/x86/quark_se_c1000_devboard/board.cmake b/boards/x86/quark_se_c1000_devboard/board.cmake new file mode 100644 index 0000000000..7f666d0d82 --- /dev/null +++ b/boards/x86/quark_se_c1000_devboard/board.cmake @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/boards/common/openocd.board.cmake) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + ) diff --git a/boards/x86/tinytile/CMakeLists.txt b/boards/x86/tinytile/CMakeLists.txt new file mode 100644 index 0000000000..a700f3c235 --- /dev/null +++ b/boards/x86/tinytile/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_library() +zephyr_library_sources(pinmux.c) +zephyr_library_include_directories(${PROJECT_SOURCE_DIR}/drivers) diff --git a/boards/x86/tinytile/board.cmake b/boards/x86/tinytile/board.cmake new file mode 100644 index 0000000000..86728264fe --- /dev/null +++ b/boards/x86/tinytile/board.cmake @@ -0,0 +1,19 @@ +if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU}) + set(FLASH_SCRIPT dfuutil.sh) + + set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + DFUUTIL_PID=8087:0aba + DFUUTIL_ALT=x86_app + DFUUTIL_IMG=${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} + ) +else() + set(FLASH_SCRIPT openocd.sh) +endif() + +set(DEBUG_SCRIPT openocd.sh) + +set_property(GLOBAL APPEND PROPERTY FLASH_SCRIPT_ENV_VARS + OPENOCD_PRE_CMD="targets 1" + OPENOCD_LOAD_CMD="load_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + OPENOCD_VERIFY_CMD="verify_image ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}" + ) diff --git a/boards/x86/x86_jailhouse/board.cmake b/boards/x86/x86_jailhouse/board.cmake new file mode 100644 index 0000000000..262ee0f1a2 --- /dev/null +++ b/boards/x86/x86_jailhouse/board.cmake @@ -0,0 +1,30 @@ +set(EMU_PLATFORM qemu) + +if(NOT CONFIG_REBOOT) + set(REBOOT_FLAG -no-reboot) +endif() + +set(QEMU_CPU_TYPE_${ARCH} kvm64,-kvm_pv_eoi,-kvm_steal_time,-kvm_asyncpf,-kvmclock,+vmx,+x2apic,+arat) +set(QEMU_FLAGS_${ARCH} + -machine q35,kernel_irqchip=split + ${REBOOT_FLAG} + -m 1G + -enable-kvm + -smp 4 + -device intel-iommu,intremap=on,x-buggy-eim=on + -cpu ${QEMU_CPU_TYPE_${ARCH}} + -drive file=${JAILHOUSE_QEMU_IMG_FILE},format=qcow2,id=disk,if=none + -device ide-hd,drive=disk + -serial mon:stdio + -serial vc -netdev user,id=net + -device e1000e,addr=2.0,netdev=net + -device intel-hda,addr=1b.0 + -device hda-duplex + -fsdev local,path=./,security_model=passthrough,id=vfs + -device virtio-9p-pci,addr=1f.7,mount_tag=host,fsdev=vfs + ) + +# TODO: Support debug +# set(DEBUG_SCRIPT qemu.sh) +# debugserver: QEMU_EXTRA_FLAGS += -s -S +# debugserver: qemu diff --git a/boards/xtensa/esp32/board.cmake b/boards/xtensa/esp32/board.cmake new file mode 100644 index 0000000000..8ce6887830 --- /dev/null +++ b/boards/xtensa/esp32/board.cmake @@ -0,0 +1 @@ +set(FLASH_SCRIPT esp32.sh) diff --git a/boards/xtensa/qemu_xtensa/board.cmake b/boards/xtensa/qemu_xtensa/board.cmake new file mode 100644 index 0000000000..738b3c1e95 --- /dev/null +++ b/boards/xtensa/qemu_xtensa/board.cmake @@ -0,0 +1,12 @@ +set(EMU_PLATFORM qemu) + +set(QEMU_CPU_TYPE_${ARCH} sample_controller) + +set(QEMU_FLAGS_${ARCH} + -machine sim -semihosting -nographic -cpu sample_controller + ) + +# TODO: Support debug +# set(DEBUG_SCRIPT qemu.sh) +# debugserver: QEMU_EXTRA_FLAGS += -s -S +# debugserver: qemu diff --git a/boards/xtensa/xt-sim/board.cmake b/boards/xtensa/xt-sim/board.cmake new file mode 100644 index 0000000000..4f34b14136 --- /dev/null +++ b/boards/xtensa/xt-sim/board.cmake @@ -0,0 +1 @@ +set(DEBUG_SCRIPT xt-gdb.sh) diff --git a/cmake/app/boilerplate.cmake b/cmake/app/boilerplate.cmake new file mode 100644 index 0000000000..96862354d6 --- /dev/null +++ b/cmake/app/boilerplate.cmake @@ -0,0 +1,281 @@ +# This file must be included into the toplevel CMakeLists.txt file of +# Zephyr applications, e.g. zephyr/samples/hello_world/CMakeLists.txt +# must start with the line: +# +# include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +# +# It exists to reduce boilerplate code that Zephyr expects to be in +# application CMakeLists.txt code. +# +# Omitting it is permitted, but doing so incurs a maintenance cost as +# the application must manage upstream changes to this file. + +# app is a CMake library containing all the application code and is +# modified by the entry point ${APPLICATION_SOURCE_DIR}/CMakeLists.txt +# that was specified when cmake was called. + +# Determine if we are using MSYS. +# +# We don't use project() because it would take some time to rewrite +# the build scripts to be compatible with everything project() does. +execute_process( + COMMAND + uname + OUTPUT_VARIABLE uname_output + ) +if(uname_output MATCHES "MSYS") + set(MSYS 1) +endif() + +# CMake version 3.8.2 is the only supported version. Version 3.9 is +# not supported because it introduced a warning that we do not wish to +# show to users. Specifically, it displays a warning when an OLD +# policy is used, but we need policy CMP0000 set to OLD to avoid +# copy-pasting cmake_minimum_required across application +# CMakeLists.txt files. +# +# An exception to the above is MSYS, MSYS is allowed to use 3.6.0 +# because MSYS does not support 3.8, this will be set back to 3.8 when +# https://github.com/zephyrproject-rtos/zephyr/issues/4687 is +# resolved. +if(MSYS) + cmake_minimum_required(VERSION 3.6.0) +else() + cmake_minimum_required(VERSION 3.8.2) +endif() + +cmake_policy(SET CMP0000 OLD) +cmake_policy(SET CMP0002 NEW) + +set(APPLICATION_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Application Source Directory") +set(APPLICATION_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Application Binary Directory") + +set(__build_dir ${CMAKE_CURRENT_BINARY_DIR}/zephyr) + +set(PROJECT_BINARY_DIR ${__build_dir}) +set(PROJECT_SOURCE_DIR $ENV{ZEPHYR_BASE}) + +set(ZEPHYR_BINARY_DIR ${PROJECT_BINARY_DIR}) +set(ZEPHYR_SOURCE_DIR ${PROJECT_SOURCE_DIR}) + +set(AUTOCONF_H ${__build_dir}/include/generated/autoconf.h) +# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H}) + +include($ENV{ZEPHYR_BASE}/cmake/extensions.cmake) + +find_package(PythonInterp 3.4) + +# Generate syscall_macros.h at configure-time because it has virtually +# no dependencies +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/generated) +execute_process( + COMMAND + ${PYTHON_EXECUTABLE} + $ENV{ZEPHYR_BASE}/scripts/gen_syscall_header.py + OUTPUT_FILE ${ZEPHYR_BINARY_DIR}/include/generated/syscall_macros.h + ) + +if(NOT PREBUILT_HOST_TOOLS) + set(PREBUILT_HOST_TOOLS $ENV{PREBUILT_HOST_TOOLS}) + set(PREBUILT_HOST_TOOLS ${PREBUILT_HOST_TOOLS} CACHE PATH "") + if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + set(PREBUILT_HOST_TOOLS $ENV{ZEPHYR_BASE}/scripts/prebuilt) + endif() +endif() + +if(NOT ZEPHYR_GCC_VARIANT) + set(ZEPHYR_GCC_VARIANT $ENV{ZEPHYR_GCC_VARIANT}) +endif() +set(ZEPHYR_GCC_VARIANT ${ZEPHYR_GCC_VARIANT} CACHE STRING "Zephyr GCC variant") +if(NOT ZEPHYR_GCC_VARIANT) + message(FATAL_ERROR "ZEPHYR_GCC_VARIANT not set") +endif() + +if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) + message(FATAL_ERROR "Source directory equals build directory.\ + In-source builds are not supported.\ + Please specify a build directory, e.g. cmake -Bbuild -H.") +endif() + +add_custom_target( + pristine + COMMAND ${CMAKE_COMMAND} -P $ENV{ZEPHYR_BASE}/cmake/pristine.cmake + # Equivalent to rm -rf build/* + ) + +# The BOARD can be set by 3 sources. Through environment variables, +# through the cmake CLI, and through CMakeLists.txt. +# +# CLI has the highest precedence, then comes environment variables, +# and then finally CMakeLists.txt. +# +# A user can ignore all the precedence rules if he simply always uses +# the same source. E.g. always specifies -DBOARD= on the command line, +# always has an environment variable set, or always has a set(BOARD +# foo) line in his CMakeLists.txt and avoids mixing sources. +# +# The selected BOARD can be accessed through the variable 'BOARD'. + +# Read out the cached board value if present +get_property(cached_board_value CACHE BOARD PROPERTY VALUE) + +# There are actually 4 sources, the three user input sources, and the +# previously used value (CACHED_BOARD). The previously used value has +# precedence, and if we detect that the user is trying to change the +# value we give him a warning about needing to clean the build +# directory to be able to change boards. + +set(board_cli_argument ${cached_board_value}) # Either new or old +if(board_cli_argument STREQUAL CACHED_BOARD) + # We already have a CACHED_BOARD so there is no new input on the CLI + unset(board_cli_argument) +endif() + +set(board_app_cmake_lists ${BOARD}) +if(cached_board_value STREQUAL BOARD) + # The app build scripts did not set a default, The BOARD we are + # reading is the cached value from the CLI + unset(board_app_cmake_lists) +endif() + +if(CACHED_BOARD) + # Warn the user if it looks like he is trying to change the board + # without cleaning first + if(board_cli_argument) + if(NOT (CACHED_BOARD STREQUAL board_cli_argument)) + message(WARNING "The build directory must be cleaned pristinely when changing boards") + # TODO: Support changing boards without requiring a clean build + endif() + endif() + + set(BOARD ${CACHED_BOARD}) +elseif(board_cli_argument) + set(BOARD ${board_cli_argument}) + +elseif(DEFINED ENV{BOARD}) + set(BOARD $ENV{BOARD}) + +elseif(board_app_cmake_lists) + set(BOARD ${board_app_cmake_lists}) + +else() + message(FATAL_ERROR "BOARD is not being defined on the CMake command-line in the environment or by the app.") +endif() + +assert(BOARD "BOARD not set") +message(STATUS "Selected BOARD ${BOARD}") + +# Store the selected board in the cache +set(CACHED_BOARD ${BOARD} CACHE STRING "Selected board") + +# Use BOARD to search zephyr/boards/** for a _defconfig file, +# e.g. zephyr/boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig. When +# found, use that path to infer the ARCH we are building for. +find_path(BOARD_DIR NAMES "${BOARD}_defconfig" PATHS $ENV{ZEPHYR_BASE}/boards/*/* NO_DEFAULT_PATH) +assert(BOARD_DIR "No board named '${BOARD}' found") + +get_filename_component(BOARD_ARCH_DIR ${BOARD_DIR} DIRECTORY) +get_filename_component(ARCH ${BOARD_ARCH_DIR} NAME) +get_filename_component(BOARD_FAMILY ${BOARD_DIR} NAME) + +if(CONF_FILE) + # CONF_FILE has either been specified on the cmake CLI or is already + # in the CMakeCache.txt. This has precedence over the environment + # variable CONF_FILE and the default prj.conf +elseif(DEFINED ENV{CONF_FILE}) + set(CONF_FILE $ENV{CONF_FILE}) + +elseif(COMMAND set_conf_file) + set_conf_file() + +elseif(EXISTS ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf) + set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf) + +elseif(EXISTS ${APPLICATION_SOURCE_DIR}/prj.conf) + set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj.conf) +endif() + +set(CONF_FILE ${CONF_FILE} CACHE STRING "If desired, you can build the application using\ +the configuration settings specified in an alternate .conf file using this parameter. \ +These settings will override the settings in the application’s .config file or its default .conf file.\ +Multiple files may be listed, e.g. CONF_FILE=\"prj1.conf prj2.conf\"") + +# Prevent CMake from testing the toolchain +set(CMAKE_C_COMPILER_FORCED 1) +set(CMAKE_CXX_COMPILER_FORCED 1) + +# Determine if the application is in zephyr/tests, if so it is a test +# and must be built differently +string(REGEX MATCH "^$ENV{ZEPHYR_BASE}/tests" match ${APPLICATION_SOURCE_DIR}) +if(match) + set(IS_TEST 1) +endif() + +include($ENV{ZEPHYR_BASE}/cmake/version.cmake) +include($ENV{ZEPHYR_BASE}/cmake/host-tools.cmake) +include($ENV{ZEPHYR_BASE}/cmake/kconfig.cmake) +include($ENV{ZEPHYR_BASE}/cmake/toolchain.cmake) + +# DTS should be run directly after kconfig because CONFIG_ variables +# from kconfig and dts should be available at the same time. But +# running DTS involves running the preprocessor, so we put it behind +# toolchain. Meaning toolchain.cmake is the only component where +# kconfig and dts variables aren't available at the same time. +include($ENV{ZEPHYR_BASE}/dts/dts.cmake) + +set(KERNEL_NAME ${CONFIG_KERNEL_BIN_NAME}) + +set(KERNEL_ELF_NAME ${KERNEL_NAME}.elf) +set(KERNEL_BIN_NAME ${KERNEL_NAME}.bin) +set(KERNEL_HEX_NAME ${KERNEL_NAME}.hex) +set(KERNEL_MAP_NAME ${KERNEL_NAME}.map) +set(KERNEL_LST_NAME ${KERNEL_NAME}.lst) +set(KERNEL_S19_NAME ${KERNEL_NAME}.s19) +set(KERNEL_STAT_NAME ${KERNEL_NAME}.stat) +set(KERNEL_STRIP_NAME ${KERNEL_NAME}.strip) + +include(${BOARD_DIR}/board.cmake OPTIONAL) + +zephyr_library_named(app) + +execute_process( + COMMAND + ${PYTHON_EXECUTABLE} + $ENV{ZEPHYR_BASE}/scripts/gen_syscalls.py + --include $ENV{ZEPHYR_BASE}/include # Read files from this dir + --base-output include/generated/syscalls # Write to this dir + --syscall-dispatch include/generated/syscall_dispatch.c # Write this file + INPUT_FILE kconfig/include/config/auto.conf # Read this file from stdin + OUTPUT_FILE include/generated/syscall_list.h # Write stdout to this file + WORKING_DIRECTORY ${ZEPHYR_BINARY_DIR} + ) + +add_subdirectory($ENV{ZEPHYR_BASE} ${__build_dir}) + +define_property(GLOBAL PROPERTY ZEPHYR_LIBS + BRIEF_DOCS "Global list of all Zephyr CMake libs that should be linked in" + FULL_DOCS "Global list of all Zephyr CMake libs that should be linked in. zephyr_library() appends libs to this list.") +set_property(GLOBAL PROPERTY ZEPHYR_LIBS "") + +define_property(GLOBAL PROPERTY GENERATED_KERNEL_OBJECT_FILES + BRIEF_DOCS "Object files that are generated after Zephyr has been linked once." + FULL_DOCS "\ +Object files that are generated after Zephyr has been linked once.\ +May include mmu tables, etc." + ) +set_property(GLOBAL PROPERTY GENERATED_KERNEL_OBJECT_FILES "") + +define_property(GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES + BRIEF_DOCS "Source files that are generated after Zephyr has been linked once." + FULL_DOCS "\ +Object files that are generated after Zephyr has been linked once.\ +May include isr_tables.c etc." + ) +set_property(GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES "") + +define_property(GLOBAL PROPERTY FLASH_SCRIPT_ENV_VARS + BRIEF_DOCS "Environment variables that should be passed to FLASH_SCRIPT" + FULL_DOCS "Environment variables that should be passed to FLASH_SCRIPT" + ) +set_property(GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES "") diff --git a/cmake/ccache.cmake b/cmake/ccache.cmake new file mode 100644 index 0000000000..61453b0dbd --- /dev/null +++ b/cmake/ccache.cmake @@ -0,0 +1,11 @@ +# Use ccache if it is installed, unless the user explicitly disables +# it by setting USE_CCACHE=0. + +if(USE_CCACHE STREQUAL "0") +else() + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif() +endif() diff --git a/cmake/extensions.cmake b/cmake/extensions.cmake new file mode 100644 index 0000000000..5499ec0050 --- /dev/null +++ b/cmake/extensions.cmake @@ -0,0 +1,660 @@ +include(CheckCCompilerFlag) + +######################################################## +# Table of contents +######################################################## +# 1. Zephyr-aware extensions +# 1.1. zephyr_* +# 1.2. zephyr_library_* +# 1.3. generate_inc_* +# 2. Kconfig-aware extensions +# 2.1 *_if_kconfig +# 2.2 Misc +# 3. CMake-generic extensions +# 3.1. *_ifdef +# 3.2. *_ifndef +# 3.3. *_option compiler compatibility checks +# 3.4. Debugging CMake + +######################################################## +# 1. Zephyr-aware extensions +######################################################## +# 1.1. zephyr_* +# +# The following methods are for modifying the CMake library[0] called +# "zephyr". zephyr is a catchall CMake library for source files that +# can be built purely with the include paths, defines, and other +# compiler flags that all zephyr source files use. +# [0] https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html +# +# Example usage: +# zephyr_sources( +# random_esp32.c +# utils.c +# ) +# +# Is short for: +# target_sources(zephyr PRIVATE +# ${CMAKE_CURRENT_SOURCE_DIR}/random_esp32.c +# ${CMAKE_CURRENT_SOURCE_DIR}/utils.c +# ) + +# https://cmake.org/cmake/help/latest/command/target_sources.html +function(zephyr_sources) + foreach(arg ${ARGV}) + if(IS_ABSOLUTE ${arg}) + set(path ${arg}) + else() + set(path ${CMAKE_CURRENT_SOURCE_DIR}/${arg}) + endif() + target_sources(zephyr PRIVATE ${path}) + endforeach() +endfunction() + +# https://cmake.org/cmake/help/latest/command/target_include_directories.html +function(zephyr_include_directories) + foreach(arg ${ARGV}) + if(IS_ABSOLUTE ${arg}) + set(path ${arg}) + else() + set(path ${CMAKE_CURRENT_SOURCE_DIR}/${arg}) + endif() + target_include_directories(zephyr_interface INTERFACE ${path}) + endforeach() +endfunction() + +# https://cmake.org/cmake/help/latest/command/target_include_directories.html +function(zephyr_system_include_directories) + foreach(arg ${ARGV}) + if(IS_ABSOLUTE ${arg}) + set(path ${arg}) + else() + set(path ${CMAKE_CURRENT_SOURCE_DIR}/${arg}) + endif() + target_include_directories(zephyr_interface SYSTEM INTERFACE ${path}) + endforeach() +endfunction() + +# https://cmake.org/cmake/help/latest/command/target_compile_definitions.html +function(zephyr_compile_definitions) + target_compile_definitions(zephyr_interface INTERFACE ${ARGV}) +endfunction() + +# https://cmake.org/cmake/help/latest/command/target_compile_options.html +function(zephyr_compile_options) + target_compile_options(zephyr_interface INTERFACE ${ARGV}) +endfunction() + +# https://cmake.org/cmake/help/latest/command/target_link_libraries.html +function(zephyr_link_libraries) + target_link_libraries(zephyr_interface INTERFACE ${ARGV}) +endfunction() + +# See this file section 3.1. target_cc_option +function(zephyr_cc_option) + foreach(arg ${ARGV}) + target_cc_option(zephyr_interface INTERFACE ${arg}) + endforeach() +endfunction() + +function(zephyr_cc_option_fallback option1 option2) + target_cc_option_fallback(zephyr_interface INTERFACE ${option1} ${option2}) +endfunction() + +function(zephyr_ld_options) + target_ld_options(zephyr_interface INTERFACE ${ARGV}) +endfunction() + +# Getter functions for extracting build information from +# zephyr_interface. Returning lists, and strings is supported, as is +# requesting specific categories of build information (defines, +# includes, options). +# +# The naming convention follows: +# zephyr_get_${build_information}${format}(x) +# Where +# the argument 'x' is written with the result +# and +# ${build_information} can be one of +# - include_directories # -I directories +# - system_include_directories # -isystem directories +# - compile_definitions # -D'efines +# - compile_options # misc. compiler flags +# and +# ${format} can be +# the empty string '', signifying that it should be returned as a list +# _as_string signifying that it should be returned as a string +# +# e.g. +# zephyr_get_include_directories(x) +# writes "-Isome_dir;-Isome/other/dir" to x + +# Utility macro used by the below macros. +macro(get_property_and_add_prefix result target property prefix) + get_property(target_property TARGET ${target} PROPERTY ${property}) + foreach(x ${target_property}) + list(APPEND ${result} ${prefix}${x}) + endforeach() +endmacro() + +macro(zephyr_get_include_directories i) + get_property_and_add_prefix(${i} zephyr_interface INTERFACE_INCLUDE_DIRECTORIES -I) +endmacro() + +macro(zephyr_get_system_include_directories i) + get_property_and_add_prefix(${i} zephyr_interface INTERFACE_SYSTEM_INCLUDE_DIRECTORIES -isystem) +endmacro() + +macro(zephyr_get_compile_definitions i) + get_property_and_add_prefix(${i} zephyr_interface INTERFACE_COMPILE_DEFINITIONS -D) +endmacro() + +macro(zephyr_get_compile_options i) + get_property(${i} TARGET zephyr_interface PROPERTY INTERFACE_COMPILE_OPTIONS) +endmacro() + +macro(zephyr_get_include_directories_as_string i) + zephyr_get_include_directories(${i}) + + string(REPLACE ";" " " ${i} ${${i}}) + string(REPLACE "-I" " -I" ${i} ${${i}}) +endmacro() + +macro(zephyr_get_system_include_directories_as_string i) + get_property_and_add_prefix(${i} zephyr_interface INTERFACE_SYSTEM_INCLUDE_DIRECTORIES -isystem) + + string(REPLACE ";" " " ${i} ${${i}}) + string(REPLACE "-isystem" " -isystem" ${i} ${${i}}) +endmacro() + +macro(zephyr_get_compile_definitions_as_string i) + get_property_and_add_prefix(${i} zephyr_interface INTERFACE_COMPILE_DEFINITIONS -D) + + string(REPLACE ";" " " ${i} ${${i}}) + string(REPLACE "-D" " -D" ${i} ${${i}}) +endmacro() + +macro(zephyr_get_compile_options_as_string i) + zephyr_get_compile_options(j) + + foreach(__opt__ ${j}) + if(__opt__ MATCHES " ${generated_file} # Does pipe redirection work on Windows? + DEPENDS ${source_file} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) +endfunction() + +function(generate_inc_file_for_target + target # The cmake target that depends on the generated file + source_file # The source file to be converted to hex + generated_file # The generated file + # Any additional arguments are passed on to file2hex.py + ) + generate_inc_file(${source_file} ${generated_file} ${ARGN}) + + # Ensure 'generated_file' is generated before 'target' by creating a + # 'custom_target' for it and setting up a dependency between the two + # targets + + # But first create a unique name for the custom target + # Replace / with _ (driver/serial => driver_serial) and . with _ + set(generated_target_name ${generated_file}) + + string(REPLACE "/" "_" generated_target_name ${generated_target_name}) + string(REPLACE "." "_" generated_target_name ${generated_target_name}) + + add_custom_target(${generated_target_name} DEPENDS ${generated_file}) + add_dependencies(${target} ${generated_target_name}) +endfunction() + +# 2.1 zephyr_library_* +# +# Zephyr libraries use CMake's library concept and a set of +# assumptions about how zephyr code is organized to cut down on +# boilerplate code. +# +# A Zephyr library can be constructed by the function zephyr_library +# or zephyr_library_named. The constructors create a CMake library +# with a name accessible through the variable ZEPHYR_CURRENT_LIBRARY. +# +# The variable ZEPHYR_CURRENT_LIBRARY should seldomly be needed since +# the zephyr libraries have methods that modify the libraries. These +# methods have the signature: zephyr_library_ +# +# The methods are wrappers around the CMake target_* functions. See +# https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html for +# documentation on the underlying target_* functions. +# +# The methods modify the CMake target_* API to reduce boilerplate; +# PRIVATE is assumed +# The target is assumed to be ZEPHYR_CURRENT_LIBRARY + +# Constructor with a directory-inferred name +macro(zephyr_library) + zephyr_library_get_current_dir_lib_name(lib_name) + zephyr_library_named(${lib_name}) +endmacro() + +# Determines what the current directory's lib name would be and writes +# it to the argument "lib_name" +macro(zephyr_library_get_current_dir_lib_name lib_name) + # Remove the prefix (/home/sebo/zephyr/driver/serial/CMakeLists.txt => driver/serial/CMakeLists.txt) + file(RELATIVE_PATH name $ENV{ZEPHYR_BASE} ${CMAKE_CURRENT_LIST_FILE}) + + # Remove the filename (driver/serial/CMakeLists.txt => driver/serial) + get_filename_component(name ${name} DIRECTORY) + + # Replace / with __ (driver/serial => driver__serial) + string(REGEX REPLACE "/" "__" name ${name}) + + set(${lib_name} ${name}) +endmacro() + +# Constructor with an explicitly given name. +macro(zephyr_library_named name) + # This is a macro because we need add_library() to be executed + # within the scope of the caller. + set(ZEPHYR_CURRENT_LIBRARY ${name}) + add_library(${name} STATIC "") + + zephyr_append_cmake_library(${name}) + + target_link_libraries(${name} zephyr_interface) +endmacro() + + +function(zephyr_link_interface interface) + target_link_libraries(interface INTERFACE zephyr_interface) +endfunction() + +# +# zephyr_library versions of normal CMake target_ functions +# +function(zephyr_library_sources source) + target_sources(${ZEPHYR_CURRENT_LIBRARY} PRIVATE ${source} ${ARGN}) +endfunction() + +function(zephyr_library_include_directories) + target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE ${ARGN}) +endfunction() + +function(zephyr_library_link_libraries item) + target_link_libraries(${ZEPHYR_CURRENT_LIBRARY} ${item} ${ARGN}) +endfunction() + +function(zephyr_library_compile_definitions item) + target_compile_definitions(${ZEPHYR_CURRENT_LIBRARY} PRIVATE ${item} ${ARGN}) +endfunction() + +function(zephyr_library_compile_options item) + target_compile_options(${ZEPHYR_CURRENT_LIBRARY} PRIVATE ${item} ${ARGN}) +endfunction() + +function(zephyr_library_cc_option) + foreach(arg ${ARGV}) + target_cc_option(${ZEPHYR_CURRENT_LIBRARY} PRIVATE ${arg}) + endforeach() +endfunction() + +# Add the existing CMake library 'library' to the global list of +# Zephyr CMake libraries. This is done automatically by the +# constructor but must called explicitly on CMake libraries that do +# not use a zephyr library constructor, but have source files that +# need to be included in the build. +function(zephyr_append_cmake_library library) + set_property(GLOBAL APPEND PROPERTY ZEPHYR_LIBS ${library}) +endfunction() + +######################################################## +# 2. Kconfig-aware extensions +######################################################## +# +# Kconfig is a configuration language developed for the Linux +# kernel. The below functions integrate CMake with Kconfig. +# +# 2.1 *_if_kconfig +# +# Functions for conditionally including directories and source files +# that have matching KConfig values. +# +# zephyr_library_sources_if_kconfig(fft.c) +# is the same as +# zephyr_library_sources_ifdef(CONFIG_FFT fft.c) +# +# add_subdirectory_if_kconfig(serial) +# is the same as +# add_subdirectory_ifdef(CONFIG_SERIAL serial) +function(add_subdirectory_if_kconfig dir) + string(TOUPPER config_${dir} UPPER_CASE_CONFIG) + add_subdirectory_ifdef(${UPPER_CASE_CONFIG} ${dir}) +endfunction() + +function(target_sources_if_kconfig target scope item) + get_filename_component(item_basename ${item} NAME_WE) + string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG) + target_sources_ifdef(${UPPER_CASE_CONFIG} ${target} ${scope} ${item}) +endfunction() + +function(zephyr_library_sources_if_kconfig item) + get_filename_component(item_basename ${item} NAME_WE) + string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG) + zephyr_library_sources_ifdef(${UPPER_CASE_CONFIG} ${item}) +endfunction() + +function(zephyr_sources_if_kconfig item) + get_filename_component(item_basename ${item} NAME_WE) + string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG) + zephyr_sources_ifdef(${UPPER_CASE_CONFIG} ${item}) +endfunction() + +# 2.2 Misc +# +# Parse a KConfig formatted file (typically named *.config) and +# introduce all the CONF_ variables into the CMake namespace +function(import_kconfig config_file) + # Parse the lines prefixed with CONFIG_ in ${config_file} + file( + STRINGS + ${config_file} + DOT_CONFIG_LIST + REGEX "^CONFIG_" + ) + + foreach (CONFIG ${DOT_CONFIG_LIST}) + # CONFIG looks like: CONFIG_NET_BUF=y + + # Match the first part, the variable name + string(REGEX MATCH "[^=]+" CONF_VARIABLE_NAME ${CONFIG}) + + # Match the second part, variable value + string(REGEX MATCH "=(.+$)" CONF_VARIABLE_VALUE ${CONFIG}) + # The variable name match we just did included the '=' symbol. To just get the + # part on the RHS we use match group 1 + set(CONF_VARIABLE_VALUE ${CMAKE_MATCH_1}) + + if("${CONF_VARIABLE_VALUE}" MATCHES "^\"(.*)\"$") # Is surrounded by quotes + set(CONF_VARIABLE_VALUE ${CMAKE_MATCH_1}) + endif() + + set("${CONF_VARIABLE_NAME}" "${CONF_VARIABLE_VALUE}" PARENT_SCOPE) + endforeach() +endfunction() + +######################################################## +# 3. CMake-generic extensions +######################################################## +# +# These functions extend the CMake API in a way that is not particular +# to Zephyr. Primarily they work around limitations in the CMake +# language to allow cleaner build scripts. + +# 3.1. *_ifdef +# +# Functions for conditionally executing CMake functions with oneliners +# e.g. +# +# if(CONFIG_FFT) +# zephyr_library_source( +# fft_32.c +# fft_utils.c +# ) +# endif() +# +# Becomes +# +# zephyr_source_ifdef( +# CONFIG_FFT +# fft_32.c +# fft_utils.c +# ) +# +# More Generally +# "_ifdef(CONDITION args)" +# Becomes +# """ +# if(CONDITION) +# (args) +# endif() +# """ +# +# ifdef functions are added on an as-need basis. See +# https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html for +# a list of available functions. +function(add_subdirectory_ifdef feature_toggle dir) + if(${${feature_toggle}}) + add_subdirectory(${dir}) + endif() +endfunction() + +function(target_sources_ifdef feature_toggle target scope item) + if(${${feature_toggle}}) + target_sources(${target} ${scope} ${item} ${ARGN}) + endif() +endfunction() + +function(target_compile_definitions_ifdef feature_toggle target scope item) + if(${${feature_toggle}}) + target_compile_definitions(${target} ${scope} ${item} ${ARGN}) + endif() +endfunction() + +function(target_include_directories_ifdef feature_toggle target scope item) + if(${${feature_toggle}}) + target_include_directories(${target} ${scope} ${item} ${ARGN}) + endif() +endfunction() + +function(target_link_libraries_ifdef feature_toggle target item) + if(${${feature_toggle}}) + target_link_libraries(${target} ${item} ${ARGN}) + endif() +endfunction() + +function(add_compile_option_ifdef feature_toggle option) + if(${${feature_toggle}}) + add_compile_options(${option}) + endif() +endfunction() + +function(target_compile_option_ifdef feature_toggle target scope option) + if(${feature_toggle}) + target_compile_options(${target} ${scope} ${option}) + endif() +endfunction() + +function(target_cc_option_ifdef feature_toggle target scope option) + if(${feature_toggle}) + target_cc_option(${target} ${scope} ${option}) + endif() +endfunction() + +function(zephyr_library_sources_ifdef feature_toggle source) + if(${${feature_toggle}}) + zephyr_library_sources(${source} ${ARGN}) + endif() +endfunction() + +function(zephyr_sources_ifdef feature_toggle) + if(${${feature_toggle}}) + zephyr_sources(${ARGN}) + endif() +endfunction() + +function(zephyr_sources_ifndef feature_toggle) + if(NOT ${feature_toggle}) + zephyr_sources(${ARGN}) + endif() +endfunction() + +function(zephyr_cc_option_ifdef feature_toggle) + if(${${feature_toggle}}) + zephyr_cc_option(${ARGN}) + endif() +endfunction() + +function(zephyr_link_libraries_ifdef feature_toggle) + if(${${feature_toggle}}) + zephyr_link_libraries(${ARGN}) + endif() +endfunction() + +function(zephyr_compile_options_ifdef feature_toggle) + if(${${feature_toggle}}) + zephyr_compile_options(${ARGN}) + endif() +endfunction() + +function(zephyr_compile_definitions_ifdef feature_toggle) + if(${${feature_toggle}}) + zephyr_compile_definitions(${ARGN}) + endif() +endfunction() + +function(zephyr_include_directories_ifdef feature_toggle) + if(${${feature_toggle}}) + zephyr_include_directories(${ARGN}) + endif() +endfunction() + +function(zephyr_library_compile_definitions_ifdef feature_toggle item) + if(${${feature_toggle}}) + zephyr_library_compile_definitions(${item} ${ARGN}) + endif() +endfunction() + +function(zephyr_library_compile_options_ifdef feature_toggle item) + if(${${feature_toggle}}) + zephyr_library_compile_options(${item} ${ARGN}) + endif() +endfunction() + +function(zephyr_link_interface_ifdef feature_toggle interface) + if(${${feature_toggle}}) + target_link_libraries(${interface} INTERFACE zephyr_interface) + endif() +endfunction() + +function(zephyr_library_link_libraries_ifdef feature_toggle item) + if(${${feature_toggle}}) + zephyr_library_link_libraries(${item}) + endif() +endfunction() + + +# 3.2. *_ifndef +# See 3.1 *_ifdef +function(set_ifndef variable value) + if(NOT ${variable}) + set(${variable} ${value} PARENT_SCOPE) + endif() +endfunction() + +function(target_cc_option_ifndef feature_toggle target scope option) + if(NOT ${feature_toggle}) + target_cc_option(${target} ${scope} ${option}) + endif() +endfunction() + +function(zephyr_cc_option_ifndef feature_toggle) + if(NOT ${feature_toggle}) + zephyr_cc_option(${ARGN}) + endif() +endfunction() + +function(zephyr_compile_options_ifndef feature_toggle) + if(NOT ${feature_toggle}) + zephyr_compile_options(${ARGN}) + endif() +endfunction() + +# 3.2. *_option Compiler-compatibility checks +# +# Utility functions for silently omitting compiler flags when the +# compiler lacks support. *_cc_option was ported from KBuild, see +# cc-option in +# https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt +# +function(target_cc_option target scope option) + string(MAKE_C_IDENTIFIER check${option} check) + check_c_compiler_flag(${option} ${check}) + target_compile_option_ifdef(${check} ${target} ${scope} ${option}) +endfunction() + +# Support an optional second option for when the first option is +# not supported. +function(target_cc_option_fallback target scope option1 option2) + string(MAKE_C_IDENTIFIER check${option1} check) + check_c_compiler_flag(${option1} ${check}) + if(${check}) + target_compile_options(${target} ${scope} ${option1}) + else() + target_compile_options(${target} ${scope} ${option2}) + endif() +endfunction() + +function(target_ld_options target scope) + foreach(option ${ARGN}) + string(MAKE_C_IDENTIFIER check${option} check) + check_c_compiler_flag(${option} ${check}) + target_link_libraries_ifdef(${check} ${target} ${scope} ${option}) + endforeach() +endfunction() + +# 3.4. Debugging CMake + +# Usage: +# print(BOARD) +# +# will print: "BOARD: nrf52_pca10040" +function(print arg) + message(STATUS "${arg}: ${${arg}}") +endfunction() + +# Usage: +# assert(ZEPHYR_GCC_VARIANT "ZEPHYR_GCC_VARIANT not set.") +# +# will cause a FATAL_ERROR and print an error message if the first +# expression is false +macro(assert test comment) + if(NOT ${test}) + message(FATAL_ERROR "Assertion failed: ${comment}") + endif() +endmacro() + +# Usage: +# assert_exists(CMAKE_READELF) +# +# will cause a FATAL_ERROR if there is no file or directory behind the +# variable +macro(assert_exists var) + if(NOT EXISTS ${${var}}) + message(FATAL_ERROR "No such file or directory: ${var}: '${${var}}'") + endif() +endmacro() diff --git a/cmake/flash/CMakeLists.txt b/cmake/flash/CMakeLists.txt new file mode 100644 index 0000000000..e119e75398 --- /dev/null +++ b/cmake/flash/CMakeLists.txt @@ -0,0 +1,53 @@ +get_property(ENV_VARS GLOBAL PROPERTY FLASH_SCRIPT_ENV_VARS) +list(APPEND ENV_VARS + O=${PROJECT_BINARY_DIR} + KERNEL_ELF_NAME=${KERNEL_ELF_NAME} + KERNEL_HEX_NAME=${KERNEL_HEX_NAME} + KERNEL_BIN_NAME=${KERNEL_BIN_NAME} + ARCH=${ARCH} + BOARD_NAME=${BOARD} + ) + +foreach(target flash debug debugserver) + if(target STREQUAL flash) + set(comment "Flashing ${BOARD}") + set(script ${FLASH_SCRIPT}) + elseif(target STREQUAL debug) + set(comment "Debugging ${BOARD}") + set(script ${DEBUG_SCRIPT}) + elseif(target STREQUAL debugserver) + set(comment "Debugging ${BOARD}") + set(script ${DEBUG_SCRIPT}) + if(EMU_PLATFORM) + # cmake/qemu/CMakeLists.txt will add a debugserver target for + # emulation platforms, so we don't add one here + continue() + endif() + endif() + + if(script) + set(cmd + ${CMAKE_COMMAND} -E env + ${ENV_VARS} + ${PYTHON_EXECUTABLE} + $ENV{ZEPHYR_BASE}/scripts/support/zephyr_flash_debug.py + ${target} + $ENV{ZEPHYR_BASE}/scripts/support/${script} + DEPENDS ${logical_target_for_zephyr_elf} + WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} + ) + else() + set(cmd + ${CMAKE_COMMAND} -E echo + "'${target}' is not supported with this board." + "Please check the documentation for alternate instructions." + ) + endif() + + add_custom_target(${target} + COMMAND + ${cmd} + COMMENT + ${comment} + ) +endforeach() diff --git a/cmake/fpu-for-gcc-m-cpu.cmake b/cmake/fpu-for-gcc-m-cpu.cmake new file mode 100644 index 0000000000..3df9ee4121 --- /dev/null +++ b/cmake/fpu-for-gcc-m-cpu.cmake @@ -0,0 +1,5 @@ +# Defines a mapping from GCC_M_CPU to FPU + +set(FPU_FOR_cortex-m4 fpv4-sp-d16) +set(FPU_FOR_cortex-m7 fpv5-d16) +set(FPU_FOR_cortex-m33 fpv5-d16) diff --git a/cmake/gcc-m-cpu.cmake b/cmake/gcc-m-cpu.cmake new file mode 100644 index 0000000000..dbed59da4e --- /dev/null +++ b/cmake/gcc-m-cpu.cmake @@ -0,0 +1,32 @@ +# Determines what argument to give to -mcpu= based on the +# KConfig'uration and sets this to GCC_M_CPU + +if("${ARCH}" STREQUAL "arm") + if (CONFIG_CPU_CORTEX_M0) + set(GCC_M_CPU cortex-m0) + elseif(CONFIG_CPU_CORTEX_M0PLUS) + set(GCC_M_CPU cortex-m0plus) + elseif(CONFIG_CPU_CORTEX_M3) + set(GCC_M_CPU cortex-m3) + elseif(CONFIG_CPU_CORTEX_M4) + set(GCC_M_CPU cortex-m4) + elseif(CONFIG_CPU_CORTEX_M7) + set(GCC_M_CPU cortex-m7) + elseif(CONFIG_CPU_CORTEX_M23) + set(GCC_M_CPU cortex-m23) + elseif(CONFIG_CPU_CORTEX_M33) + set(GCC_M_CPU cortex-m33) + else() + message(FATAL_ERROR "Expected CONFIG_CPU_CORTEX_x to be defined") + endif() +elseif("${ARCH}" STREQUAL "arc") + if(CONFIG_SOC_QUARK_SE_C1000_SS) + set(GCC_M_CPU quarkse_em) + elseif(CONFIG_SOC_EM9D) + set(GCC_M_CPU em4_fpus) + elseif(CONFIG_SOC_EM7D) + set(GCC_M_CPU em4_dmips) + elseif(CONFIG_SOC_EM11D) + set(GCC_M_CPU em4_fpuda) + endif() +endif() diff --git a/cmake/host-tools-zephyr.cmake b/cmake/host-tools-zephyr.cmake new file mode 100644 index 0000000000..28e1eafe6a --- /dev/null +++ b/cmake/host-tools-zephyr.cmake @@ -0,0 +1,37 @@ +# Lots of duplications here. +# FIXME: maintain this only in one place. + +# We need to separate actual toolchain from the host-tools required by Zephyr +# and currently provided by the Zephyr SDK. Those tools will need to be +# provided for different OSes and sepearately from the toolchain. + + +set_ifndef(ZEPHYR_SDK_INSTALL_DIR $ENV{ZEPHYR_SDK_INSTALL_DIR}) +set( ZEPHYR_SDK_INSTALL_DIR ${ZEPHYR_SDK_INSTALL_DIR} CACHE PATH "Zephyr SDK install directory") +assert( ZEPHYR_SDK_INSTALL_DIR "ZEPHYR_SDK_INSTALL_DIR is not set") + +set(REQUIRED_SDK_VER 0.9.2) +set(TOOLCHAIN_VENDOR zephyr) +set(TOOLCHAIN_ARCH x86_64) + +file(READ ${ZEPHYR_SDK_INSTALL_DIR}/sdk_version SDK_VERSION) +if(${REQUIRED_SDK_VER} VERSION_GREATER ${SDK_VERSION}) + message(FATAL_ERROR "The SDK version you are using is old, please update your SDK. +You need at least SDK version ${REQUIRED_SDK_VER}. +The new version of the SDK can be download from: +https://github.com/zephyrproject-rtos/meta-zephyr-sdk/releases/download/${REQUIRED_SDK_VER}/zephyr-sdk-${REQUIRED_SDK_VER}-setup.run +") +endif() + +if(MINGW) + set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-mingw32) +else() + set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${TOOLCHAIN_ARCH}-pokysdk-linux) +endif() + +# Path used for searching by the find_*() functions, with appropriate +# suffixes added. Ensures that the SDK's host tools will be found when +# we call, e.g. find_program(QEMU qemu-system-x86) +list(APPEND CMAKE_PREFIX_PATH ${TOOLCHAIN_HOME}/usr) + +set(QEMU_BIOS ${TOOLCHAIN_HOME}/usr/share/qemu) diff --git a/cmake/host-tools.cmake b/cmake/host-tools.cmake new file mode 100644 index 0000000000..222cffaebf --- /dev/null +++ b/cmake/host-tools.cmake @@ -0,0 +1,53 @@ +include($ENV{ZEPHYR_BASE}/cmake/host-tools-${ZEPHYR_GCC_VARIANT}.cmake OPTIONAL) + +if(PREBUILT_HOST_TOOLS) + list(APPEND CMAKE_PROGRAM_PATH ${PREBUILT_HOST_TOOLS}/kconfig) +endif() + +# Search for the must-have program dtc on PATH and in +# TOOLCHAIN_HOME. Usually DTC will be provided by an SDK, but for +# SDK-less projects like gccarmemb, it is up to the user to install +# dtc. +find_program( + DTC + dtc + ) +if(${DTC} STREQUAL DTC-NOTFOUND) + message(FATAL_ERROR "Unable to find dtc") +endif() + +find_program( + KCONFIG_CONF + conf + ) +if(${KCONFIG_CONF} STREQUAL KCONFIG_CONF-NOTFOUND) + message(FATAL_ERROR "Unable to find the Kconfig program 'conf'") +endif() + +find_program( + GPERF + gperf + ) +if(${GPERF} STREQUAL GPERF-NOTFOUND) + message(FATAL_ERROR "Unable to find gperf") +endif() + +# mconf is an optional dependency +find_program( + KCONFIG_MCONF + mconf + ) + +# qemu is an optional dependency +if("${ARCH}" STREQUAL "x86") + set(QEMU_binary_suffix i386) +else() + set(QEMU_binary_suffix ${ARCH}) +endif() +find_program( + QEMU + qemu-system-${QEMU_binary_suffix} + ) + +# TODO: Should we instead find one qemu binary for each ARCH? +# TODO: This will probably need to be re-organized when there exists more than one SDK. diff --git a/cmake/kconfig.cmake b/cmake/kconfig.cmake new file mode 100644 index 0000000000..9a3216d5fc --- /dev/null +++ b/cmake/kconfig.cmake @@ -0,0 +1,161 @@ +# Folders needed for conf/mconf files (kconfig has no method of redirecting all output files). +# conf/mconf needs to be run from a different directory because of: ZEP-1963 +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/generated) +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/config) + +set_ifndef(KCONFIG_ROOT ${PROJECT_SOURCE_DIR}/Kconfig) + +#set(BOARD_DEFCONFIG ${PROJECT_SOURCE_DIR}/boards/${ARCH}/${BOARD}/${BOARD}_defconfig) +set(BOARD_DEFCONFIG ${BOARD_DIR}/${BOARD}_defconfig) +set(DOTCONFIG ${PROJECT_BINARY_DIR}/.config) + +if(CONF_FILE) +string(REPLACE " " ";" CONF_FILE_AS_LIST ${CONF_FILE}) +endif() + +set(ENV{srctree} ${PROJECT_SOURCE_DIR}) +set(ENV{KERNELVERSION} ${PROJECT_VERSION}) +set(ENV{KCONFIG_CONFIG} ${DOTCONFIG}) +set(ENV{KCONFIG_AUTOHEADER} ${AUTOCONF_H}) + +if(IS_TEST) + list(APPEND OVERLAY_CONFIG $ENV{ZEPHYR_BASE}/tests/include/test.config) +endif() + +set(kconfig_target_list + config + gconfig + menuconfig + oldconfig + xconfig + ) + +set(COMMAND_FOR_config ${KCONFIG_CONF} --oldaskconfig ${KCONFIG_ROOT}) +set(COMMAND_FOR_gconfig gconf ${KCONFIG_ROOT}) +set(COMMAND_FOR_menuconfig ${KCONFIG_MCONF} ${KCONFIG_ROOT}) +set(COMMAND_FOR_oldconfig ${KCONFIG_CONF} --oldconfig ${KCONFIG_ROOT}) +set(COMMAND_FOR_xconfig qconf ${KCONFIG_ROOT}) + +foreach(kconfig_target ${kconfig_target_list}) + add_custom_target( + ${kconfig_target} + ${CMAKE_COMMAND} -E env + srctree=${PROJECT_SOURCE_DIR} + KERNELVERSION=${PROJECT_VERSION} + KCONFIG_CONFIG=${DOTCONFIG} + ${COMMAND_FOR_${kconfig_target}} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig + USES_TERMINAL + ) +endforeach() + +# Bring in extra configuration files dropped in by the user or anyone else; +# make sure they are set at the end so we can override any other setting +file(GLOB config_files ${APPLICATION_BINARY_DIR}/*.conf) +list(SORT config_files) +set( + merge_config_files + ${BOARD_DEFCONFIG} + ${CONF_FILE_AS_LIST} + ${OVERLAY_CONFIG} + ${config_files} +) + +# Create a list of absolute paths to the .config sources from +# merge_config_files, which is a mix of absolute and relative paths. +set(merge_config_files_with_absolute_paths "") +foreach(f ${merge_config_files}) + if(IS_ABSOLUTE ${f}) + set(path ${f}) + else() + set(path ${APPLICATION_SOURCE_DIR}/${f}) + endif() + + list(APPEND merge_config_files_with_absolute_paths ${path}) +endforeach() + +foreach(f ${merge_config_files_with_absolute_paths}) + if(NOT EXISTS ${f} OR IS_DIRECTORY ${f}) + message(FATAL_ERROR "File not found: ${f}") + endif() +endforeach() + +# Calculate a checksum of merge_config_files to determine if we need +# to re-generate .config +set(merge_config_files_checksum "") +foreach(f ${merge_config_files_with_absolute_paths}) + file(MD5 ${f} checksum) + set(merge_config_files_checksum "${merge_config_files_checksum}${checksum}") +endforeach() + +# Create a new .config if it does not exists, or if the checksum of +# the dependencies has changed +set(merge_config_files_checksum_file ${PROJECT_BINARY_DIR}/.cmake.dotconfig.checksum) +set(CREATE_NEW_DOTCONFIG "") +if(NOT EXISTS ${DOTCONFIG}) + set(CREATE_NEW_DOTCONFIG 1) +else() + # Read out what the checksum was previously + file(READ + ${merge_config_files_checksum_file} + merge_config_files_checksum_prev + ) + set(CREATE_NEW_DOTCONFIG 1) + if( + ${merge_config_files_checksum} STREQUAL + ${merge_config_files_checksum_prev} + ) + set(CREATE_NEW_DOTCONFIG 0) + endif() +endif() +if(CREATE_NEW_DOTCONFIG) + execute_process( + COMMAND + ${PROJECT_SOURCE_DIR}/scripts/kconfig/merge_config.sh + -m + -q + -O ${PROJECT_BINARY_DIR} + ${merge_config_files} + WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR} + # The working directory is set to the app dir such that the user + # can use relative paths in CONF_FILE, e.g. CONF_FILE=nrf5.conf + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + endif() + + execute_process( + COMMAND ${KCONFIG_CONF} + --olddefconfig + ${KCONFIG_ROOT} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + endif() + + file(WRITE + ${merge_config_files_checksum_file} + ${merge_config_files_checksum} + ) +endif() + +# Force CMAKE configure when the configuration files changes. +foreach(merge_config_input ${merge_config_files} ${DOTCONFIG}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${merge_config_input}) +endforeach() + +message(STATUS "Generating zephyr/include/generated/autoconf.h") +execute_process( + COMMAND ${KCONFIG_CONF} + --silentoldconfig + ${KCONFIG_ROOT} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig +) + +add_custom_target(config-sanitycheck DEPENDS ${DOTCONFIG}) + +# Parse the lines prefixed with CONFIG_ in the .config file from Kconfig +import_kconfig(${DOTCONFIG}) diff --git a/cmake/pristine.cmake b/cmake/pristine.cmake new file mode 100644 index 0000000000..8855db2d88 --- /dev/null +++ b/cmake/pristine.cmake @@ -0,0 +1,15 @@ +# NB: This could be dangerous to execute, it is assuming the user is +# checking that the build is out-of-source with code like this: +# +# if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) +# message(FATAL_ERROR "Source directory equals build directory.\ +# In-source builds are not supported.\ +# Please specify a build directory, e.g. cmake -Bbuild -H.") +# endif() + +file(GLOB build_dir_contents ${CMAKE_BINARY_DIR}/*) +foreach(file ${build_dir_contents}) + if (EXISTS ${file}) + file(REMOVE_RECURSE ${file}) + endif() +endforeach(file) diff --git a/cmake/qemu/CMakeLists.txt b/cmake/qemu/CMakeLists.txt new file mode 100644 index 0000000000..03a654ef97 --- /dev/null +++ b/cmake/qemu/CMakeLists.txt @@ -0,0 +1,153 @@ +if(EMU_PLATFORM) + # TODO: Support more emulators + + # QEMU_INSTANCE is a command line argument to make. By appending the + # instance name to the pid file we can easily run more instances of + # the same sample. + + set(qemu_targets + run + debugserver + ) + + set(QEMU_FLAGS -serial) + if(QEMU_PTY) + list(APPEND QEMU_FLAGS pty) + else() + if(QEMU_PIPE) + # Send console output to a pipe, used for running automated sanity tests + list(APPEND QEMU_FLAGS pipe:${QEMU_PIPE}) + else() + list(APPEND QEMU_FLAGS mon:stdio) + endif() + endif() + + if(QEMU_NET_STACK) + list(APPEND qemu_targets + client + server + ) + + list(APPEND QEMU_FLAGS + -serial none + ) + + foreach(target ${qemu_targets}) + if((${target} STREQUAL client) OR (${target} STREQUAL server)) + list(APPEND MORE_FLAGS_FOR_${target} + -serial pipe:/tmp/ip-stack-${target} + -pidfile qemu-${target}.pid + ) + else() + list(APPEND MORE_FLAGS_FOR_${target} + -serial unix:/tmp/slip.sock${QEMU_INSTANCE} + ) + endif() + endforeach() + + + set(PIPE_SERVER_IN /tmp/ip-stack-server.in) + set(PIPE_SERVER_OUT /tmp/ip-stack-server.out) + set(PIPE_CLIENT_IN /tmp/ip-stack-client.in) + set(PIPE_CLIENT_OUT /tmp/ip-stack-client.out) + + set(pipes + ${PIPE_SERVER_IN} + ${PIPE_SERVER_OUT} + ${PIPE_CLIENT_IN} + ${PIPE_CLIENT_OUT} + ) + + set(destroy_pipe_commands + COMMAND ${CMAKE_COMMAND} -E remove -f ${pipes} + ) + + # TODO: Port to Windows. Perhaps using python? Or removing the + # need for mkfifo and create_symlink somehow. + set(create_pipe_commands + COMMAND mkfifo ${PIPE_SERVER_IN} + COMMAND mkfifo ${PIPE_SERVER_OUT} + ) + if(PCAP) + list(APPEND create_pipe_commands + COMMAND mkfifo ${PIPE_CLIENT_IN} + COMMAND mkfifo ${PIPE_CLIENT_OUT} + ) + else() + list(APPEND create_pipe_commands + COMMAND ${CMAKE_COMMAND} -E create_symlink ${PIPE_SERVER_IN} ${PIPE_CLIENT_OUT} + COMMAND ${CMAKE_COMMAND} -E create_symlink ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN} + ) + endif() + + set(PRE_QEMU_COMMANDS_FOR_server + ${destroy_pipe_commands} + ${create_pipe_commands} + ) + if(PCAP) + # Start a monitor application to capture traffic + # + # Assumes; + # PCAP has been set to the file where traffic should be captured + # NET_TOOLS has been set to the net-tools repo path + # net-tools/monitor_15_4 has been built beforehand + + set_ifndef(NET_TOOLS $ENV{ZEPHYR_BASE}/../net-tools) # Default if not set + + list(APPEND PRE_QEMU_COMMANDS_FOR_server + COMMAND ${NET_TOOLS}/monitor_15_4 + ${PCAP} + /tmp/ip-stack-server + /tmp/ip-stack-client + > /dev/null & + # TODO: Support cleanup of the monitor_15_4 process + ) + endif() + endif(QEMU_NET_STACK) + + if(CONFIG_X86_IAMCU) + list(APPEND PRE_QEMU_COMMANDS + COMMAND + ${PYTHON_EXECUTABLE} + $ENV{ZEPHYR_BASE}/scripts/qemu-machine-hack.py + $ + ) + endif() + + if(NOT QEMU_PIPE) + set(QEMU_PIPE_COMMENT "\nTo exit from QEMU enter: 'CTRL+a, x'\n") + endif() + + # Use flags passed in from the environment + set(env_qemu $ENV{QEMU_EXTRA_FLAGS}) + separate_arguments(env_qemu) + list(APPEND QEMU_EXTRA_FLAGS ${env_qemu}) + + list(APPEND MORE_FLAGS_FOR_debugserver -s -S) + + foreach(target ${qemu_targets}) + add_custom_target(${target} + ${PRE_QEMU_COMMANDS} + ${PRE_QEMU_COMMANDS_FOR_${target}} + COMMAND + ${QEMU} + ${QEMU_FLAGS_${ARCH}} + -pidfile qemu${QEMU_INSTANCE}.pid + ${QEMU_FLAGS} + ${QEMU_EXTRA_FLAGS} + ${MORE_FLAGS_FOR_${target}} + -kernel $ + WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} + COMMENT "${QEMU_PIPE_COMMENT}[QEMU] CPU: ${QEMU_CPU_TYPE_${ARCH}}" + USES_TERMINAL + ) + endforeach() +else() + add_custom_target(run + COMMAND + ${CMAKE_COMMAND} -E echo + "===================================================" + "Emulation/Simulation not supported with this board." + "===================================================" + ) +endif() diff --git a/cmake/reports/CMakeLists.txt b/cmake/reports/CMakeLists.txt new file mode 100644 index 0000000000..3f65bfc42b --- /dev/null +++ b/cmake/reports/CMakeLists.txt @@ -0,0 +1,13 @@ +set(flag_for_ram_report -r) +set(flag_for_rom_report -F) + +foreach(report ram_report rom_report) + add_custom_target( + ${report} + ${PYTHON_EXECUTABLE} + $ENV{ZEPHYR_BASE}/scripts/footprint/size_report + ${flag_for_${report}} + -o ${PROJECT_BINARY_DIR} + DEPENDS ${logical_target_for_zephyr_elf} + ) +endforeach() diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt new file mode 100644 index 0000000000..0df1c0c0ca --- /dev/null +++ b/cmake/test/CMakeLists.txt @@ -0,0 +1,3 @@ +target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE}/tests/include + ) diff --git a/cmake/toolchain-espressif.cmake b/cmake/toolchain-espressif.cmake new file mode 100644 index 0000000000..4bd7449259 --- /dev/null +++ b/cmake/toolchain-espressif.cmake @@ -0,0 +1,14 @@ +set_ifndef(ESPRESSIF_TOOLCHAIN_PATH $ENV{ESPRESSIF_TOOLCHAIN_PATH}) +set( ESPRESSIF_TOOLCHAIN_PATH ${ESPRESSIF_TOOLCHAIN_PATH} CACHE PATH "") +assert( ESPRESSIF_TOOLCHAIN_PATH "ESPRESSIF_TOOLCHAIN_PATH is not set") + +set(TOOLCHAIN_HOME ${ESPRESSIF_TOOLCHAIN_PATH}) + +set(COMPILER gcc) + +set(CROSS_COMPILE_TARGET xtensa-esp32-elf) +set(SYSROOT_TARGET xtensa-esp32-elf) + +set(CROSS_COMPILE ${TOOLCHAIN_HOME}/bin/${CROSS_COMPILE_TARGET}-) +set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}) + diff --git a/cmake/toolchain-gcc.cmake b/cmake/toolchain-gcc.cmake new file mode 100644 index 0000000000..048a5a04ca --- /dev/null +++ b/cmake/toolchain-gcc.cmake @@ -0,0 +1,107 @@ +# Configures CMake for using GCC, this script is re-used by several +# GCC-based toolchains + +set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc CACHE INTERNAL " " FORCE) +set(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy CACHE INTERNAL " " FORCE) +set(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump CACHE INTERNAL " " FORCE) +#set(CMAKE_LINKER ${CROSS_COMPILE}ld CACHE INTERNAL " " FORCE) # Not in use yet +set(CMAKE_AR ${CROSS_COMPILE}ar CACHE INTERNAL " " FORCE) +set(CMAKE_RANLILB ${CROSS_COMPILE}ranlib CACHE INTERNAL " " FORCE) +set(CMAKE_READELF ${CROSS_COMPILE}readelf CACHE INTERNAL " " FORCE) + +assert_exists(CMAKE_READELF) + +if(CONFIG_CPLUSPLUS) + set(cplusplus_compiler ${CROSS_COMPILE}g++) +else() + if(EXISTS ${CROSS_COMPILE}g++) + set(cplusplus_compiler ${CROSS_COMPILE}g++) + else() + # When the toolchain doesn't support C++, and we aren't building + # with C++ support just set it to something so CMake doesn't + # crash, it won't actually be called + set(cplusplus_compiler ${CMAKE_C_COMPILER}) + endif() +endif() +set(CMAKE_CXX_COMPILER ${cplusplus_compiler} CACHE INTERNAL " " FORCE) + +set(NOSTDINC "") + +foreach(file_name include include-fixed) + execute_process( + COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name} + OUTPUT_VARIABLE _OUTPUT + ) + string(REGEX REPLACE "\n" "" _OUTPUT ${_OUTPUT}) + + if(MSYS) + # TODO: Remove this when + # https://github.com/zephyrproject-rtos/zephyr/issues/4687 is + # resolved + execute_process( + COMMAND cygpath -u ${_OUTPUT} + OUTPUT_VARIABLE _OUTPUT + ) + string(REGEX REPLACE "\n" "" _OUTPUT ${_OUTPUT}) + endif() + + list(APPEND NOSTDINC ${_OUTPUT}) +endforeach() + +include($ENV{ZEPHYR_BASE}/cmake/gcc-m-cpu.cmake) + +if("${ARCH}" STREQUAL "arm") + list(APPEND TOOLCHAIN_C_FLAGS + -mthumb + -mcpu=${GCC_M_CPU} + ) + + include($ENV{ZEPHYR_BASE}/cmake/fpu-for-gcc-m-cpu.cmake) + + if(CONFIG_FLOAT) + list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}}) + if (CONFIG_FP_SOFTABI) + list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=soft) + elseif(CONFIG_FP_HARDABI) + list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=hard) + endif() + endif() +elseif("${ARCH}" STREQUAL "arc") + list(APPEND TOOLCHAIN_C_FLAGS + -mcpu=${GCC_M_CPU} + ) +endif() + +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name + OUTPUT_VARIABLE LIBGCC_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-multi-directory + OUTPUT_VARIABLE NEWLIB_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +get_filename_component(LIBGCC_DIR ${LIBGCC_DIR} DIRECTORY) + +assert(LIBGCC_DIR "LIBGCC_DIR not found") + +LIST(APPEND LIB_INCLUDE_DIR -L${LIBGCC_DIR}) +LIST(APPEND TOOLCHAIN_LIBS gcc) + +set(LIBC_INCLUDE_DIR ${SYSROOT_DIR}/include) +set(LIBC_LIBRARY_DIR ${SYSROOT_DIR}/lib/${NEWLIB_DIR}) + +# For CMake to be able to test if a compiler flag is supported by the +# toolchain we need to give CMake the necessary flags to compile and +# link a dummy C file. +# +# CMake checks compiler flags with check_c_compiler_flag() (Which we +# wrap with target_cc_option() in extentions.cmake) +foreach(isystem_include_dir ${NOSTDINC}) + list(APPEND isystem_include_flags -isystem ${isystem_include_dir}) +endforeach() +set(CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags} -Wl,--unresolved-symbols=ignore-in-object-files) +string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") diff --git a/cmake/toolchain-gccarmemb.cmake b/cmake/toolchain-gccarmemb.cmake new file mode 100644 index 0000000000..7f0dee3c7b --- /dev/null +++ b/cmake/toolchain-gccarmemb.cmake @@ -0,0 +1,17 @@ +set_ifndef(GCCARMEMB_TOOLCHAIN_PATH $ENV{GCCARMEMB_TOOLCHAIN_PATH}) +set( GCCARMEMB_TOOLCHAIN_PATH ${GCCARMEMB_TOOLCHAIN_PATH} CACHE PATH "gccarmemb install directory") +assert( GCCARMEMB_TOOLCHAIN_PATH "GCCARMEMB_TOOLCHAIN_PATH is not set") + +if(NOT EXISTS ${GCCARMEMB_TOOLCHAIN_PATH}) + message(FATAL_ERROR "Nothing found at GCCARMEMB_TOOLCHAIN_PATH: '${GCCARMEMB_TOOLCHAIN_PATH}'") +endif() + +set(TOOLCHAIN_HOME ${GCCARMEMB_TOOLCHAIN_PATH}) + +set(COMPILER gcc) + +set(CROSS_COMPILE_TARGET arm-none-eabi) +set(SYSROOT_TARGET arm-none-eabi) + +set(CROSS_COMPILE ${TOOLCHAIN_HOME}/bin/${CROSS_COMPILE_TARGET}-) +set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}) diff --git a/cmake/toolchain-issm.cmake b/cmake/toolchain-issm.cmake new file mode 100644 index 0000000000..321b699485 --- /dev/null +++ b/cmake/toolchain-issm.cmake @@ -0,0 +1,41 @@ +# +# The ISSM standalone toolchain provides both the x86 IAMCU and elf32 ARC +# toolchains. Currently supported version is '2016-05-12': +# https://software.intel.com/en-us/articles/issm-toolchain-only-download +# + +set_ifndef(ISSM_INSTALLATION_PATH $ENV{ISSM_INSTALLATION_PATH}) +set( ISSM_INSTALLATION_PATH ${ISSM_INSTALLATION_PATH} CACHE PATH "") +assert( ISSM_INSTALLATION_PATH "ISSM_INSTALLATION_PATH is not set") + +set(COMPILER gcc) + +set(TOOLCHAIN_VENDOR intel) + +# IA_VERSION and ARC_VERSION can be used to adjust the toolchain paths +# inside the ISSM installation to use an specific version, e.g.: +set_ifndef(IA_VERSION gcc-ia/5.2.1) +set_ifndef(ARC_VERSION gcc-arc/4.8.5) + +if("${ARCH}" STREQUAL "x86") + set(CROSS_COMPILE_TARGET i586-${TOOLCHAIN_VENDOR}-elfiamcu) + set(specific_version ${IA_VERSION}) +elseif("${ARCH}" STREQUAL "arc") + set(CROSS_COMPILE_TARGET arc-elf32) + set(specific_version ${ARC_VERSION}) +else() + message(FATAL_ERROR + "issm was selected as the toolchain and ${ARCH} as the ARCH, \ +but issm only supports x86 and arc" + ) +endif() + +set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET}) + +set(TOOLCHAIN_HOME ${ISSM_INSTALLATION_PATH}/tools/compiler/${specific_version}) + +set(CROSS_COMPILE ${TOOLCHAIN_HOME}/bin/${CROSS_COMPILE_TARGET}-) +set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}) + + +# TODO: What was _version used for? diff --git a/cmake/toolchain-xtools.cmake b/cmake/toolchain-xtools.cmake new file mode 100644 index 0000000000..e7439b1390 --- /dev/null +++ b/cmake/toolchain-xtools.cmake @@ -0,0 +1,16 @@ +set_ifndef(XTOOLS_TOOLCHAIN_PATH $ENV{XTOOLS_TOOLCHAIN_PATH}) +set( XTOOLS_TOOLCHAIN_PATH ${XTOOLS_TOOLCHAIN_PATH} CACHE PATH "") +assert( XTOOLS_TOOLCHAIN_PATH "XTOOLS_TOOLCHAIN_PATH is not set") + +set(TOOLCHAIN_HOME ${XTOOLS_TOOLCHAIN_PATH}) + +set(COMPILER gcc) + +set(CROSS_COMPILE_TARGET_arm arm-none-eabi) +set(CROSS_COMPILE_TARGET_x86 i586-zephyr-elfiamcu) + +set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}}) +set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET}) + +set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-) +set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}) diff --git a/cmake/toolchain-zephyr.cmake b/cmake/toolchain-zephyr.cmake new file mode 100644 index 0000000000..5f80d82321 --- /dev/null +++ b/cmake/toolchain-zephyr.cmake @@ -0,0 +1,43 @@ +# NB: Depends on host-tools.cmake having been executed already + +# Ensures toolchain-gcc.cmake is run +set(COMPILER gcc) + +# TODO fetch from environment + +# These defaults work for some targets like RISC-V +set(CROSS_COMPILE_TARGET ${ARCH}-${TOOLCHAIN_VENDOR}-elf) +set(SYSROOT_TARGET ${ARCH}-${TOOLCHAIN_VENDOR}-elf) + +if("${ARCH}" STREQUAL "arm") + set(CROSS_COMPILE_TARGET arm-${TOOLCHAIN_VENDOR}-eabi) + set(SYSROOT_TARGET armv5-${TOOLCHAIN_VENDOR}-eabi) + +elseif(CONFIG_TOOLCHAIN_VARIANT STREQUAL "iamcu") + set(CROSS_COMPILE_TARGET i586-${TOOLCHAIN_VENDOR}-elfiamcu) + set(SYSROOT_TARGET iamcu-${TOOLCHAIN_VENDOR}-elfiamcu) + +elseif("${ARCH}" STREQUAL "x86") + set(CROSS_COMPILE_TARGET i586-${TOOLCHAIN_VENDOR}-elf) + set(SYSROOT_TARGET i586-${TOOLCHAIN_VENDOR}-elf) + +elseif("${ARCH}" STREQUAL "xtensa") + set(SYSROOT_DIR ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET}/usr) + set(TOOLCHAIN_INCLUDES + ${SYSROOT_DIR}/include/arch/include + ${SYSROOT_DIR}/include + ) + + LIST(APPEND TOOLCHAIN_LIBS hal) + LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib) + +elseif("${ARCH}" STREQUAL "arc") + # https://github.com/zephyrproject-rtos/zephyr/issues/3797 + # -Os is broken on arc + set(OPTIMIZE_FOR_SIZE_FLAG "-O2") +endif() + +set(CROSS_COMPILE ${TOOLCHAIN_HOME}/usr/bin/${CROSS_COMPILE_TARGET}/${CROSS_COMPILE_TARGET}-) +set(SYSROOT_DIR ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET}/usr) + +list(APPEND TOOLCHAIN_C_FLAGS --sysroot ${SYSROOT_DIR}) diff --git a/cmake/toolchain.cmake b/cmake/toolchain.cmake new file mode 100644 index 0000000000..b21e5f913a --- /dev/null +++ b/cmake/toolchain.cmake @@ -0,0 +1,16 @@ +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR ${ARCH}) + +set(BUILD_SHARED_LIBS OFF) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +# Configure the toolchain based on what SDK/toolchain is in use. +include($ENV{ZEPHYR_BASE}/cmake/toolchain-${ZEPHYR_GCC_VARIANT}.cmake) + +# Configure the toolchain based on what toolchain technology is used +# (gcc clang etc.) +include($ENV{ZEPHYR_BASE}/cmake/toolchain-${COMPILER}.cmake OPTIONAL) diff --git a/cmake/usage/CMakeLists.txt b/cmake/usage/CMakeLists.txt new file mode 100644 index 0000000000..b61c2fdeae --- /dev/null +++ b/cmake/usage/CMakeLists.txt @@ -0,0 +1,12 @@ +add_custom_target( + usage + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/usage.cmake + ) + +add_custom_target( + kconfig-usage + ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/kconfig-usage.cmake + ) + +# NB: The reason it is 'usage' and not help is that CMake already +# defines a target 'help' diff --git a/cmake/usage/kconfig-usage.cmake b/cmake/usage/kconfig-usage.cmake new file mode 100644 index 0000000000..037c87d597 --- /dev/null +++ b/cmake/usage/kconfig-usage.cmake @@ -0,0 +1,15 @@ +message(" config - Update current config utilising a line-oriented program") +message(" nconfig - Update current config utilising a ncurses menu based program") +message(" menuconfig - Update current config utilising a menu based program") +message(" xconfig - Update current config utilising a QT based front-end") +message(" gconfig - Update current config utilising a GTK based front-end") +message(" oldconfig - Update current config utilising a provided .config as base") +message(" silentoldconfig - Same as oldconfig, but quietly, additionally update deps") +message(" defconfig - New config with default from ARCH supplied defconfig") +message(" savedefconfig - Save current config as ./defconfig (minimal config)") +message(" allnoconfig - New config where all options are answered with no") +message(" allyesconfig - New config where all options are accepted with yes") +message(" alldefconfig - New config with all symbols set to default") +message(" randconfig - New config with random answer to all options") +message(" listnewconfig - List new options") +message(" olddefconfig - Same as silentoldconfig but sets new symbols to their default value") diff --git a/cmake/usage/usage.cmake b/cmake/usage/usage.cmake new file mode 100644 index 0000000000..69bc375ebc --- /dev/null +++ b/cmake/usage/usage.cmake @@ -0,0 +1,81 @@ +# TODO: Set to make when make is used as a generator +set(CMAKE_MAKE_PROGRAM ninja) +get_filename_component(generator ${CMAKE_MAKE_PROGRAM} NAME) + +set(arch_list + arc + arm + nios2 + riscv32 + x86 + xtensa + ) + +set(board_dir $ENV{ZEPHYR_BASE}/boards) + +foreach(arch ${arch_list}) + set(board_arch_dir ${board_dir}/${arch}) + + # Match the .yanl files in the board directories to make sure we are + # finding boards, e.g. qemu_xtensa/qemu_xtensa.yaml + file(GLOB_RECURSE yamls_for_${arch} + RELATIVE ${board_arch_dir} + ${board_arch_dir}/*.yaml + ) + + # The above gives a list like + # nrf51_blenano/nrf51_blenano_yaml;nrf51_pca10028/nrf51_pca10028_yaml + # we construct a list of board names by removing both the .yaml + # suffix and the path. + set(boards_for_${arch} "") + foreach(yaml_path ${yamls_for_${arch}}) + get_filename_component(board ${yaml_path} NAME_WE) + + list(APPEND boards_for_${arch} ${board}) + endforeach() +endforeach() + +message("Cleaning targets:") +message(" clean - Remove most generated files but keep configuration and backup files") +message(" pristine - Remove all files in the build directory") +message("") +message("Configuration targets:") +message("") +message(" run <${generator} kconfig-usage>") +message("") +message("Other generic targets:") +message(" all - Build a zephyr application") +message(" run - Build a zephyr application and run it if the board supports emulation") +message(" flash - Build and flash an application") +message(" debug - Build and debug an application using GDB") +message(" debugserver - Build and start a GDB server (port 1234 for Qemu targets)") +message(" ram_report - Build and create RAM usage report") +message(" rom_report - Build and create ROM usage report") +message(" usage - Display this text") +message("") +message("Supported Boards:") +message("") +message(" To generate project files for one of the supported boards below, run:") +message("") +message(" $ cmake -DBOARD= -Bpath/to/build_dir -Hpath/to/source_dir") +message("") +message(" or") +message("") +message(" $ export BOARD=") +message(" $ cmake -Bpath/to/build_dir -Hpath/to/source_dir") +message("") +foreach(arch ${arch_list}) + message(" ${arch}:") + foreach(board ${boards_for_${arch}}) + message(" ${board}") + endforeach() +endforeach() +message("") +message("Build flags:") +message("") +message(" ${generator} VERBOSE=1 [targets] verbose build") +message(" cmake -DW=n Enable extra gcc checks, n=1,2,3 where") +message(" 1: warnings which may be relevant and do not occur too often") +message(" 2: warnings which occur quite often but may still be relevant") +message(" 3: more obscure warnings, can most likely be ignored") +message(" Multiple levels can be combined with W=12 or W=123") diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 0000000000..927552a73f --- /dev/null +++ b/cmake/version.cmake @@ -0,0 +1,23 @@ +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 9) +set(PROJECT_VERSION_PATCH 99) +set(PROJECT_VERSION_TWEAK 0) + +set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) +if(PROJECT_VERSION_TWEAK) + set(PROJECT_VERSION "${PROJECT_VERSION}.${PROJECT_VERSION_TWEAK}") +endif() + +set(MAJOR ${PROJECT_VERSION_MAJOR}) # Temporary convenience variable + +math(EXPR ZEPHYR_VERSION_CODE "(${MAJOR} << 16) + (${MAJOR} << 8) + (${MAJOR})") +math(EXPR KERNELVERSION "(${MAJOR} << 16) + (${MAJOR} << 8) + (${MAJOR})") +math(EXPR KERNEL_VERSION_NUMBER "(${MAJOR} << 24) + (${MAJOR} << 16) + (${MAJOR} << 8) + ${PROJECT_VERSION_TWEAK}") + +unset(MAJOR) + +set(KERNEL_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(KERNEL_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(KERNEL_PATCHLEVEL ${PROJECT_VERSION_PATCH}) +set(KERNEL_VERSION_STRING "\"${PROJECT_VERSION}\"") + diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt new file mode 100644 index 0000000000..758385986f --- /dev/null +++ b/drivers/CMakeLists.txt @@ -0,0 +1,33 @@ +add_subdirectory(console) +add_subdirectory(crc) +add_subdirectory(display) +add_subdirectory(interrupt_controller) + +add_subdirectory_if_kconfig(adc) +add_subdirectory_if_kconfig(clock_control) +add_subdirectory_if_kconfig(counter) +add_subdirectory_if_kconfig(dma) +add_subdirectory_if_kconfig(flash) +add_subdirectory_if_kconfig(gpio) +add_subdirectory_if_kconfig(grove) +add_subdirectory_if_kconfig(i2c) +add_subdirectory_if_kconfig(ieee802154) +add_subdirectory_if_kconfig(ipm) +add_subdirectory_if_kconfig(led_strip) +add_subdirectory_if_kconfig(pci) +add_subdirectory_if_kconfig(pinmux) +add_subdirectory_if_kconfig(pwm) +add_subdirectory_if_kconfig(rtc) +add_subdirectory_if_kconfig(sensor) +add_subdirectory_if_kconfig(serial) +add_subdirectory_if_kconfig(shared_irq) +add_subdirectory_if_kconfig(spi) +add_subdirectory_if_kconfig(usb) +add_subdirectory_if_kconfig(watchdog) + +add_subdirectory_ifdef(CONFIG_AIO_COMPARATOR aio) +add_subdirectory_ifdef(CONFIG_BT bluetooth) +add_subdirectory_ifdef(CONFIG_NETWORKING net) +add_subdirectory_ifdef(CONFIG_NET_L2_ETHERNET ethernet) +add_subdirectory_ifdef(CONFIG_RANDOM_GENERATOR random) +add_subdirectory_ifdef(CONFIG_SYS_CLOCK_EXISTS timer) diff --git a/drivers/adc/CMakeLists.txt b/drivers/adc/CMakeLists.txt new file mode 100644 index 0000000000..59776fb541 --- /dev/null +++ b/drivers/adc/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources_ifdef(CONFIG_ADC_DW adc_dw.c) +zephyr_sources_ifdef(CONFIG_ADC_MCUX_ADC16 adc_mcux_adc16.c) +zephyr_sources_ifdef(CONFIG_ADC_QMSI adc_qmsi.c) +zephyr_sources_ifdef(CONFIG_ADC_QMSI_SS adc_qmsi_ss.c) +zephyr_sources_ifdef(CONFIG_ADC_SAM_AFEC adc_sam_afec.c) +zephyr_sources_ifdef(CONFIG_ADC_TI_ADC108S102 adc_ti_adc108s102.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE adc_handlers.c) diff --git a/drivers/aio/CMakeLists.txt b/drivers/aio/CMakeLists.txt new file mode 100644 index 0000000000..8f1344e522 --- /dev/null +++ b/drivers/aio/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_AIO_COMPARATOR_QMSI aio_comparator_qmsi.c) +zephyr_sources_ifdef(CONFIG_USERSPACE aio_comparator_handlers.c) diff --git a/drivers/bluetooth/CMakeLists.txt b/drivers/bluetooth/CMakeLists.txt new file mode 100644 index 0000000000..f049275b4b --- /dev/null +++ b/drivers/bluetooth/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_include_directories($ENV{ZEPHYR_BASE}/subsys/bluetooth) +add_subdirectory(hci) +zephyr_sources_ifdef(CONFIG_BT_NRF51_PM nrf51_pm.c) diff --git a/drivers/bluetooth/hci/CMakeLists.txt b/drivers/bluetooth/hci/CMakeLists.txt new file mode 100644 index 0000000000..ba266a6c17 --- /dev/null +++ b/drivers/bluetooth/hci/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources_ifdef(CONFIG_BT_H4 h4.c) +zephyr_sources_ifdef(CONFIG_BT_H5 h5.c) +zephyr_sources_ifdef(CONFIG_BT_SPI spi.c) diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt new file mode 100644 index 0000000000..5052cb642b --- /dev/null +++ b/drivers/clock_control/CMakeLists.txt @@ -0,0 +1,14 @@ +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_BEETLE beetle_clock_control.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SIM clock_control_mcux_sim.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF5 nrf5_power_clock.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_QUARK_SE quark_se_clock_control.c) + +if(CONFIG_CLOCK_CONTROL_STM32_CUBE) + zephyr_sources(stm32_ll_clock.c) + + zephyr_sources_ifdef(CONFIG_SOC_SERIES_STM32F0X stm32f0x_ll_clock.c) + zephyr_sources_ifdef(CONFIG_SOC_SERIES_STM32F1X stm32f1x_ll_clock.c) + zephyr_sources_ifdef(CONFIG_SOC_SERIES_STM32F3X stm32f3x_ll_clock.c) + zephyr_sources_ifdef(CONFIG_SOC_SERIES_STM32F4X stm32f4x_ll_clock.c) + zephyr_sources_ifdef(CONFIG_SOC_SERIES_STM32L4X stm32l4x_ll_clock.c) +endif() diff --git a/drivers/console/CMakeLists.txt b/drivers/console/CMakeLists.txt new file mode 100644 index 0000000000..091ed328c9 --- /dev/null +++ b/drivers/console/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources_if_kconfig(uart_console.c) +zephyr_sources_if_kconfig(ram_console.c) +zephyr_sources_if_kconfig(rtt_console.c) +zephyr_sources_if_kconfig(ipm_console_receiver.c) +zephyr_sources_if_kconfig(ipm_console_sender.c) +zephyr_sources_if_kconfig(uart_pipe.c) +zephyr_sources_if_kconfig(telnet_console.c) +zephyr_sources_if_kconfig(xtensa_sim_console.c) diff --git a/drivers/counter/CMakeLists.txt b/drivers/counter/CMakeLists.txt new file mode 100644 index 0000000000..d4759206e9 --- /dev/null +++ b/drivers/counter/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources_ifdef(CONFIG_AON_COUNTER_QMSI counter_qmsi_aon.c) +zephyr_sources_ifdef(CONFIG_AON_TIMER_QMSI counter_qmsi_aonpt.c) +zephyr_sources_ifdef(CONFIG_COUNTER_TMR_CMSDK_APB counter_tmr_cmsdk_apb.c) +zephyr_sources_ifdef(CONFIG_TIMER_TMR_CMSDK_APB timer_tmr_cmsdk_apb.c) +zephyr_sources_ifdef(CONFIG_COUNTER_DTMR_CMSDK_APB counter_dtmr_cmsdk_apb.c) +zephyr_sources_ifdef(CONFIG_TIMER_DTMR_CMSDK_APB timer_dtmr_cmsdk_apb.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE counter_handlers.c) diff --git a/drivers/crc/CMakeLists.txt b/drivers/crc/CMakeLists.txt new file mode 100644 index 0000000000..9d538d579a --- /dev/null +++ b/drivers/crc/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(crc16_sw.c) diff --git a/drivers/display/CMakeLists.txt b/drivers/display/CMakeLists.txt new file mode 100644 index 0000000000..94a8be7b5e --- /dev/null +++ b/drivers/display/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources_ifdef(CONFIG_MICROBIT_DISPLAY + mb_display.c + mb_font.c +) diff --git a/drivers/dma/CMakeLists.txt b/drivers/dma/CMakeLists.txt new file mode 100644 index 0000000000..371b5af711 --- /dev/null +++ b/drivers/dma/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_DMA_QMSI dma_qmsi.c) +zephyr_sources_ifdef(CONFIG_DMA_STM32F4X dma_stm32f4x.c) diff --git a/drivers/entropy/CMakeLists.txt b/drivers/entropy/CMakeLists.txt new file mode 100644 index 0000000000..50654095ab --- /dev/null +++ b/drivers/entropy/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_sources_ifdef(CONFIG_ENTROPY_ESP32_RNG entropy_esp32.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_MCUX_RNGA entropy_mcux_rnga.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_MCUX_TNGA entropy_mcux_trng.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_STM32_RNG entropy_stm32_rng.c) +zephyr_sources_ifdef(CONFIG_USERSPACE entropy_handlers.c) diff --git a/drivers/ethernet/CMakeLists.txt b/drivers/ethernet/CMakeLists.txt new file mode 100644 index 0000000000..f0b92c55ae --- /dev/null +++ b/drivers/ethernet/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources_ifdef(CONFIG_ETH_SAM_GMAC + eth_sam_gmac.c + phy_sam_gmac.c + ) +zephyr_sources_ifdef(CONFIG_ETH_DW eth_dw.c) +zephyr_sources_ifdef(CONFIG_ETH_ENC28J60 eth_enc28j60.c) +zephyr_sources_ifdef(CONFIG_ETH_MCUX eth_mcux.c) +zephyr_sources_ifdef(CONFIG_ETH_STM32_HAL eth_stm32_hal.c) diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt new file mode 100644 index 0000000000..2aabfe55fa --- /dev/null +++ b/drivers/flash/CMakeLists.txt @@ -0,0 +1,27 @@ +zephyr_sources_ifdef(CONFIG_SPI_FLASH_W25QXXDV spi_flash_w25qxxdv.c) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_QMSI soc_flash_qmsi.c) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_NRF5 soc_flash_nrf5.c) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_MCUX soc_flash_mcux.c) +zephyr_sources_ifdef(CONFIG_FLASH_PAGE_LAYOUT flash_page_layout.c) +zephyr_sources_ifdef(CONFIG_USERSPACE flash_handlers.c) + +if(CONFIG_SOC_SERIES_STM32F3X) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_STM32 flash_stm32f3x.c) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_STM32 flash_stm32f3x_priv.c) +endif() + +if(CONFIG_SOC_SERIES_STM32F4X) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_STM32 + flash_stm32.c + flash_stm32f4x.c + ) +endif() + +if(CONFIG_SOC_SERIES_STM32L4X) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_STM32 + flash_stm32.c + flash_stm32l4x.c + ) +endif() + +zephyr_include_directories_ifdef(CONFIG_SOC_FLASH_NRF5_RADIO_SYNC $ENV{ZEPHYR_BASE}/subsys/bluetooth) diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt new file mode 100644 index 0000000000..3634fce4ce --- /dev/null +++ b/drivers/gpio/CMakeLists.txt @@ -0,0 +1,19 @@ +zephyr_sources_ifdef(CONFIG_GPIO_ATMEL_SAM3 gpio_atmel_sam3.c) +zephyr_sources_ifdef(CONFIG_GPIO_CC2650 gpio_cc2650.c) +zephyr_sources_ifdef(CONFIG_GPIO_CC32XX gpio_cc32xx.c) +zephyr_sources_ifdef(CONFIG_GPIO_CMSDK_AHB gpio_cmsdk_ahb.c) +zephyr_sources_ifdef(CONFIG_GPIO_DW gpio_dw.c) +zephyr_sources_ifdef(CONFIG_GPIO_ESP32 gpio_esp32.c) +zephyr_sources_ifdef(CONFIG_GPIO_FE310 gpio_fe310.c) +zephyr_sources_ifdef(CONFIG_GPIO_GECKO gpio_gecko.c) +zephyr_sources_ifdef(CONFIG_GPIO_MCUX gpio_mcux.c) +zephyr_sources_ifdef(CONFIG_GPIO_MMIO32 gpio_mmio32.c) +zephyr_sources_ifdef(CONFIG_GPIO_NRF5 gpio_nrf5.c) +zephyr_sources_ifdef(CONFIG_GPIO_PCAL9535A gpio_pcal9535a.c) +zephyr_sources_ifdef(CONFIG_GPIO_PULPINO gpio_pulpino.c) +zephyr_sources_ifdef(CONFIG_GPIO_QMSI gpio_qmsi.c) +zephyr_sources_ifdef(CONFIG_GPIO_QMSI_SS gpio_qmsi_ss.c) +zephyr_sources_ifdef(CONFIG_GPIO_SCH gpio_sch.c) +zephyr_sources_ifdef(CONFIG_GPIO_STM32 gpio_stm32.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE gpio_handlers.c) diff --git a/drivers/grove/CMakeLists.txt b/drivers/grove/CMakeLists.txt new file mode 100644 index 0000000000..ea8dd606cb --- /dev/null +++ b/drivers/grove/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources_ifdef(CONFIG_GROVE_LCD_RGB lcd_rgb.c) +zephyr_sources_ifdef(CONFIG_GROVE_LIGHT_SENSOR light_sensor.c) +zephyr_sources_ifdef(CONFIG_GROVE_TEMPERATURE_SENSOR temperature_sensor.c) diff --git a/drivers/i2c/CMakeLists.txt b/drivers/i2c/CMakeLists.txt new file mode 100644 index 0000000000..0226841ece --- /dev/null +++ b/drivers/i2c/CMakeLists.txt @@ -0,0 +1,22 @@ +zephyr_sources_ifdef(CONFIG_I2C_ATMEL_SAM3 i2c_atmel_sam3.c) +zephyr_sources_ifdef(CONFIG_I2C_BITBANG i2c_bitbang.c) +zephyr_sources_ifdef(CONFIG_I2C_DW i2c_dw.c) +zephyr_sources_ifdef(CONFIG_I2C_GPIO i2c_gpio.c) +zephyr_sources_ifdef(CONFIG_I2C_MCUX i2c_mcux.c) +zephyr_sources_ifdef(CONFIG_I2C_NRF5 i2c_nrf5.c) +zephyr_sources_ifdef(CONFIG_I2C_QMSI i2c_qmsi.c) +zephyr_sources_ifdef(CONFIG_I2C_QMSI_SS i2c_qmsi_ss.c) +zephyr_sources_ifdef(CONFIG_I2C_SAM_TWI i2c_sam_twi.c) +zephyr_sources_ifdef(CONFIG_I2C_SBCON i2c_sbcon.c) + +zephyr_sources_ifdef(CONFIG_I2C_STM32_V1x + i2c_ll_stm32_v1.c + i2c_ll_stm32.c + ) +zephyr_sources_ifdef(CONFIG_I2C_STM32_V2 + i2c_ll_stm32_v2.c + i2c_ll_stm32.c + ) +zephyr_sources_ifdef(CONFIG_TWIHS_SAM twihs_sam.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE i2c_handlers.c) diff --git a/drivers/ieee802154/CMakeLists.txt b/drivers/ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..05831add86 --- /dev/null +++ b/drivers/ieee802154/CMakeLists.txt @@ -0,0 +1,7 @@ +zephyr_sources_ifdef(CONFIG_IEEE802154_CC2520 ieee802154_cc2520.c) +zephyr_sources_ifdef(CONFIG_IEEE802154_KW41Z ieee802154_kw41z.c) +zephyr_sources_ifdef(CONFIG_IEEE802154_UPIPE ieee802154_uart_pipe.c) +zephyr_sources_ifdef(CONFIG_IEEE802154_MCR20A ieee802154_mcr20a.c) +zephyr_sources_ifdef(CONFIG_IEEE802154_MCR20A_RAW ieee802154_mcr20a.c) +zephyr_sources_ifdef(CONFIG_IEEE802154_NRF5 ieee802154_nrf5.c) +zephyr_sources_ifdef(CONFIG_IEEE802154_NRF5_RAW ieee802154_nrf5.c) diff --git a/drivers/interrupt_controller/CMakeLists.txt b/drivers/interrupt_controller/CMakeLists.txt new file mode 100644 index 0000000000..a6ebe8d9a0 --- /dev/null +++ b/drivers/interrupt_controller/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources_ifdef(CONFIG_ARCV2_INTERRUPT_UNIT arcv2_irq_unit.c) +zephyr_sources_ifdef(CONFIG_IOAPIC ioapic_intr.c) +zephyr_sources_ifdef(CONFIG_LOAPIC loapic_intr.c system_apic.c) +zephyr_sources_ifdef(CONFIG_LOAPIC_SPURIOUS_VECTOR loapic_spurious.c) +zephyr_sources_ifdef(CONFIG_MVIC mvic.c) +zephyr_sources_ifdef(CONFIG_PIC_DISABLE i8259.c) +zephyr_sources_ifdef(CONFIG_PLIC_FE310 plic_fe310.c) +zephyr_sources_ifdef(CONFIG_SOC_FAMILY_STM32 exti_stm32.c) diff --git a/drivers/ipm/CMakeLists.txt b/drivers/ipm/CMakeLists.txt new file mode 100644 index 0000000000..4ddb74798c --- /dev/null +++ b/drivers/ipm/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources_ifdef(CONFIG_IPM_QUARK_SE ipm_quark_se.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE ipm_handlers.c) diff --git a/drivers/led_strip/CMakeLists.txt b/drivers/led_strip/CMakeLists.txt new file mode 100644 index 0000000000..004a9a0f0c --- /dev/null +++ b/drivers/led_strip/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_LPD880X_STRIP lpd880x.c) +zephyr_sources_ifdef(CONFIG_WS2812_STRIP ws2812.c) diff --git a/drivers/net/CMakeLists.txt b/drivers/net/CMakeLists.txt new file mode 100644 index 0000000000..514cd8a71d --- /dev/null +++ b/drivers/net/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_SLIP slip.c) +zephyr_sources_ifdef(CONFIG_NET_LOOPBACK loopback.c) diff --git a/drivers/pci/CMakeLists.txt b/drivers/pci/CMakeLists.txt new file mode 100644 index 0000000000..4996465a38 --- /dev/null +++ b/drivers/pci/CMakeLists.txt @@ -0,0 +1,6 @@ +zephyr_sources( + pci.c + pci_config.c + pci_interface.c + ) +zephyr_sources_ifdef(CONFIG_PCI_LEGACY_BRIDGE pci_legacy_bridge.c) diff --git a/drivers/pinmux/CMakeLists.txt b/drivers/pinmux/CMakeLists.txt new file mode 100644 index 0000000000..0d55a9c27f --- /dev/null +++ b/drivers/pinmux/CMakeLists.txt @@ -0,0 +1,13 @@ +# Board initialization +zephyr_sources_ifdef(CONFIG_PINMUX_CC2650 pinmux_cc2650.c) +zephyr_sources_ifdef(CONFIG_PINMUX_DW pinmux_dw.c) +zephyr_sources_ifdef(CONFIG_PINMUX_ESP32 pinmux_esp32.c) +zephyr_sources_ifdef(CONFIG_PINMUX_FE310 pinmux_fe310.c) +zephyr_sources_ifdef(CONFIG_PINMUX_MCUX pinmux_mcux.c) +zephyr_sources_ifdef(CONFIG_PINMUX_QMSI pinmux_qmsi.c) +zephyr_sources_ifdef(CONFIG_PINMUX_STM32 stm32/pinmux_stm32.c) + +# "runtime" pinmux +add_subdirectory_ifdef(CONFIG_PINMUX_DEV dev) + +zephyr_sources_ifdef(CONFIG_USERSPACE pinmux_handlers.c) diff --git a/drivers/pwm/CMakeLists.txt b/drivers/pwm/CMakeLists.txt new file mode 100644 index 0000000000..d699176079 --- /dev/null +++ b/drivers/pwm/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_sources_ifdef(CONFIG_PWM_PCA9685 pwm_pca9685.c) +zephyr_sources_ifdef(CONFIG_PWM_DW pwm_dw.c) +zephyr_sources_ifdef(CONFIG_PWM_QMSI pwm_qmsi.c) +zephyr_sources_ifdef(CONFIG_PWM_STM32 pwm_stm32.c) +zephyr_sources_ifdef(CONFIG_PWM_NRF5_SW pwm_nrf5_sw.c) +zephyr_sources_ifdef(CONFIG_PWM_MCUX_FTM pwm_mcux_ftm.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE pwm_handlers.c) diff --git a/drivers/random_generator/CMakeLists.txt b/drivers/random_generator/CMakeLists.txt new file mode 100644 index 0000000000..a74b8142a4 --- /dev/null +++ b/drivers/random_generator/CMakeLists.txt @@ -0,0 +1,9 @@ +if(CONFIG_TIMER_RANDOM_GENERATOR) + zephyr_sources(rand32_timer.c) +else() + zephyr_sources_ifdef(CONFIG_RANDOM_ESP32_RNG random_esp32.c) + zephyr_sources_ifdef(CONFIG_RANDOM_MCUX_RNGA random_mcux_rnga.c) + zephyr_sources_ifdef(CONFIG_RANDOM_MCUX_TNGA random_mcux_trng.c) + zephyr_sources_ifdef(CONFIG_RANDOM_STM32_RNG random_stm32_rng.c) + zephyr_sources_ifdef(CONFIG_X86_TSC_RANDOM_GENERATOR rand32_timestamp.c) +endif() diff --git a/drivers/rtc/CMakeLists.txt b/drivers/rtc/CMakeLists.txt new file mode 100644 index 0000000000..722f7bebc4 --- /dev/null +++ b/drivers/rtc/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_RTC_QMSI rtc_qmsi.c) +zephyr_sources_ifdef(CONFIG_USERSPACE rtc_handlers.c) diff --git a/drivers/sensor/CMakeLists.txt b/drivers/sensor/CMakeLists.txt new file mode 100644 index 0000000000..46f6c336be --- /dev/null +++ b/drivers/sensor/CMakeLists.txt @@ -0,0 +1,37 @@ +zephyr_sources_ifdef(CONFIG_ADXL362 adxl362) +zephyr_sources_ifdef(CONFIG_AK8975 ak8975) +zephyr_sources_ifdef(CONFIG_APDS9960 apds9960) +zephyr_sources_ifdef(CONFIG_BMA280 bma280) +zephyr_sources_ifdef(CONFIG_BMC150_MAGN bmc150_magn) +zephyr_sources_ifdef(CONFIG_BME280 bme280) +zephyr_sources_ifdef(CONFIG_BMG160 bmg160) +zephyr_sources_ifdef(CONFIG_BMI160 bmi160) +zephyr_sources_ifdef(CONFIG_DHT dht) +zephyr_sources_ifdef(CONFIG_FXAS21002 fxas21002) +zephyr_sources_ifdef(CONFIG_FXOS8700 fxos8700) +zephyr_sources_ifdef(CONFIG_HDC1008 hdc1008) +zephyr_sources_ifdef(CONFIG_HMC5883L hmc5883l) +zephyr_sources_ifdef(CONFIG_HP206C hp206c) +zephyr_sources_ifdef(CONFIG_HTS221 hts221) +zephyr_sources_ifdef(CONFIG_ISL29035 isl29035) +zephyr_sources_ifdef(CONFIG_LIS2DH lis2dh) +zephyr_sources_ifdef(CONFIG_LIS3DH lis3dh) +zephyr_sources_ifdef(CONFIG_LIS3MDL lis3mdl) +zephyr_sources_ifdef(CONFIG_LPS22HB lps22hb) +zephyr_sources_ifdef(CONFIG_LPS25HB lps25hb) +zephyr_sources_ifdef(CONFIG_LSM6DS0 lsm6ds0) +zephyr_sources_ifdef(CONFIG_LSM6DSL lsm6dsl) +zephyr_sources_ifdef(CONFIG_LSM9DS0_GYRO lsm9ds0_gyro) +zephyr_sources_ifdef(CONFIG_LSM9DS0_MFD lsm9ds0_mfd) +zephyr_sources_ifdef(CONFIG_MAX30101 max30101) +zephyr_sources_ifdef(CONFIG_MAX44009 max44009) +zephyr_sources_ifdef(CONFIG_MCP9808 mcp9808) +zephyr_sources_ifdef(CONFIG_MPU6050 mpu6050) +zephyr_sources_ifdef(CONFIG_TEMP_NRF5 nrf5) +zephyr_sources_ifdef(CONFIG_SHT3XD sht3xd) +zephyr_sources_ifdef(CONFIG_SX9500 sx9500) +zephyr_sources_ifdef(CONFIG_TH02 th02) +zephyr_sources_ifdef(CONFIG_TMP007 tmp007) +zephyr_sources_ifdef(CONFIG_TMP112 tmp112) + +zephyr_sources_ifdef(CONFIG_USERSPACE sensor_handlers.c) diff --git a/drivers/sensor/adxl362/CMakeLists.txt b/drivers/sensor/adxl362/CMakeLists.txt new file mode 100644 index 0000000000..195e3c2852 --- /dev/null +++ b/drivers/sensor/adxl362/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_ADXL362 adxl362.c) diff --git a/drivers/sensor/ak8975/CMakeLists.txt b/drivers/sensor/ak8975/CMakeLists.txt new file mode 100644 index 0000000000..3913d31341 --- /dev/null +++ b/drivers/sensor/ak8975/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_AK8975 ak8975.c) diff --git a/drivers/sensor/apds9960/CMakeLists.txt b/drivers/sensor/apds9960/CMakeLists.txt new file mode 100644 index 0000000000..6a6ecb626a --- /dev/null +++ b/drivers/sensor/apds9960/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_APDS9960 apds9960.c) diff --git a/drivers/sensor/bma280/CMakeLists.txt b/drivers/sensor/bma280/CMakeLists.txt new file mode 100644 index 0000000000..1372f736f4 --- /dev/null +++ b/drivers/sensor/bma280/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_BMA280 bma280.c) +zephyr_sources_ifdef(CONFIG_BMA280_TRIGGER bma280_trigger.c) diff --git a/drivers/sensor/bmc150_magn/CMakeLists.txt b/drivers/sensor/bmc150_magn/CMakeLists.txt new file mode 100644 index 0000000000..e175586ad7 --- /dev/null +++ b/drivers/sensor/bmc150_magn/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_BMC150_MAGN bmc150_magn.c) +zephyr_sources_ifdef(CONFIG_BMC150_MAGN_TRIGGER bmc150_magn_trigger.c) diff --git a/drivers/sensor/bme280/CMakeLists.txt b/drivers/sensor/bme280/CMakeLists.txt new file mode 100644 index 0000000000..4fc11b9848 --- /dev/null +++ b/drivers/sensor/bme280/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_BME280 bme280.c) diff --git a/drivers/sensor/bmg160/CMakeLists.txt b/drivers/sensor/bmg160/CMakeLists.txt new file mode 100644 index 0000000000..7e57d4ccc9 --- /dev/null +++ b/drivers/sensor/bmg160/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_BMG160 bmg160.c) +zephyr_sources_ifdef(CONFIG_BMG160_TRIGGER bmg160_trigger.c) diff --git a/drivers/sensor/bmi160/CMakeLists.txt b/drivers/sensor/bmi160/CMakeLists.txt new file mode 100644 index 0000000000..3dc0197c1d --- /dev/null +++ b/drivers/sensor/bmi160/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_BMI160 bmi160.c) +zephyr_sources_ifdef(CONFIG_BMI160_TRIGGER bmi160_trigger.c) diff --git a/drivers/sensor/dht/CMakeLists.txt b/drivers/sensor/dht/CMakeLists.txt new file mode 100644 index 0000000000..8d30a9e447 --- /dev/null +++ b/drivers/sensor/dht/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_DHT dht.c) diff --git a/drivers/sensor/fxas21002/CMakeLists.txt b/drivers/sensor/fxas21002/CMakeLists.txt new file mode 100644 index 0000000000..acd1804996 --- /dev/null +++ b/drivers/sensor/fxas21002/CMakeLists.txt @@ -0,0 +1,9 @@ +# Makefile - FXAS21002 3-axis gyroscope +# +# Copyright (c) 2017, NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +zephyr_sources_ifdef(CONFIG_FXAS21002 fxas21002.c) +zephyr_sources_ifdef(CONFIG_FXAS21002_TRIGGER fxas21002_trigger.c) diff --git a/drivers/sensor/fxos8700/CMakeLists.txt b/drivers/sensor/fxos8700/CMakeLists.txt new file mode 100644 index 0000000000..f168f1db91 --- /dev/null +++ b/drivers/sensor/fxos8700/CMakeLists.txt @@ -0,0 +1,9 @@ +# Makefile - FXOS8700 6-axis accelerometer/magnetometer +# +# Copyright (c) 2016, Freescale Semiconductor, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +zephyr_sources_ifdef(CONFIG_FXOS8700 fxos8700.c) +zephyr_sources_ifdef(CONFIG_FXOS8700_TRIGGER fxos8700_trigger.c) diff --git a/drivers/sensor/hdc1008/CMakeLists.txt b/drivers/sensor/hdc1008/CMakeLists.txt new file mode 100644 index 0000000000..7c43a23096 --- /dev/null +++ b/drivers/sensor/hdc1008/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_HDC1008 hdc1008.c) diff --git a/drivers/sensor/hmc5883l/CMakeLists.txt b/drivers/sensor/hmc5883l/CMakeLists.txt new file mode 100644 index 0000000000..80d11274e8 --- /dev/null +++ b/drivers/sensor/hmc5883l/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_HMC5883L hmc5883l.c) +zephyr_sources_ifdef(CONFIG_HMC5883L_TRIGGER hmc5883l_trigger.c) diff --git a/drivers/sensor/hp206c/CMakeLists.txt b/drivers/sensor/hp206c/CMakeLists.txt new file mode 100644 index 0000000000..d81e88cbbf --- /dev/null +++ b/drivers/sensor/hp206c/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_HP206C hp206c.c) diff --git a/drivers/sensor/hts221/CMakeLists.txt b/drivers/sensor/hts221/CMakeLists.txt new file mode 100644 index 0000000000..c6290b398e --- /dev/null +++ b/drivers/sensor/hts221/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_HTS221 hts221.c) +zephyr_sources_ifdef(CONFIG_HTS221_TRIGGER hts221_trigger.c) diff --git a/drivers/sensor/isl29035/CMakeLists.txt b/drivers/sensor/isl29035/CMakeLists.txt new file mode 100644 index 0000000000..39ddccea8b --- /dev/null +++ b/drivers/sensor/isl29035/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_ISL29035 isl29035.c) +zephyr_sources_ifdef(CONFIG_ISL29035_TRIGGER isl29035_trigger.c) diff --git a/drivers/sensor/lis2dh/CMakeLists.txt b/drivers/sensor/lis2dh/CMakeLists.txt new file mode 100644 index 0000000000..25dc19ff37 --- /dev/null +++ b/drivers/sensor/lis2dh/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_LIS2DH lis2dh.c) +zephyr_sources_ifdef(CONFIG_LIS2DH_TRIGGER lis2dh_trigger.c) diff --git a/drivers/sensor/lis3dh/CMakeLists.txt b/drivers/sensor/lis3dh/CMakeLists.txt new file mode 100644 index 0000000000..59111af732 --- /dev/null +++ b/drivers/sensor/lis3dh/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_LIS3DH lis3dh.c) +zephyr_sources_ifdef(CONFIG_LIS3DH_TRIGGER lis3dh_trigger.c) diff --git a/drivers/sensor/lis3mdl/CMakeLists.txt b/drivers/sensor/lis3mdl/CMakeLists.txt new file mode 100644 index 0000000000..645adada76 --- /dev/null +++ b/drivers/sensor/lis3mdl/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_LIS3MDL lis3mdl.c) +zephyr_sources_ifdef(CONFIG_LIS3MDL_TRIGGER lis3mdl_trigger.c) diff --git a/drivers/sensor/lps22hb/CMakeLists.txt b/drivers/sensor/lps22hb/CMakeLists.txt new file mode 100644 index 0000000000..df0a2b98f1 --- /dev/null +++ b/drivers/sensor/lps22hb/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_LPS22HB lps22hb.c) diff --git a/drivers/sensor/lps25hb/CMakeLists.txt b/drivers/sensor/lps25hb/CMakeLists.txt new file mode 100644 index 0000000000..fe3649859b --- /dev/null +++ b/drivers/sensor/lps25hb/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_LPS25HB lps25hb.c) diff --git a/drivers/sensor/lsm6ds0/CMakeLists.txt b/drivers/sensor/lsm6ds0/CMakeLists.txt new file mode 100644 index 0000000000..e6de309855 --- /dev/null +++ b/drivers/sensor/lsm6ds0/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_LSM6DS0 lsm6ds0.c) diff --git a/drivers/sensor/lsm6dsl/CMakeLists.txt b/drivers/sensor/lsm6dsl/CMakeLists.txt new file mode 100644 index 0000000000..8cd718270e --- /dev/null +++ b/drivers/sensor/lsm6dsl/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_LSM6DSL lsm6dsl.c) diff --git a/drivers/sensor/lsm9ds0_gyro/CMakeLists.txt b/drivers/sensor/lsm9ds0_gyro/CMakeLists.txt new file mode 100644 index 0000000000..bed94f8944 --- /dev/null +++ b/drivers/sensor/lsm9ds0_gyro/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_LSM9DS0_GYRO lsm9ds0_gyro.c) +zephyr_sources_ifdef(CONFIG_LSM9DS0_GYRO_TRIGGER_DRDY lsm9ds0_gyro_trigger.c) diff --git a/drivers/sensor/lsm9ds0_mfd/CMakeLists.txt b/drivers/sensor/lsm9ds0_mfd/CMakeLists.txt new file mode 100644 index 0000000000..fec4edad32 --- /dev/null +++ b/drivers/sensor/lsm9ds0_mfd/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_LSM9DS0_MFD lsm9ds0_mfd.c) diff --git a/drivers/sensor/max30101/CMakeLists.txt b/drivers/sensor/max30101/CMakeLists.txt new file mode 100644 index 0000000000..6a06728a06 --- /dev/null +++ b/drivers/sensor/max30101/CMakeLists.txt @@ -0,0 +1,8 @@ +# Makefile - MAX30101 heart rate sensor +# +# Copyright (c) 2017, NXP +# +# SPDX-License-Identifier: Apache-2.0 +# + +zephyr_sources_ifdef(CONFIG_MAX30101 max30101.c) diff --git a/drivers/sensor/max44009/CMakeLists.txt b/drivers/sensor/max44009/CMakeLists.txt new file mode 100644 index 0000000000..1e1cf7049a --- /dev/null +++ b/drivers/sensor/max44009/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_MAX44009 max44009.c) diff --git a/drivers/sensor/mcp9808/CMakeLists.txt b/drivers/sensor/mcp9808/CMakeLists.txt new file mode 100644 index 0000000000..a91ed4161a --- /dev/null +++ b/drivers/sensor/mcp9808/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_MCP9808 mcp9808.c) +zephyr_sources_ifdef(CONFIG_MCP9808_TRIGGER mcp9808_trigger.c) diff --git a/drivers/sensor/mpu6050/CMakeLists.txt b/drivers/sensor/mpu6050/CMakeLists.txt new file mode 100644 index 0000000000..a7849708bb --- /dev/null +++ b/drivers/sensor/mpu6050/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_MPU6050 mpu6050.c) +zephyr_sources_ifdef(CONFIG_MPU6050_TRIGGER mpu6050_trigger.c) diff --git a/drivers/sensor/nrf5/CMakeLists.txt b/drivers/sensor/nrf5/CMakeLists.txt new file mode 100644 index 0000000000..3655e23816 --- /dev/null +++ b/drivers/sensor/nrf5/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_TEMP_NRF5 temp_nrf5.c) diff --git a/drivers/sensor/sht3xd/CMakeLists.txt b/drivers/sensor/sht3xd/CMakeLists.txt new file mode 100644 index 0000000000..b79e6ec796 --- /dev/null +++ b/drivers/sensor/sht3xd/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_SHT3XD sht3xd.c) +zephyr_sources_ifdef(CONFIG_SHT3XD_TRIGGER sht3xd_trigger.c) diff --git a/drivers/sensor/sx9500/CMakeLists.txt b/drivers/sensor/sx9500/CMakeLists.txt new file mode 100644 index 0000000000..5bb5c20b0b --- /dev/null +++ b/drivers/sensor/sx9500/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_SX9500 sx9500.c) +zephyr_sources_ifdef(CONFIG_SX9500_TRIGGER sx9500_trigger.c) diff --git a/drivers/sensor/th02/CMakeLists.txt b/drivers/sensor/th02/CMakeLists.txt new file mode 100644 index 0000000000..aca6405276 --- /dev/null +++ b/drivers/sensor/th02/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources(th02.c) diff --git a/drivers/sensor/tmp007/CMakeLists.txt b/drivers/sensor/tmp007/CMakeLists.txt new file mode 100644 index 0000000000..af4b732eb7 --- /dev/null +++ b/drivers/sensor/tmp007/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_TMP007 tmp007.c) +zephyr_sources_ifdef(CONFIG_TMP007_TRIGGER tmp007_trigger.c) diff --git a/drivers/sensor/tmp112/CMakeLists.txt b/drivers/sensor/tmp112/CMakeLists.txt new file mode 100644 index 0000000000..1e843d8b50 --- /dev/null +++ b/drivers/sensor/tmp112/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_TMP112 tmp112.c) diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt new file mode 100644 index 0000000000..7de1493cb6 --- /dev/null +++ b/drivers/serial/CMakeLists.txt @@ -0,0 +1,18 @@ +zephyr_sources_if_kconfig(uart_altera_jtag.c) +zephyr_sources_if_kconfig(uart_atmel_sam3.c) +zephyr_sources_if_kconfig(uart_cc32.c) +zephyr_sources_if_kconfig(uart_cmsdk_apb.c) +zephyr_sources_if_kconfig(uart_gecko.c) +zephyr_sources_if_kconfig(uart_mcux.c) +zephyr_sources_if_kconfig(uart_mcux_lpuart.c) +zephyr_sources_if_kconfig(uart_msp432p4xx.c) +zephyr_sources_if_kconfig(uart_nrf5.c) +zephyr_sources_if_kconfig(uart_ns16550.c) +zephyr_sources_if_kconfig(uart_nsim.c) +zephyr_sources_if_kconfig(uart_qmsi.c) +zephyr_sources_if_kconfig(uart_riscv_qemu.c) +zephyr_sources_if_kconfig(uart_sam.c) +zephyr_sources_if_kconfig(uart_stellaris.c) +zephyr_sources_if_kconfig(uart_stm32.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE uart_handlers.c) diff --git a/drivers/shared_irq/CMakeLists.txt b/drivers/shared_irq/CMakeLists.txt new file mode 100644 index 0000000000..c85dd01511 --- /dev/null +++ b/drivers/shared_irq/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_if_kconfig(shared_irq.c) diff --git a/drivers/slip/CMakeLists.txt b/drivers/slip/CMakeLists.txt new file mode 100644 index 0000000000..e7fc57d853 --- /dev/null +++ b/drivers/slip/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_if_kconfig(slip.c) diff --git a/drivers/spi/CMakeLists.txt b/drivers/spi/CMakeLists.txt new file mode 100644 index 0000000000..25ce1ae07b --- /dev/null +++ b/drivers/spi/CMakeLists.txt @@ -0,0 +1,14 @@ +if(CONFIG_SPI_LEGACY_API) + zephyr_sources_ifdef(CONFIG_SPI_DW spi_dw_legacy.c) + zephyr_sources_ifdef(CONFIG_SPIM_NRF52 spim_nrf52_legacy.c) + zephyr_sources_ifdef(CONFIG_SPIS_NRF5 spis_nrf5_legacy.c) +else() + zephyr_sources_ifdef(CONFIG_SPI_DW spi_dw.c) +endif() +zephyr_sources_ifdef(CONFIG_SPI_INTEL spi_intel.c) +zephyr_sources_ifdef(CONFIG_SPI_MCUX_DSPI spi_mcux_dspi.c) +zephyr_sources_ifdef(CONFIG_SPI_QMSI spi_qmsi.c) +zephyr_sources_ifdef(CONFIG_SPI_QMSI_SS spi_qmsi_ss.c) +zephyr_sources_ifdef(CONFIG_SPI_STM32 spi_ll_stm32.c) + +zephyr_sources_ifdef(CONFIG_USERSPACE spi_handlers.c) diff --git a/drivers/timer/CMakeLists.txt b/drivers/timer/CMakeLists.txt new file mode 100644 index 0000000000..cb851fa60a --- /dev/null +++ b/drivers/timer/CMakeLists.txt @@ -0,0 +1,10 @@ +zephyr_sources( sys_clock_init.c) +zephyr_sources_ifdef(CONFIG_HPET_TIMER hpet.c) +zephyr_sources_ifdef(CONFIG_ARCV2_TIMER arcv2_timer0.c) +zephyr_sources_if_kconfig( loapic_timer.c) +zephyr_sources_if_kconfig( altera_avalon_timer.c) +zephyr_sources_if_kconfig( nrf_rtc_timer.c) +zephyr_sources_if_kconfig( pulpino_timer.c) +zephyr_sources_if_kconfig( riscv_machine_timer.c) +zephyr_sources_if_kconfig( cortex_m_systick.c) +zephyr_sources_ifdef(CONFIG_XTENSA_TIMER xtensa_sys_timer.c) diff --git a/drivers/usb/CMakeLists.txt b/drivers/usb/CMakeLists.txt new file mode 100644 index 0000000000..69f8ef7aab --- /dev/null +++ b/drivers/usb/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_USB device) diff --git a/drivers/usb/device/CMakeLists.txt b/drivers/usb/device/CMakeLists.txt new file mode 100644 index 0000000000..078742d5e5 --- /dev/null +++ b/drivers/usb/device/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_USB_DW usb_dc_dw.c) +zephyr_sources_ifdef(CONFIG_USB_DC_STM32 usb_dc_stm32.c) diff --git a/drivers/watchdog/CMakeLists.txt b/drivers/watchdog/CMakeLists.txt new file mode 100644 index 0000000000..18204d3094 --- /dev/null +++ b/drivers/watchdog/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_sources_ifdef(CONFIG_WDT_QMSI wdt_qmsi.c) +zephyr_sources_ifdef(CONFIG_IWDG_STM32 iwdg_stm32.c) +zephyr_sources_ifdef(CONFIG_WDOG_CMSDK_APB wdog_cmsdk_apb.c) +zephyr_sources_ifdef(CONFIG_WDT_SAM wdt_sam.c) +zephyr_sources_ifdef(CONFIG_WDT_ESP32 wdt_esp32.c) diff --git a/dts/dts.cmake b/dts/dts.cmake new file mode 100644 index 0000000000..eccecefb64 --- /dev/null +++ b/dts/dts.cmake @@ -0,0 +1,129 @@ +# Zephyr code can configure itself based on a KConfig'uration with the +# header file autoconf.h. There exists an analogous file +# generated_dts_board.h that allows configuration based on information +# encoded in DTS. +# +# Here we call on dtc, the gcc preprocessor, and +# scripts/dts/extract_dts_includes.py to generate this header file at +# CMake configure-time. +# +# See ~/zephyr/doc/dts +set(GENERATED_DTS_BOARD_H ${PROJECT_BINARY_DIR}/include/generated/generated_dts_board.h) +set(GENERATED_DTS_BOARD_CONF ${PROJECT_BINARY_DIR}/include/generated/generated_dts_board.conf) +set(DTS_SOURCE ${PROJECT_SOURCE_DIR}/dts/${ARCH}/${BOARD_FAMILY}.dts) + +message(STATUS "Generating zephyr/include/generated/generated_dts_board.h") + +if(CONFIG_HAS_DTS) + + set(DTC_INCLUDE_FLAG_FOR_SOURCE + -include ${DTS_SOURCE} + ) + + if(NOT DTC_OVERLAY_FILE) + # overlay file is not set, so try to use overlay dir instead. + + set_ifndef(DTC_OVERLAY_DIR ${APPLICATION_SOURCE_DIR}) + + set(DTC_OVERLAY_FILE ${DTC_OVERLAY_DIR}/${BOARD_FAMILY}.overlay) + endif() + + if(EXISTS ${DTC_OVERLAY_FILE}) + set(DTC_INCLUDE_FLAG_FOR_OVERLAY + -include ${DTC_OVERLAY_FILE} + ) + else() + unset(DTC_INCLUDE_FLAG_FOR_OVERLAY) + endif() + + # TODO: Cut down on CMake configuration time by avoiding + # regeneration of generated_dts_board.h on every configure. How + # challenging is this? What are the dts dependencies? We run the + # preprocessor, and it seems to be including all kinds of + # directories with who-knows how many header files. + + # Run the C preprocessor on an empty C source file that has one or + # more DTS source files -include'd into it to create the + # intermediary file *.dts.pre.tmp + execute_process( + COMMAND ${CMAKE_C_COMPILER} + -x assembler-with-cpp + -nostdinc + -I${PROJECT_SOURCE_DIR}/arch/${ARCH}/soc + -isystem ${PROJECT_SOURCE_DIR}/include + -isystem ${PROJECT_SOURCE_DIR}/dts/${ARCH} + -isystem ${PROJECT_SOURCE_DIR}/dts + -include ${AUTOCONF_H} + ${DTC_INCLUDE_FLAG_FOR_SOURCE} # include the DTS source + ${DTC_INCLUDE_FLAG_FOR_OVERLAY} # Possibly include an overlay after the source + -I${PROJECT_SOURCE_DIR}/dts/common + -I${PROJECT_SOURCE_DIR}/drivers + -undef -D__DTS__ + -P + -E $ENV{ZEPHYR_BASE}/misc/empty_file.c + -o ${BOARD_FAMILY}.dts.pre.tmp + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + endif() + + # Run the DTC on *.dts.pre.tmp to create the intermediary file *.dts_compiled + execute_process( + COMMAND ${DTC} + -O dts + -o ${BOARD_FAMILY}.dts_compiled + -b 0 + ${BOARD_FAMILY}.dts.pre.tmp + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + endif() + + # Run extract_dts_includes.py for the header file + # generated_dts_board.h + set(FIXUP_FILE ${PROJECT_SOURCE_DIR}/dts/${ARCH}/${BOARD_FAMILY}.fixup) + if(EXISTS ${FIXUP_FILE}) + set(FIXUP -f ${FIXUP_FILE}) + endif() + set(CMD_EXTRACT_DTS_INCLUDES ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/dts/extract_dts_includes.py + --dts ${BOARD_FAMILY}.dts_compiled + --yaml ${PROJECT_SOURCE_DIR}/dts/bindings + ${FIXUP} + ) + execute_process( + COMMAND ${CMD_EXTRACT_DTS_INCLUDES} + OUTPUT_VARIABLE STDOUT + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + endif() + + # extract_dts_includes.py writes the header file contents to stdout, + # which we capture in the variable STDOUT and then finaly write into + # the header file. + file(WRITE ${GENERATED_DTS_BOARD_H} "${STDOUT}" ) + + # Run extract_dts_includes.py to create a .conf file that can be + # included into the CMake namespace + execute_process( + COMMAND ${CMD_EXTRACT_DTS_INCLUDES} --keyvalue + OUTPUT_VARIABLE STDOUT + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + endif() + + file(WRITE ${GENERATED_DTS_BOARD_CONF} "${STDOUT}" ) + import_kconfig(${GENERATED_DTS_BOARD_CONF}) + +else() + file(WRITE ${GENERATED_DTS_BOARD_H} "/* WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY! */") +endif() diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt new file mode 100644 index 0000000000..d39f5d1f76 --- /dev/null +++ b/ext/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(lib) +add_subdirectory(hal) +add_subdirectory_ifdef(CONFIG_FILE_SYSTEM fs) +add_subdirectory(debug) diff --git a/ext/debug/CMakeLists.txt b/ext/debug/CMakeLists.txt new file mode 100644 index 0000000000..d79660b820 --- /dev/null +++ b/ext/debug/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_HAS_SEGGER_RTT segger) diff --git a/ext/debug/segger/CMakeLists.txt b/ext/debug/segger/CMakeLists.txt new file mode 100644 index 0000000000..f2341a8096 --- /dev/null +++ b/ext/debug/segger/CMakeLists.txt @@ -0,0 +1,4 @@ + +zephyr_include_directories(.) +zephyr_sources_ifdef(CONFIG_HAS_SEGGER_RTT rtt/SEGGER_RTT.c) +zephyr_sources_ifdef(CONFIG_HAS_SEGGER_SYSTEMVIEW systemview/SEGGER_SYSVIEW.c) diff --git a/ext/fs/CMakeLists.txt b/ext/fs/CMakeLists.txt new file mode 100644 index 0000000000..4dc54c5bd7 --- /dev/null +++ b/ext/fs/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory_ifdef(CONFIG_FAT_FILESYSTEM_ELM fat) +add_subdirectory_ifdef(CONFIG_FILE_SYSTEM_NFFS nffs) diff --git a/ext/fs/fat/CMakeLists.txt b/ext/fs/fat/CMakeLists.txt new file mode 100644 index 0000000000..67faf80ac2 --- /dev/null +++ b/ext/fs/fat/CMakeLists.txt @@ -0,0 +1,11 @@ +add_library(ELMFAT INTERFACE) + +target_include_directories(ELMFAT INTERFACE include) + +zephyr_library() +zephyr_library_sources( + ff.c + zfs_diskio.c + ) +zephyr_library_link_libraries(ELMFAT) +target_link_libraries(ELMFAT INTERFACE zephyr_interface) diff --git a/ext/fs/nffs/CMakeLists.txt b/ext/fs/nffs/CMakeLists.txt new file mode 100644 index 0000000000..e08a9a3dd7 --- /dev/null +++ b/ext/fs/nffs/CMakeLists.txt @@ -0,0 +1,25 @@ +add_library(NFFS INTERFACE) + +target_include_directories(NFFS INTERFACE include) + +zephyr_library() +zephyr_library_sources( + src/nffs_area.c + src/nffs_block.c + src/nffs.c + src/nffs_cache.c + src/nffs_crc.c + src/nffs_dir.c + src/nffs_file.c + src/nffs_flash.c + src/nffs_format.c + src/nffs_gc.c + src/nffs_hash.c + src/nffs_inode.c + src/nffs_misc.c + src/nffs_path.c + src/nffs_restore.c + src/nffs_write.c + ) +zephyr_library_link_libraries(NFFS) +target_link_libraries(NFFS INTERFACE zephyr_interface) diff --git a/ext/hal/CMakeLists.txt b/ext/hal/CMakeLists.txt new file mode 100644 index 0000000000..33ebcb800e --- /dev/null +++ b/ext/hal/CMakeLists.txt @@ -0,0 +1,9 @@ +add_subdirectory(atmel) +add_subdirectory(cmsis) +add_subdirectory(nordic) +add_subdirectory(nxp) +add_subdirectory_if_kconfig(qmsi) +add_subdirectory_ifdef(CONFIG_HAS_STM32CUBE st) +add_subdirectory(ti) +add_subdirectory(silabs) +add_subdirectory(esp) diff --git a/ext/hal/atmel/CMakeLists.txt b/ext/hal/atmel/CMakeLists.txt new file mode 100644 index 0000000000..82945cd564 --- /dev/null +++ b/ext/hal/atmel/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_if_kconfig(asf) diff --git a/ext/hal/atmel/asf/CMakeLists.txt b/ext/hal/atmel/asf/CMakeLists.txt new file mode 100644 index 0000000000..96ff24ef0e --- /dev/null +++ b/ext/hal/atmel/asf/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SAM sam) diff --git a/ext/hal/atmel/asf/sam/CMakeLists.txt b/ext/hal/atmel/asf/sam/CMakeLists.txt new file mode 100644 index 0000000000..81c5d0bfc7 --- /dev/null +++ b/ext/hal/atmel/asf/sam/CMakeLists.txt @@ -0,0 +1,7 @@ +# Makefile - Atmel SAM SDK +# +# Copyright (c) 2016 Piotr Mienkowski +# SPDX-License-Identifier: Apache-2.0 +# + +add_subdirectory(include) diff --git a/ext/hal/atmel/asf/sam/include/CMakeLists.txt b/ext/hal/atmel/asf/sam/include/CMakeLists.txt new file mode 100644 index 0000000000..d273adb82b --- /dev/null +++ b/ext/hal/atmel/asf/sam/include/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_include_directories(${CONFIG_SOC_SERIES}) diff --git a/ext/hal/cmsis/CMakeLists.txt b/ext/hal/cmsis/CMakeLists.txt new file mode 100644 index 0000000000..76313b4dd7 --- /dev/null +++ b/ext/hal/cmsis/CMakeLists.txt @@ -0,0 +1,3 @@ +if(CONFIG_HAS_CMSIS) + zephyr_include_directories(Include) +endif() diff --git a/ext/hal/esp/CMakeLists.txt b/ext/hal/esp/CMakeLists.txt new file mode 100644 index 0000000000..353c5f6748 --- /dev/null +++ b/ext/hal/esp/CMakeLists.txt @@ -0,0 +1,22 @@ +# At the moment there is only one supported ESP32 SoC, and it is not +# supported to omit the esp-dif HAL library, so we don't check for a +# KConfig option to enable the HAL +# +# In the future it might look like this: +# if(CONFIG_ESP_DIF_LIBRARY) +# to allow users to disable the HAL +if(CONFIG_SOC_ESP32) + set_ifndef(ESP_IDF_PATH $ENV{ESP_IDF_PATH}) + set( ESP_IDF_PATH ${ESP_IDF_PATH} CACHE PATH "") + assert( ESP_IDF_PATH "ESP_IDF_PATH is not set") + + zephyr_include_directories( + ${ESP_IDF_PATH}/components/esp32/include + ${ESP_IDF_PATH}/components/soc/esp32/include + ) + + zephyr_link_libraries( + hal + -L${ESP_IDF_PATH}/components/esp32 + ) +endif() diff --git a/ext/hal/nordic/CMakeLists.txt b/ext/hal/nordic/CMakeLists.txt new file mode 100644 index 0000000000..93effb0d5d --- /dev/null +++ b/ext/hal/nordic/CMakeLists.txt @@ -0,0 +1,13 @@ +if(CONFIG_HAS_NORDIC_MDK) + zephyr_include_directories(mdk) +endif() + +if(CONFIG_HAS_NORDIC_HAL) + zephyr_include_directories(hal) +endif() + +if(CONFIG_HAS_NORDIC_DRIVERS) + zephyr_include_directories(drivers) + + add_subdirectory(drivers) +endif() diff --git a/ext/hal/nordic/drivers/CMakeLists.txt b/ext/hal/nordic/drivers/CMakeLists.txt new file mode 100644 index 0000000000..7cb47fba0f --- /dev/null +++ b/ext/hal/nordic/drivers/CMakeLists.txt @@ -0,0 +1,38 @@ +if(CONFIG_IEEE802154_NRF5 OR CONFIG_IEEE802154_NRF5_RAW) + zephyr_sources(nrf_drv_radio802154.c) + + if( CONFIG_IEEE802154_NRF5_CCA_MODE_ED) + set(radio_cca_mode NRF_RADIO_CCA_MODE_ED) + + elseif( CONFIG_IEEE802154_NRF5_CCA_MODE_CARRIER) + set(radio_cca_mode NRF_RADIO_CCA_MODE_CARRIER) + + elseif( CONFIG_IEEE802154_NRF5_CCA_MODE_CARRIER_AND_ED) + set(radio_cca_mode NRF_RADIO_CCA_MODE_CARRIER_AND_ED) + + elseif( CONFIG_IEEE802154_NRF5_CCA_MODE_CARRIER_OR_ED) + set(radio_cca_mode NRF_RADIO_CCA_MODE_CARRIER_OR_ED) + + endif() + + zephyr_compile_definitions( + # Number of slots containing short addresses of nodes for which + # pending data is stored. + RADIO_PENDING_SHORT_ADDRESSES=1 + + # Number of slots containing extended addresses of nodes for which + # pending data is stored. + RADIO_PENDING_EXTENDED_ADDRESSES=1 + + # Number of buffers in receive queue. + RADIO_RX_BUFFERS=1 + + # CCA mode + RADIO_CCA_MODE=${radio_cca_mode} + + # CCA mode options + RADIO_CCA_CORR_LIMIT=${CONFIG_IEEE802154_NRF5_CCA_CORR_LIMIT} + RADIO_CCA_CORR_THRESHOLD=${CONFIG_IEEE802154_NRF5_CCA_CORR_THRESHOLD} + RADIO_CCA_ED_THRESHOLD=${CONFIG_IEEE802154_NRF5_CCA_ED_THRESHOLD} + ) +endif() diff --git a/ext/hal/nxp/CMakeLists.txt b/ext/hal/nxp/CMakeLists.txt new file mode 100644 index 0000000000..f91f18b0b4 --- /dev/null +++ b/ext/hal/nxp/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory_ifdef( + CONFIG_HAS_MCUX + mcux + ) diff --git a/ext/hal/nxp/mcux/CMakeLists.txt b/ext/hal/nxp/mcux/CMakeLists.txt new file mode 100644 index 0000000000..9870196424 --- /dev/null +++ b/ext/hal/nxp/mcux/CMakeLists.txt @@ -0,0 +1,28 @@ +# Translate the SoC name and part number into the mcux device and cpu +# name respectively. +string(TOUPPER ${CONFIG_SOC} MCUX_DEVICE) + +set(MCUX_CPU CPU_${CONFIG_SOC_PART_NUMBER}) + +zephyr_include_directories(devices/${MCUX_DEVICE}) + +# The mcux uses the cpu name to expose SoC-specific features of a +# given peripheral. For example, the UART peripheral may be +# instantiated with/without a hardware FIFO, and the size of that FIFO +# may be different for each instance in a given SoC. See +# fsl_device_registers.h and ${MCUX_DEVICE}_features.h +zephyr_compile_definitions(${MCUX_CPU}) + +# Build mcux device-specific objects. Although it is not normal +# practice, drilling down like this avoids the need for repetitive +# build scripts for every mcux device. +zephyr_sources(devices/${MCUX_DEVICE}/fsl_clock.c) + +# Build mcux drivers that can be used for multiple SoC's. +add_subdirectory(components) +add_subdirectory(drivers) + +add_subdirectory_ifdef( + CONFIG_IEEE802154_KW41Z + middleware/wireless/framework_5.3.3 + ) diff --git a/ext/hal/nxp/mcux/components/CMakeLists.txt b/ext/hal/nxp/mcux/components/CMakeLists.txt new file mode 100644 index 0000000000..b21d57804b --- /dev/null +++ b/ext/hal/nxp/mcux/components/CMakeLists.txt @@ -0,0 +1,9 @@ +if(CONFIG_IEEE802154_MCR20A) + zephyr_include_directories(mcr20a) +endif() + +if(CONFIG_ETH_MCUX) + zephyr_include_directories(phyksz8081) +endif() + +zephyr_sources_ifdef(CONFIG_ETH_MCUX phyksz8081/fsl_phy.c) diff --git a/ext/hal/nxp/mcux/drivers/CMakeLists.txt b/ext/hal/nxp/mcux/drivers/CMakeLists.txt new file mode 100644 index 0000000000..a3726482b2 --- /dev/null +++ b/ext/hal/nxp/mcux/drivers/CMakeLists.txt @@ -0,0 +1,13 @@ +zephyr_include_directories(.) + +zephyr_sources_ifdef(CONFIG_ADC_MCUX_ADC16 fsl_adc16.c) +zephyr_sources_ifdef(CONFIG_ETH_MCUX fsl_enet.c) +zephyr_sources_ifdef(CONFIG_I2C_MCUX fsl_i2c.c) +zephyr_sources_ifdef(CONFIG_PWM_MCUX_FTM fsl_ftm.c) +zephyr_sources_ifdef(CONFIG_RANDOM_MCUX_RNGA fsl_rnga.c) +zephyr_sources_ifdef(CONFIG_RANDOM_MCUX_TRNG fsl_trng.c) +zephyr_sources_ifdef(CONFIG_SOC_FLASH_MCUX fsl_flash.c) +zephyr_sources_ifdef(CONFIG_SPI_MCUX_DSPI fsl_dspi.c) +zephyr_sources_ifdef(CONFIG_UART_MCUX fsl_uart.c) +zephyr_sources_ifdef(CONFIG_UART_MCUX_LPSCI fsl_lpsci.c) +zephyr_sources_ifdef(CONFIG_UART_MCUX_LPUART fsl_lpuart.c) diff --git a/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/CMakeLists.txt b/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/CMakeLists.txt new file mode 100644 index 0000000000..12abb94b76 --- /dev/null +++ b/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/CMakeLists.txt @@ -0,0 +1,7 @@ +zephyr_include_directories(Common) +zephyr_include_directories(OSAbstraction/Interface) +zephyr_include_directories(XCVR/${MCUX_DEVICE}) + +add_subdirectory(XCVR/${MCUX_DEVICE}) + +zephyr_sources(OSAbstraction/Source/fsl_os_abstraction_zephyr.c) diff --git a/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW40Z4/CMakeLists.txt b/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW40Z4/CMakeLists.txt new file mode 100644 index 0000000000..9df2787775 --- /dev/null +++ b/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW40Z4/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_sources( + ifr_mkw40z4_radio.c + KW4xXcvrDrv.c + tsm_ll_timing.c +) diff --git a/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW41Z4/CMakeLists.txt b/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW41Z4/CMakeLists.txt new file mode 100644 index 0000000000..c9cb593464 --- /dev/null +++ b/ext/hal/nxp/mcux/middleware/wireless/framework_5.3.3/XCVR/MKW41Z4/CMakeLists.txt @@ -0,0 +1,18 @@ +zephyr_sources( + cfgs_kw4x_3x_2x/fsl_xcvr_ant_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_ble_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_common_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_gfsk_bt_0p3_h_0p5_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_gfsk_bt_0p5_h_0p32_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_gfsk_bt_0p5_h_0p5_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_gfsk_bt_0p5_h_0p7_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_gfsk_bt_0p5_h_1p0_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_gfsk_bt_0p7_h_0p5_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_mode_datarate_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_msk_config.c + cfgs_kw4x_3x_2x/fsl_xcvr_zgbe_config.c + dbg_ram_capture.c + fsl_xcvr.c + fsl_xcvr_trim.c + ifr_radio.c +) diff --git a/ext/hal/qmsi/CMakeLists.txt b/ext/hal/qmsi/CMakeLists.txt new file mode 100644 index 0000000000..b4d68f47c3 --- /dev/null +++ b/ext/hal/qmsi/CMakeLists.txt @@ -0,0 +1,71 @@ +zephyr_library() + +zephyr_compile_definitions( ENABLE_EXTERNAL_ISR_HANDLING) +zephyr_compile_definitions_ifdef(CONFIG_SYS_POWER_DEEP_SLEEP ENABLE_RESTORE_CONTEXT) + +if(CONFIG_QMSI_LIBRARY) + zephyr_include_directories( + ${CONFIG_QMSI_INSTALL_PATH}/include + ) + + zephyr_link_libraries( + qmsi + -L${CONFIG_QMSI_INSTALL_PATH}/lib + ) +endif() + +if(CONFIG_SOC_QUARK_SE_C1000_SS) +set(SOC_SERIES quark_se) +endif() + +if(CONFIG_QMSI_BUILTIN) + zephyr_include_directories( + include + drivers/include + ) + zephyr_include_directories_ifdef(CONFIG_ARC drivers/sensor/include) + zephyr_include_directories( soc/${SOC_SERIES}/include) +endif() + +set_ifndef(SOC_WATCH_ENABLE 0) +if(CONFIG_SOC_WATCH) + set(SOC_WATCH_ENABLE 1) + zephyr_compile_definitions(SOC_WATCH_ENABLE) +endif() + +if(CONFIG_QMSI_BUILTIN) + zephyr_library_sources( + drivers/flash/qm_flash.c + soc/${SOC_SERIES}/drivers/power_states.c + soc/${SOC_SERIES}/drivers/clk.c + ) + if(CONFIG_SOC_QUARK_SE_C1000_SS) + zephyr_library_sources( + drivers/clk/ss_clk.c + soc/quark_se/drivers/vreg.c + soc/quark_se/drivers/ss_power_states.c + ) + endif() + if(CONFIG_SOC_QUARK_SE_C1000) + zephyr_library_sources(soc/${SOC_SERIES}/drivers/vreg.c) + endif() +endif() + +zephyr_library_sources_ifdef(CONFIG_ADC_QMSI drivers/adc/qm_adc.c) +zephyr_library_sources_ifdef(CONFIG_ADC_QMSI_SS drivers/adc/qm_ss_adc.c) +zephyr_library_sources_ifdef(CONFIG_AIO_COMPARATOR_QMSI drivers/comparator/qm_comparator.c) +zephyr_library_sources_ifdef(CONFIG_AON_COUNTER_QMSI drivers/aon_counters/qm_aon_counters.c) +zephyr_library_sources_ifdef(CONFIG_DMA_QMSI drivers/dma/qm_dma.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_QMSI drivers/gpio/qm_gpio.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_QMSI_SS drivers/gpio/qm_ss_gpio.c) +zephyr_library_sources_ifdef(CONFIG_I2C_QMSI drivers/i2c/qm_i2c.c) +zephyr_library_sources_ifdef(CONFIG_I2C_QMSI_SS drivers/i2c/qm_ss_i2c.c) +zephyr_library_sources_ifdef(CONFIG_PINMUX_QMSI drivers/pinmux/qm_pinmux.c) +zephyr_library_sources_ifdef(CONFIG_PWM_QMSI drivers/pwm/qm_pwm.c) +zephyr_library_sources_ifdef(CONFIG_RTC_QMSI drivers/rtc/qm_rtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_QMSI drivers/flash/qm_flash.c) +zephyr_library_sources_ifdef(CONFIG_SOC_WATCH drivers/soc_watch.c) +zephyr_library_sources_ifdef(CONFIG_SPI_QMSI drivers/spi/qm_spi.c) +zephyr_library_sources_ifdef(CONFIG_SPI_QMSI_SS drivers/spi/qm_ss_spi.c) +zephyr_library_sources_ifdef(CONFIG_UART_QMSI drivers/uart/qm_uart.c) +zephyr_library_sources_ifdef(CONFIG_WDT_QMSI drivers/wdt/qm_wdt.c) diff --git a/ext/hal/silabs/CMakeLists.txt b/ext/hal/silabs/CMakeLists.txt new file mode 100644 index 0000000000..132447d771 --- /dev/null +++ b/ext/hal/silabs/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_ifdef(CONFIG_HAS_SILABS_GECKO gecko) diff --git a/ext/hal/silabs/gecko/CMakeLists.txt b/ext/hal/silabs/gecko/CMakeLists.txt new file mode 100644 index 0000000000..172bfdf6e7 --- /dev/null +++ b/ext/hal/silabs/gecko/CMakeLists.txt @@ -0,0 +1,29 @@ +# Makefile - Gecko SDK +# +# Copyright (c) 2017, Christian Taedcke +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Translate the SoC name and part number into the gecko device and cpu name +# respectively. +string(TOUPPER ${CONFIG_SOC_SERIES} SILABS_GECKO_DEVICE) + +set(SILABS_GECKO_PART_NUMBER ${CONFIG_SOC_PART_NUMBER}) + +zephyr_include_directories( + Device/SiliconLabs/${SILABS_GECKO_DEVICE}/Include + emlib/inc + ) + +# The gecko SDK uses the cpu name to include the matching device header. +# See Device/SiliconLabs/$(SILABS_GECKO_DEVICE)/Include/em_device.h for an example. +zephyr_compile_definitions( + ${SILABS_GECKO_PART_NUMBER} + ) + +zephyr_sources( emlib/src/em_system.c) +zephyr_sources_ifdef(CONFIG_HAS_CMU emlib/src/em_cmu.c) +zephyr_sources_ifdef(CONFIG_GPIO_GECKO emlib/src/em_gpio.c) +zephyr_sources_ifdef(CONFIG_SERIAL_HAS_DRIVER emlib/src/em_usart.c) +zephyr_sources_ifdef(CONFIG_SOC_SERIES_EFM32WG Device/SiliconLabs/EFM32WG/Source/system_efm32wg.c) diff --git a/ext/hal/st/CMakeLists.txt b/ext/hal/st/CMakeLists.txt new file mode 100644 index 0000000000..707be27eec --- /dev/null +++ b/ext/hal/st/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(stm32cube) diff --git a/ext/hal/st/stm32cube/CMakeLists.txt b/ext/hal/st/stm32cube/CMakeLists.txt new file mode 100644 index 0000000000..0bb1b01aca --- /dev/null +++ b/ext/hal/st/stm32cube/CMakeLists.txt @@ -0,0 +1,120 @@ +# Makefile - STM32Cube SDK +# +# Copyright (c) 2016 Linaro Limited +# +# SPDX-License-Identifier: Apache-2.0 + +#add_library(STM32CUBE INTERFACE) +string(TOUPPER ${CONFIG_SOC} _STM32CUBE_CPU) +string(REPLACE "X" "x" STM32CUBE_CPU ${_STM32CUBE_CPU}) + +# STM32Cub uses the CPU name to expose SOC-specific attributes of a specific +# peripheral. +# It also requires USE_HAL_DRIVER to be define in order to benefit from +# STM32Cube HAL and LL APIs +zephyr_compile_definitions( + -D${STM32CUBE_CPU} + -DUSE_HAL_DRIVER + -DUSE_FULL_LL_DRIVER + ) + +if(CONFIG_SOC_SERIES_STM32F0X) +zephyr_include_directories( + stm32f0xx/soc + stm32f0xx/drivers/include + stm32f0xx/drivers/include/Legacy + ) + +zephyr_sources(stm32f0xx/drivers/src/stm32f0xx_hal.c) +zephyr_sources(stm32f0xx/drivers/src/stm32f0xx_hal_rcc.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_STM32_CUBE stm32f0xx/drivers/src/stm32f0xx_ll_utils.c) +zephyr_sources(stm32f0xx/soc/system_stm32f0xx.c) +endif() + +if(CONFIG_SOC_SERIES_STM32F1X) +zephyr_include_directories( + stm32f1xx/soc + stm32f1xx/drivers/include + stm32f1xx/drivers/include/Legacy + ) + +zephyr_sources(stm32f1xx/drivers/src/stm32f1xx_hal.c) +zephyr_sources(stm32f1xx/drivers/src/stm32f1xx_hal_rcc.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_STM32_CUBE stm32f1xx/drivers/src/stm32f1xx_ll_utils.c) +zephyr_sources_ifdef(CONFIG_PWM stm32f1xx/drivers/src/stm32f1xx_hal_tim.c) +zephyr_sources_ifdef(CONFIG_SERIAL_HAS_DRIVER stm32f1xx/drivers/src/stm32f1xx_hal_uart.c) +zephyr_sources_ifdef(CONFIG_I2C stm32f1xx/drivers/src/stm32f1xx_ll_i2c.c) +zephyr_sources(stm32f1xx/soc/system_stm32f1xx.c) +endif() + +if(CONFIG_SOC_SERIES_STM32F3X) +zephyr_include_directories( + stm32f3xx/soc + stm32f3xx/drivers/include + stm32f3xx/drivers/include/Legacy + ) + +zephyr_sources(stm32f3xx/drivers/src/stm32f3xx_hal.c) +zephyr_sources(stm32f3xx/drivers/src/stm32f3xx_hal_rcc.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_STM32_CUBE stm32f3xx/drivers/src/stm32f3xx_ll_utils.c) +zephyr_sources_ifdef(CONFIG_SERIAL_HAS_DRIVER stm32f3xx/drivers/src/stm32f3xx_hal_uart.c) +zephyr_sources_ifdef(CONFIG_SPI_STM32 stm32f3xx/drivers/src/stm32f3xx_ll_spi.c) +zephyr_sources_ifdef(CONFIG_I2C stm32f3xx/drivers/src/stm32f3xx_ll_i2c.c) +zephyr_sources_ifdef(CONFIG_I2C stm32f3xx/drivers/src/stm32f3xx_ll_rcc.c) +zephyr_sources(stm32f3xx/soc/system_stm32f3xx.c) +endif() + + + +if(CONFIG_SOC_SERIES_STM32F4X) +zephyr_include_directories( + stm32f4xx/soc + stm32f4xx/drivers/include + stm32f4xx/drivers/include/Legacy + ) + +zephyr_sources(stm32f4xx/drivers/src/stm32f4xx_hal.c) +zephyr_sources(stm32f4xx/drivers/src/stm32f4xx_hal_rcc.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_STM32_CUBE stm32f4xx/drivers/src/stm32f4xx_ll_utils.c) +zephyr_sources_ifdef(CONFIG_PWM stm32f4xx/drivers/src/stm32f4xx_hal_tim.c) +zephyr_sources_ifdef(CONFIG_SERIAL_HAS_DRIVER stm32f4xx/drivers/src/stm32f4xx_hal_uart.c) +zephyr_sources_ifdef(CONFIG_I2C stm32f4xx/drivers/src/stm32f4xx_ll_i2c.c) +zephyr_sources_ifdef(CONFIG_SPI_STM32 stm32f4xx/drivers/src/stm32f4xx_ll_spi.c) +zephyr_sources_ifdef(CONFIG_RANDOM_STM32_RNG stm32f4xx/drivers/src/stm32f4xx_ll_rng.c) +zephyr_sources_ifdef(CONFIG_ETH_STM32_HAL stm32f4xx/drivers/src/stm32f4xx_hal_eth.c) +zephyr_sources_ifdef(CONFIG_USB_DC_STM32 + stm32f4xx/drivers/src/stm32f4xx_ll_usb.c + stm32f4xx/drivers/src/stm32f4xx_hal_pcd.c + stm32f4xx/drivers/src/stm32f4xx_hal_pcd_ex.c + ) + +zephyr_sources(stm32f4xx/soc/system_stm32f4xx.c) +endif() + +if(CONFIG_SOC_SERIES_STM32F7X) +zephyr_include_directories( + stm32f7xx/soc + stm32f7xx/drivers/include + stm32f7xx/drivers/include/Legacy + ) + +zephyr_sources(stm32f7xx/drivers/src/stm32f7xx_hal.c) +zephyr_sources(stm32f7xx/soc/system_stm32f7xx.c) +endif() + +if(CONFIG_SOC_SERIES_STM32L4X) +zephyr_include_directories( + stm32l4xx/soc + stm32l4xx/drivers/include + stm32l4xx/drivers/include/Legacy + ) +zephyr_sources(stm32l4xx/drivers/src/stm32l4xx_hal.c) +zephyr_sources(stm32l4xx/drivers/src/stm32l4xx_hal_rcc.c) +zephyr_sources_ifdef(CONFIG_CLOCK_CONTROL_STM32_CUBE stm32l4xx/drivers/src/stm32l4xx_ll_utils.c) +zephyr_sources_ifdef(CONFIG_PWM stm32l4xx/drivers/src/stm32l4xx_hal_tim.c) +zephyr_sources_ifdef(CONFIG_SERIAL_HAS_DRIVER stm32l4xx/drivers/src/stm32l4xx_hal_uart.c) +zephyr_sources_ifdef(CONFIG_I2C stm32l4xx/drivers/src/stm32l4xx_ll_i2c.c) +zephyr_sources_ifdef(CONFIG_SPI_STM32 stm32l4xx/drivers/src/stm32l4xx_ll_spi.c) +zephyr_sources(stm32l4xx/soc/system_stm32l4xx.c) +endif() + diff --git a/ext/hal/ti/CMakeLists.txt b/ext/hal/ti/CMakeLists.txt new file mode 100644 index 0000000000..71592eef10 --- /dev/null +++ b/ext/hal/ti/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(simplelink) diff --git a/ext/hal/ti/simplelink/CMakeLists.txt b/ext/hal/ti/simplelink/CMakeLists.txt new file mode 100644 index 0000000000..4034e98264 --- /dev/null +++ b/ext/hal/ti/simplelink/CMakeLists.txt @@ -0,0 +1,67 @@ +add_subdirectory(source/ti/devices) + +if(CONFIG_SIMPLELINK_HOST_DRIVER) + zephyr_include_directories( + source + kernel/zephyr/dpl + ) + zephyr_compile_definitions( + SL_SUPPORT_IPV6 + SL_PLATFORM_MULTI_THREADED + ) +endif() + +if(CONFIG_HAS_CC3220SDK) + if(CONFIG_SIMPLELINK_HOST_DRIVER) + zephyr_library() + zephyr_library_compile_definitions(${COMPILER}) + zephyr_library_sources( + source/ti/drivers/SPI.c + source/ti/drivers/spi/SPICC32XXDMA.c + source/ti/drivers/dma/UDMACC32XX.c + source/ti/drivers/power/PowerCC32XX.c + source/ti/drivers/utils/List.c + source/ti/drivers/net/wifi/source/device.c + source/ti/drivers/net/wifi/source/flowcont.c + source/ti/drivers/net/wifi/source/fs.c + source/ti/drivers/net/wifi/source/netapp.c + source/ti/drivers/net/wifi/source/netcfg.c + source/ti/drivers/net/wifi/source/netutil.c + source/ti/drivers/net/wifi/source/nonos.c + source/ti/drivers/net/wifi/source/spawn.c + source/ti/drivers/net/wifi/source/wlan.c + source/ti/drivers/net/wifi/porting/CC3220SF_LAUNCHXL.c + source/ti/drivers/net/wifi/porting/cc_pal.c + source/ti/drivers/net/wifi/eventreg.c + source/ti/drivers/net/wifi/source/socket.c + + source/ti/devices/cc32xx/driverlib/timer.c + source/ti/devices/cc32xx/driverlib/udma.c + + kernel/zephyr/dpl/dpl.c + kernel/zephyr/dpl/MutexP_zephyr.c + kernel/zephyr/dpl/SemaphoreP_zephyr.c + kernel/zephyr/dpl/ClockP_zephyr.c + kernel/zephyr/dpl/HwiP_zephyr.c + ) + + # Create library for these two source files because they need to be + # built slightly differently. TODO: Use set_source_files_properties + # instead? + zephyr_library_named(simplelink_wifi_driver) + zephyr_library_sources(source/ti/drivers/net/wifi/source/driver.c) + zephyr_library_compile_definitions(__LINUX_ERRNO_EXTENSIONS__) + zephyr_library_compile_definitions(${COMPILER}) + zephyr_library_compile_options(-Wno-strict-aliasing) # driver.c warns on strict-aliasing + + zephyr_library_named(simplelink_wifi_sl_socket) + zephyr_library_sources(source/ti/drivers/net/wifi/source/sl_socket.c) + zephyr_library_compile_definitions(${COMPILER}) + zephyr_library_compile_options(-Wno-missing-braces) # sl_socket warns on missing braces + endif() + +elseif(CONFIG_HAS_MSP432P4XXSDK) + zephyr_include_directories( + source + ) +endif() diff --git a/ext/hal/ti/simplelink/source/ti/devices/CMakeLists.txt b/ext/hal/ti/simplelink/source/ti/devices/CMakeLists.txt new file mode 100644 index 0000000000..5cb15e3c79 --- /dev/null +++ b/ext/hal/ti/simplelink/source/ti/devices/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory_ifdef(CONFIG_HAS_CC3220SDK cc32xx) +add_subdirectory_ifdef(CONFIG_HAS_MSP432P4XXSDK msp432p4xx) + diff --git a/ext/hal/ti/simplelink/source/ti/devices/cc32xx/CMakeLists.txt b/ext/hal/ti/simplelink/source/ti/devices/cc32xx/CMakeLists.txt new file mode 100644 index 0000000000..83ad33b1a3 --- /dev/null +++ b/ext/hal/ti/simplelink/source/ti/devices/cc32xx/CMakeLists.txt @@ -0,0 +1,16 @@ +zephyr_include_directories( + . + inc + driverlib + ) +zephyr_compile_definitions( + USE_CC3220_ROM_DRV_API + ) + +zephyr_library() +zephyr_library_compile_definitions(${COMPILER}) +zephyr_library_sources( + driverlib/utils.c + driverlib/prcm.c + driverlib/pin.c + ) diff --git a/ext/hal/ti/simplelink/source/ti/devices/msp432p4xx/CMakeLists.txt b/ext/hal/ti/simplelink/source/ti/devices/msp432p4xx/CMakeLists.txt new file mode 100644 index 0000000000..8776c65c41 --- /dev/null +++ b/ext/hal/ti/simplelink/source/ti/devices/msp432p4xx/CMakeLists.txt @@ -0,0 +1,11 @@ +zephyr_include_directories( + . + ) + +zephyr_library() +zephyr_library_compile_definitions(${COMPILER}) +zephyr_library_sources( + # Need system_msp432p401r for SystemInit which is not in ROM + startup_system_files/system_msp432p401r.c + ) + diff --git a/ext/lib/CMakeLists.txt b/ext/lib/CMakeLists.txt new file mode 100644 index 0000000000..88a6a9e728 --- /dev/null +++ b/ext/lib/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(crypto) diff --git a/ext/lib/crypto/CMakeLists.txt b/ext/lib/crypto/CMakeLists.txt new file mode 100644 index 0000000000..0b462985bf --- /dev/null +++ b/ext/lib/crypto/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory_if_kconfig(tinycrypt) +add_subdirectory_ifdef(CONFIG_MBEDTLS_BUILTIN mbedtls) diff --git a/ext/lib/crypto/mbedtls/CMakeLists.txt b/ext/lib/crypto/mbedtls/CMakeLists.txt new file mode 100644 index 0000000000..505a1c321c --- /dev/null +++ b/ext/lib/crypto/mbedtls/CMakeLists.txt @@ -0,0 +1,89 @@ +add_library(mbedTLS INTERFACE) +target_compile_definitions(mbedTLS INTERFACE + MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}" + ) + +target_include_directories(mbedTLS INTERFACE + include + configs + ) + + +zephyr_library() +zephyr_library_sources(zephyr_init.c) + +zephyr_library_sources(library/aes.c) +zephyr_library_sources(library/aesni.c) +zephyr_library_sources(library/arc4.c) +zephyr_library_sources(library/asn1parse.c) +zephyr_library_sources(library/asn1write.c) +zephyr_library_sources(library/base64.c) +zephyr_library_sources(library/bignum.c) +zephyr_library_sources(library/blowfish.c) +zephyr_library_sources(library/camellia.c) +zephyr_library_sources(library/ccm.c) +zephyr_library_sources(library/certs.c) +zephyr_library_sources(library/cipher.c) +zephyr_library_sources(library/cipher_wrap.c) +zephyr_library_sources(library/cmac.c) +zephyr_library_sources(library/ctr_drbg.c) +zephyr_library_sources(library/debug.c) +zephyr_library_sources(library/des.c) +zephyr_library_sources(library/dhm.c) +zephyr_library_sources(library/ecdh.c) +zephyr_library_sources(library/ecdsa.c) +zephyr_library_sources(library/ecjpake.c) +zephyr_library_sources(library/ecp.c) +zephyr_library_sources(library/ecp_curves.c) +zephyr_library_sources(library/entropy.c) +zephyr_library_sources(library/entropy_poll.c) +zephyr_library_sources(library/error.c) +zephyr_library_sources(library/gcm.c) +zephyr_library_sources(library/havege.c) +zephyr_library_sources(library/hmac_drbg.c) +zephyr_library_sources(library/md.c) +zephyr_library_sources(library/md2.c) +zephyr_library_sources(library/md4.c) +zephyr_library_sources(library/md5.c) +zephyr_library_sources(library/md_wrap.c) +zephyr_library_sources(library/memory_buffer_alloc.c) +zephyr_library_sources(library/net_sockets.c) +zephyr_library_sources(library/oid.c) +zephyr_library_sources(library/padlock.c) +zephyr_library_sources(library/pem.c) +zephyr_library_sources(library/pk.c) +zephyr_library_sources(library/pk_wrap.c) +zephyr_library_sources(library/pkcs11.c) +zephyr_library_sources(library/pkcs12.c) +zephyr_library_sources(library/pkcs5.c) +zephyr_library_sources(library/pkparse.c) +zephyr_library_sources(library/pkwrite.c) +zephyr_library_sources(library/platform.c) +zephyr_library_sources(library/ripemd160.c) +zephyr_library_sources(library/rsa.c) +zephyr_library_sources(library/sha1.c) +zephyr_library_sources(library/sha256.c) +zephyr_library_sources(library/sha512.c) +zephyr_library_sources(library/ssl_cache.c) +zephyr_library_sources(library/ssl_ciphersuites.c) +zephyr_library_sources(library/ssl_cli.c) +zephyr_library_sources(library/ssl_cookie.c) +zephyr_library_sources(library/ssl_srv.c) +zephyr_library_sources(library/ssl_ticket.c) +zephyr_library_sources(library/ssl_tls.c) +zephyr_library_sources(library/threading.c) +zephyr_library_sources(library/timing.c) +zephyr_library_sources(library/version.c) +zephyr_library_sources(library/version_features.c) +zephyr_library_sources(library/x509.c) +zephyr_library_sources(library/x509_create.c) +zephyr_library_sources(library/x509_crl.c) +zephyr_library_sources(library/x509_crt.c) +zephyr_library_sources(library/x509_csr.c) +zephyr_library_sources(library/x509write_crt.c) +zephyr_library_sources(library/x509write_csr.c) +zephyr_library_sources(library/xtea.c) + +zephyr_library_link_libraries(mbedTLS) + +target_link_libraries(mbedTLS INTERFACE zephyr_interface) diff --git a/ext/lib/crypto/tinycrypt/CMakeLists.txt b/ext/lib/crypto/tinycrypt/CMakeLists.txt new file mode 100644 index 0000000000..f201dc8855 --- /dev/null +++ b/ext/lib/crypto/tinycrypt/CMakeLists.txt @@ -0,0 +1,17 @@ +zephyr_include_directories(include) + +zephyr_sources( source/utils.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_ECC_DH source/ecc_dh.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_ECC_DH source/ecc.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_ECC_DSA source/ecc_dsa.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_ECC_DSA source/ecc.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_AES source/aes_decrypt.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_AES source/aes_encrypt.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_AES_CBC source/cbc_mode.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_AES_CTR source/ctr_mode.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_AES_CCM source/ccm_mode.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_AES_CMAC source/cmac_mode.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_SHA256 source/sha256.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_SHA256_HMAC source/hmac.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_SHA256_HMAC_PRNG source/hmac_prng.c) +zephyr_sources_ifdef(CONFIG_TINYCRYPT_CTR_PRNG source/ctr_prng.c) diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt new file mode 100644 index 0000000000..3a9c5337c6 --- /dev/null +++ b/kernel/CMakeLists.txt @@ -0,0 +1,45 @@ +# kernel is a normal CMake library and not a zephyr_library because it +# should not be --whole-archive'd +add_library(kernel + alert.c + device.c + errno.c + idle.c + init.c + mailbox.c + mem_slab.c + mempool.c + msg_q.c + mutex.c + pipes.c + queue.c + sched.c + sem.c + stack.c + sys_clock.c + system_work_q.c + thread.c + thread_abort.c + version.c + work_q.c +) + +target_sources_ifdef(CONFIG_INT_LATENCY_BENCHMARK kernel PRIVATE int_latency_bench.c) +target_sources_ifdef(CONFIG_STACK_CANARIES kernel PRIVATE compiler_stack_protect.c) +target_sources_ifdef(CONFIG_SYS_CLOCK_EXISTS kernel PRIVATE timer.c) +target_sources_ifdef(CONFIG_LEGACY_KERNEL kernel PRIVATE legacy_timer.c) +target_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_C kernel PRIVATE atomic_c.c) +target_sources_ifdef(CONFIG_PTHREAD_IPC kernel PRIVATE pthread.c) +target_sources_if_kconfig( kernel PRIVATE poll.c) + +target_sources_ifdef( + CONFIG_USERSPACE + kernel PRIVATE + userspace.c + userspace_handler.c + mem_domain.c + ) + +add_dependencies(kernel offsets_h) + +target_link_libraries(kernel zephyr_interface) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000000..c0fdc7a195 --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(libc) +add_subdirectory_ifdef(CONFIG_JSON_LIBRARY json) diff --git a/lib/json/CMakeLists.txt b/lib/json/CMakeLists.txt new file mode 100644 index 0000000000..da12bb1238 --- /dev/null +++ b/lib/json/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_library() +zephyr_library_sources(json.c) diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt new file mode 100644 index 0000000000..e72a848ce0 --- /dev/null +++ b/lib/libc/CMakeLists.txt @@ -0,0 +1,5 @@ +if(CONFIG_NEWLIB_LIBC) + add_subdirectory(newlib) +else() + add_subdirectory(minimal) +endif() diff --git a/lib/libc/minimal/CMakeLists.txt b/lib/libc/minimal/CMakeLists.txt new file mode 100644 index 0000000000..7c05a25b16 --- /dev/null +++ b/lib/libc/minimal/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(app PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/atoi.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/strtol.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/strtoul.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/string/strncasecmp.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/string/strstr.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/string/string.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/prf.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/stdout_console.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/sprintf.c + ${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/fprintf.c +) +zephyr_include_directories(include) diff --git a/lib/libc/minimal/source/CMakeLists.txt b/lib/libc/minimal/source/CMakeLists.txt new file mode 100644 index 0000000000..2089a727f8 --- /dev/null +++ b/lib/libc/minimal/source/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(stdout) +add_subdirectory(string) +add_subdirectory(stdlib) diff --git a/lib/libc/minimal/source/stdout/CMakeLists.txt b/lib/libc/minimal/source/stdout/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/libc/newlib/CMakeLists.txt b/lib/libc/newlib/CMakeLists.txt new file mode 100644 index 0000000000..56ae7dc020 --- /dev/null +++ b/lib/libc/newlib/CMakeLists.txt @@ -0,0 +1,12 @@ +zephyr_library() +zephyr_library_sources(libc-hooks.c) + +zephyr_include_directories(${LIBC_INCLUDE_DIR}) +zephyr_link_libraries( + m + c + -L${LIBC_LIBRARY_DIR} + $<$:-u_printf_float> + $<$:-u_scanf_float> + gcc # Lib C depends on libgcc. e.g. libc.a(lib_a-fvwrite.o) references __aeabi_idiv + ) diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt new file mode 100644 index 0000000000..8fd982b65b --- /dev/null +++ b/misc/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources_if_kconfig(printk.c) +zephyr_sources_if_kconfig(reboot.c) +zephyr_sources_if_kconfig(ring_buffer.c) diff --git a/misc/empty_file.c b/misc/empty_file.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/misc/generated/CMakeLists.txt b/misc/generated/CMakeLists.txt new file mode 100644 index 0000000000..7b7de6ed19 --- /dev/null +++ b/misc/generated/CMakeLists.txt @@ -0,0 +1,11 @@ +set(CONFIGS_C ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/configs.c) + +file(STRINGS ${AUTOCONF_H} CONFIG_LIST REGEX "^#define CONFIG_") +foreach (CONFIG ${CONFIG_LIST}) + string(REGEX REPLACE "#define (CONFIG_[A-Z|_|0-9]*) (.*)" "GEN_ABSOLUTE_SYM(\\1, \\2)" CONFIG ${CONFIG}) + string(REGEX REPLACE "\"(.*)\"" "1" CONFIG ${CONFIG}) + set(GEN_ABS_SYM_LIST "${GEN_ABS_SYM_LIST}${CONFIG};\n") +endforeach() + +configure_file(${CMAKE_CURRENT_LIST_DIR}/configs.c.in ${CONFIGS_C}) +zephyr_sources( ${CONFIGS_C}) diff --git a/misc/generated/configs.c.in b/misc/generated/configs.c.in new file mode 100644 index 0000000000..e965695eb9 --- /dev/null +++ b/misc/generated/configs.c.in @@ -0,0 +1,8 @@ +/* file is auto-generated, do not modify ! */ + +#include + +GEN_ABS_SYM_BEGIN (_ConfigAbsSyms) + +@GEN_ABS_SYM_LIST@ +GEN_ABS_SYM_END diff --git a/samples/application_development/external_lib/CMakeLists.txt b/samples/application_development/external_lib/CMakeLists.txt new file mode 100644 index 0000000000..42f0fb32f9 --- /dev/null +++ b/samples/application_development/external_lib/CMakeLists.txt @@ -0,0 +1,53 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) + +# The external static library that we are linking with does not know +# how to build for this platform so we export all the flags used in +# this zephyr build to the external build system. +# +# Other external build systems may be self-contained enough that they +# do not need any build information from zephyr. Or they may be +# incompatible with certain zephyr options and need them to be +# filtered out. +zephyr_get_include_directories_as_string(includes) +zephyr_get_system_include_directories_as_string(system_includes) +zephyr_get_compile_definitions_as_string(definitions) +zephyr_get_compile_options_as_string(options) + +set(external_project_cflags + ${includes}${definitions}${options}${system_includes} + ) + +include(ExternalProject) + +# Add an external project to be able download and build the third +# party library. In this case downloading is not necessary as it has +# been committed to the repository. +set(mylib_dir ${CMAKE_CURRENT_SOURCE_DIR}/mylib) +ExternalProject_Add( + mylib_project # Name for custom target + PREFIX ${mylib_dir} # Root dir for entire project + SOURCE_DIR ${mylib_dir} + BINARY_DIR ${mylib_dir} # This particular build system is invoked from the root + CONFIGURE_COMMAND "" # Skip configuring the project, e.g. with autoconf + BUILD_COMMAND + make + CC=${CMAKE_C_COMPILER} + CFLAGS=${external_project_cflags} + INSTALL_COMMAND "" # This particular build system has no install command + ) +set(MYLIB_INCLUDE_DIR ${mylib_dir}/include) +set(MYLIB_LIB_DIR ${mylib_dir}/lib) + +# Create a wrapper CMake library that our app can link with +add_library(mylib_lib STATIC IMPORTED) +add_dependencies( + mylib_lib + mylib_project + ) +set_target_properties(mylib_lib PROPERTIES IMPORTED_LOCATION ${MYLIB_LIB_DIR}/libmylib.a) +set_target_properties(mylib_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${MYLIB_INCLUDE_DIR}) + +target_link_libraries(app mylib_lib) diff --git a/samples/basic/blink_led/CMakeLists.txt b/samples/basic/blink_led/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/blink_led/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/blinky/CMakeLists.txt b/samples/basic/blinky/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/blinky/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/button/CMakeLists.txt b/samples/basic/button/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/button/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/disco/CMakeLists.txt b/samples/basic/disco/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/disco/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/fade_led/CMakeLists.txt b/samples/basic/fade_led/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/fade_led/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/rgb_led/CMakeLists.txt b/samples/basic/rgb_led/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/rgb_led/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/servo_motor/CMakeLists.txt b/samples/basic/servo_motor/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/servo_motor/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/threads/CMakeLists.txt b/samples/basic/threads/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/basic/threads/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/bluetooth/beacon/CMakeLists.txt b/samples/bluetooth/beacon/CMakeLists.txt new file mode 100644 index 0000000000..29b313ed00 --- /dev/null +++ b/samples/bluetooth/beacon/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app subsys__bluetooth) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/bluetooth/central/CMakeLists.txt b/samples/bluetooth/central/CMakeLists.txt new file mode 100644 index 0000000000..d625a83262 --- /dev/null +++ b/samples/bluetooth/central/CMakeLists.txt @@ -0,0 +1,10 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +target_sources(app PRIVATE + src/main.c +) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/central_hr/CMakeLists.txt b/samples/bluetooth/central_hr/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/central_hr/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/eddystone/CMakeLists.txt b/samples/bluetooth/eddystone/CMakeLists.txt new file mode 100644 index 0000000000..d625a83262 --- /dev/null +++ b/samples/bluetooth/eddystone/CMakeLists.txt @@ -0,0 +1,10 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +target_sources(app PRIVATE + src/main.c +) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/handsfree/CMakeLists.txt b/samples/bluetooth/handsfree/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/handsfree/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/hci_spi/CMakeLists.txt b/samples/bluetooth/hci_spi/CMakeLists.txt new file mode 100644 index 0000000000..5312f47083 --- /dev/null +++ b/samples/bluetooth/hci_spi/CMakeLists.txt @@ -0,0 +1,10 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/subsys/bluetooth) diff --git a/samples/bluetooth/hci_uart/CMakeLists.txt b/samples/bluetooth/hci_uart/CMakeLists.txt new file mode 100644 index 0000000000..a76de26573 --- /dev/null +++ b/samples/bluetooth/hci_uart/CMakeLists.txt @@ -0,0 +1,12 @@ +if(BOARD STREQUAL bbc_microbit) + set(CONF_FILE microbit.conf) +else() + set(CONF_FILE nrf5.conf) +endif() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app subsys__bluetooth) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/bluetooth/hci_usb/CMakeLists.txt b/samples/bluetooth/hci_usb/CMakeLists.txt new file mode 100644 index 0000000000..29b313ed00 --- /dev/null +++ b/samples/bluetooth/hci_usb/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app subsys__bluetooth) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/bluetooth/ipsp/CMakeLists.txt b/samples/bluetooth/ipsp/CMakeLists.txt new file mode 100644 index 0000000000..ceecc3b697 --- /dev/null +++ b/samples/bluetooth/ipsp/CMakeLists.txt @@ -0,0 +1,8 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +target_sources(app PRIVATE + src/main.c +) diff --git a/samples/bluetooth/mesh/CMakeLists.txt b/samples/bluetooth/mesh/CMakeLists.txt new file mode 100644 index 0000000000..348a75e172 --- /dev/null +++ b/samples/bluetooth/mesh/CMakeLists.txt @@ -0,0 +1,9 @@ +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr -s) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app subsys__bluetooth) + +target_sources(app PRIVATE src/main.c) +target_sources_ifdef(CONFIG_BOARD_BBC_MICROBIT app PRIVATE src/microbit.c) diff --git a/samples/bluetooth/mesh/microbit.conf b/samples/bluetooth/mesh/prj_bbc_microbit.conf similarity index 100% rename from samples/bluetooth/mesh/microbit.conf rename to samples/bluetooth/mesh/prj_bbc_microbit.conf diff --git a/samples/bluetooth/mesh/nrf51-16k.conf b/samples/bluetooth/mesh/prj_nrf51_blenano.conf similarity index 100% rename from samples/bluetooth/mesh/nrf51-16k.conf rename to samples/bluetooth/mesh/prj_nrf51_blenano.conf diff --git a/samples/bluetooth/mesh_demo/CMakeLists.txt b/samples/bluetooth/mesh_demo/CMakeLists.txt new file mode 100644 index 0000000000..348a75e172 --- /dev/null +++ b/samples/bluetooth/mesh_demo/CMakeLists.txt @@ -0,0 +1,9 @@ +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr -s) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app subsys__bluetooth) + +target_sources(app PRIVATE src/main.c) +target_sources_ifdef(CONFIG_BOARD_BBC_MICROBIT app PRIVATE src/microbit.c) diff --git a/samples/bluetooth/mesh_demo/microbit.conf b/samples/bluetooth/mesh_demo/prj_bbc_microbit.conf similarity index 100% rename from samples/bluetooth/mesh_demo/microbit.conf rename to samples/bluetooth/mesh_demo/prj_bbc_microbit.conf diff --git a/samples/bluetooth/mesh_demo/nrf51-16k.conf b/samples/bluetooth/mesh_demo/prj_nrf51_blenano.conf similarity index 100% rename from samples/bluetooth/mesh_demo/nrf51-16k.conf rename to samples/bluetooth/mesh_demo/prj_nrf51_blenano.conf diff --git a/samples/bluetooth/peripheral/CMakeLists.txt b/samples/bluetooth/peripheral/CMakeLists.txt new file mode 100644 index 0000000000..08e17d47eb --- /dev/null +++ b/samples/bluetooth/peripheral/CMakeLists.txt @@ -0,0 +1,14 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +target_sources(app PRIVATE + src/main.c + src/hrs.c + src/dis.c + src/bas.c + src/cts.c +) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_csc/CMakeLists.txt b/samples/bluetooth/peripheral_csc/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/peripheral_csc/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_dis/CMakeLists.txt b/samples/bluetooth/peripheral_dis/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/peripheral_dis/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_esp/CMakeLists.txt b/samples/bluetooth/peripheral_esp/CMakeLists.txt new file mode 100644 index 0000000000..943a4216ca --- /dev/null +++ b/samples/bluetooth/peripheral_esp/CMakeLists.txt @@ -0,0 +1,12 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +target_sources(app PRIVATE + src/main.c + src/bas.c + src/dis.c +) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_hids/CMakeLists.txt b/samples/bluetooth/peripheral_hids/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/peripheral_hids/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_hr/CMakeLists.txt b/samples/bluetooth/peripheral_hr/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/peripheral_hr/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/peripheral_sc_only/CMakeLists.txt b/samples/bluetooth/peripheral_sc_only/CMakeLists.txt new file mode 100644 index 0000000000..d625a83262 --- /dev/null +++ b/samples/bluetooth/peripheral_sc_only/CMakeLists.txt @@ -0,0 +1,10 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +target_sources(app PRIVATE + src/main.c +) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/bluetooth/scan_adv/CMakeLists.txt b/samples/bluetooth/scan_adv/CMakeLists.txt new file mode 100644 index 0000000000..a1000bf8d5 --- /dev/null +++ b/samples/bluetooth/scan_adv/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) diff --git a/samples/boards/arduino_101/environmental_sensing/ap/CMakeLists.txt b/samples/boards/arduino_101/environmental_sensing/ap/CMakeLists.txt new file mode 100644 index 0000000000..e57677819d --- /dev/null +++ b/samples/boards/arduino_101/environmental_sensing/ap/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/drivers) +target_sources(app PRIVATE src/main.c) diff --git a/samples/boards/arduino_101/environmental_sensing/sensor/CMakeLists.txt b/samples/boards/arduino_101/environmental_sensing/sensor/CMakeLists.txt new file mode 100644 index 0000000000..e57677819d --- /dev/null +++ b/samples/boards/arduino_101/environmental_sensing/sensor/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/drivers) +target_sources(app PRIVATE src/main.c) diff --git a/samples/boards/microbit/display/CMakeLists.txt b/samples/boards/microbit/display/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/boards/microbit/display/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/boards/microbit/pong/CMakeLists.txt b/samples/boards/microbit/pong/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/boards/microbit/pong/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/boards/microbit/sound/CMakeLists.txt b/samples/boards/microbit/sound/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/boards/microbit/sound/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/boards/nrf52/power_mgr/CMakeLists.txt b/samples/boards/nrf52/power_mgr/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/boards/nrf52/power_mgr/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/boards/quark_se_c1000/power_mgr/CMakeLists.txt b/samples/boards/quark_se_c1000/power_mgr/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/boards/quark_se_c1000/power_mgr/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/cpp_synchronization/CMakeLists.txt b/samples/cpp_synchronization/CMakeLists.txt new file mode 100644 index 0000000000..628b8b2845 --- /dev/null +++ b/samples/cpp_synchronization/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.cpp) diff --git a/samples/drivers/aio_comparator/CMakeLists.txt b/samples/drivers/aio_comparator/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/aio_comparator/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/crypto/CMakeLists.txt b/samples/drivers/crypto/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/crypto/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/current_sensing/CMakeLists.txt b/samples/drivers/current_sensing/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/current_sensing/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/entropy/CMakeLists.txt b/samples/drivers/entropy/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/entropy/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/flash_shell/CMakeLists.txt b/samples/drivers/flash_shell/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/flash_shell/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/gpio/CMakeLists.txt b/samples/drivers/gpio/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/gpio/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/i2c_fujitsu_fram/CMakeLists.txt b/samples/drivers/i2c_fujitsu_fram/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/i2c_fujitsu_fram/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/lcd_hd44780/CMakeLists.txt b/samples/drivers/lcd_hd44780/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/lcd_hd44780/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/led_apa102c/CMakeLists.txt b/samples/drivers/led_apa102c/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/led_apa102c/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/led_lpd8806/CMakeLists.txt b/samples/drivers/led_lpd8806/CMakeLists.txt new file mode 100644 index 0000000000..779ffd810f --- /dev/null +++ b/samples/drivers/led_lpd8806/CMakeLists.txt @@ -0,0 +1,13 @@ +macro(set_conf_file) + if(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf) + set(CONF_FILE "prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf") + else() + set(CONF_FILE "prj.conf") + endif() +endmacro() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/led_ws2812/CMakeLists.txt b/samples/drivers/led_ws2812/CMakeLists.txt new file mode 100644 index 0000000000..779ffd810f --- /dev/null +++ b/samples/drivers/led_ws2812/CMakeLists.txt @@ -0,0 +1,13 @@ +macro(set_conf_file) + if(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf) + set(CONF_FILE "prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf") + else() + set(CONF_FILE "prj.conf") + endif() +endmacro() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/random/CMakeLists.txt b/samples/drivers/random/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/random/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/rtc/CMakeLists.txt b/samples/drivers/rtc/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/rtc/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/soc_flash_nrf5/CMakeLists.txt b/samples/drivers/soc_flash_nrf5/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/soc_flash_nrf5/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/spi_flash/CMakeLists.txt b/samples/drivers/spi_flash/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/spi_flash/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/spi_fujitsu_fram/CMakeLists.txt b/samples/drivers/spi_fujitsu_fram/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/drivers/spi_fujitsu_fram/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/watchdog/CMakeLists.txt b/samples/drivers/watchdog/CMakeLists.txt new file mode 100644 index 0000000000..eefe08101c --- /dev/null +++ b/samples/drivers/watchdog/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +if(CONFIG_IWDG_STM32) +target_sources(app PRIVATE src/iwdg_main.c) +else() +target_sources(app PRIVATE src/main.c) +endif() + diff --git a/samples/grove/lcd/CMakeLists.txt b/samples/grove/lcd/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/grove/lcd/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/grove/light/CMakeLists.txt b/samples/grove/light/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/grove/light/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/grove/temperature/CMakeLists.txt b/samples/grove/temperature/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/grove/temperature/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/hello_world/CMakeLists.txt b/samples/hello_world/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/hello_world/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/mpu/mem_domain_apis_test/CMakeLists.txt b/samples/mpu/mem_domain_apis_test/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/mpu/mem_domain_apis_test/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/mpu/mpu_stack_guard_test/CMakeLists.txt b/samples/mpu/mpu_stack_guard_test/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/mpu/mpu_stack_guard_test/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/mpu/mpu_test/CMakeLists.txt b/samples/mpu/mpu_test/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/mpu/mpu_test/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/coap_client/CMakeLists.txt b/samples/net/coap_client/CMakeLists.txt new file mode 100644 index 0000000000..fee4f66481 --- /dev/null +++ b/samples/net/coap_client/CMakeLists.txt @@ -0,0 +1,16 @@ +set(QEMU_NET_STACK 1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +if(CONFIG_NET_TESTING) + target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE}/samples/net/common + ) + target_compile_definitions(app PRIVATE + NET_TESTING_SERVER=1 + ) +endif() diff --git a/samples/net/coap_server/CMakeLists.txt b/samples/net/coap_server/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/net/coap_server/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/coaps_client/CMakeLists.txt b/samples/net/coaps_client/CMakeLists.txt new file mode 100644 index 0000000000..d34895228e --- /dev/null +++ b/samples/net/coaps_client/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app mbedTLS) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/coaps_server/CMakeLists.txt b/samples/net/coaps_server/CMakeLists.txt new file mode 100644 index 0000000000..d34895228e --- /dev/null +++ b/samples/net/coaps_server/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app mbedTLS) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/common/common.cmake b/samples/net/common/common.cmake new file mode 100644 index 0000000000..459a5814aa --- /dev/null +++ b/samples/net/common/common.cmake @@ -0,0 +1,30 @@ +# Common routines used in net samples + +if(CONFIG_BOARD_FRDM_K64F) + if(CONFIG_IEEE802154_CC2520) + target_include_directories( + app + PRIVATE + $ENV{ZEPHYR_BASE}/drivers/ + $ENV{ZEPHYR_BASE}/include/drivers/ + ) + target_sources( + app + PRIVATE + $ENV{ZEPHYR_BASE}/samples/net/common/cc2520_frdm_k64f.c + ) + endif() +endif() + +if(CONFIG_NET_TESTING) + target_include_directories( + app + PRIVATE + $ENV{ZEPHYR_BASE}/samples/net/common/ + ) + target_compile_definitions( + app + PRIVATE + NET_TESTING_SERVER=1 + ) +endif() diff --git a/samples/net/dhcpv4_client/CMakeLists.txt b/samples/net/dhcpv4_client/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/net/dhcpv4_client/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/dns_resolve/CMakeLists.txt b/samples/net/dns_resolve/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/net/dns_resolve/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/echo_client/CMakeLists.txt b/samples/net/echo_client/CMakeLists.txt new file mode 100644 index 0000000000..b2b3434fc9 --- /dev/null +++ b/samples/net/echo_client/CMakeLists.txt @@ -0,0 +1,10 @@ +set(QEMU_NET_STACK 1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources( app PRIVATE src/echo-client.c) +target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c) +target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/echo_server/CMakeLists.txt b/samples/net/echo_server/CMakeLists.txt new file mode 100644 index 0000000000..bb069cbc9f --- /dev/null +++ b/samples/net/echo_server/CMakeLists.txt @@ -0,0 +1,10 @@ +set(QEMU_NET_STACK 1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources( app PRIVATE src/echo-server.c) +target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c) +target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/http_client/CMakeLists.txt b/samples/net/http_client/CMakeLists.txt new file mode 100644 index 0000000000..a59d9f400a --- /dev/null +++ b/samples/net/http_client/CMakeLists.txt @@ -0,0 +1,13 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) + +generate_inc_file_for_target( + app + src/echo-apps-cert.der + ${ZEPHYR_BINARY_DIR}/include/generated/echo-apps-cert.der.inc + ) diff --git a/samples/net/http_server/CMakeLists.txt b/samples/net/http_server/CMakeLists.txt new file mode 100644 index 0000000000..63811f5708 --- /dev/null +++ b/samples/net/http_server/CMakeLists.txt @@ -0,0 +1,23 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) + +# List of files that are used to generate .h file that can be included +# into .c file. +foreach(inc_file + echo-apps-cert.der + echo-apps-key.der + index.html + ) + generate_inc_file_for_target( + app + src/${inc_file} + ${ZEPHYR_BINARY_DIR}/include/generated/${inc_file}.inc + ) +endforeach() + +target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS) diff --git a/samples/net/irc_bot/CMakeLists.txt b/samples/net/irc_bot/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/net/irc_bot/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/leds_demo/CMakeLists.txt b/samples/net/leds_demo/CMakeLists.txt new file mode 100644 index 0000000000..57094c07a2 --- /dev/null +++ b/samples/net/leds_demo/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +target_sources(app PRIVATE src/leds-demo.c) +target_sources_ifdef(CONFIG_NET_L2_IEEE802154 app PRIVATE src/ieee802154_settings.c) diff --git a/samples/net/lwm2m_client/CMakeLists.txt b/samples/net/lwm2m_client/CMakeLists.txt new file mode 100644 index 0000000000..eb37557b09 --- /dev/null +++ b/samples/net/lwm2m_client/CMakeLists.txt @@ -0,0 +1,10 @@ +set(QEMU_NET_STACK 1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/mbedtls_dtlsclient/CMakeLists.txt b/samples/net/mbedtls_dtlsclient/CMakeLists.txt new file mode 100644 index 0000000000..d34895228e --- /dev/null +++ b/samples/net/mbedtls_dtlsclient/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app mbedTLS) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/mbedtls_dtlsserver/CMakeLists.txt b/samples/net/mbedtls_dtlsserver/CMakeLists.txt new file mode 100644 index 0000000000..d34895228e --- /dev/null +++ b/samples/net/mbedtls_dtlsserver/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app mbedTLS) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/mbedtls_sslclient/CMakeLists.txt b/samples/net/mbedtls_sslclient/CMakeLists.txt new file mode 100644 index 0000000000..3a84300d1c --- /dev/null +++ b/samples/net/mbedtls_sslclient/CMakeLists.txt @@ -0,0 +1,9 @@ +set(CONF_FILE "prj_${BOARD}.conf") + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app mbedTLS) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/mdns_responder/CMakeLists.txt b/samples/net/mdns_responder/CMakeLists.txt new file mode 100644 index 0000000000..f5704cf505 --- /dev/null +++ b/samples/net/mdns_responder/CMakeLists.txt @@ -0,0 +1,9 @@ +set(QEMU_NET_STACK 1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/mqtt_publisher/CMakeLists.txt b/samples/net/mqtt_publisher/CMakeLists.txt new file mode 100644 index 0000000000..e229c7412e --- /dev/null +++ b/samples/net/mqtt_publisher/CMakeLists.txt @@ -0,0 +1,7 @@ +set(CONF_FILE "prj_${BOARD}.conf") + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/nats/CMakeLists.txt b/samples/net/nats/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/net/nats/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/sntp_client/CMakeLists.txt b/samples/net/sntp_client/CMakeLists.txt new file mode 100644 index 0000000000..d29e156ce2 --- /dev/null +++ b/samples/net/sntp_client/CMakeLists.txt @@ -0,0 +1,7 @@ +set(QEMU_NET_STACK 1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/sockets/dumb_http_server/CMakeLists.txt b/samples/net/sockets/dumb_http_server/CMakeLists.txt new file mode 100644 index 0000000000..79b4564131 --- /dev/null +++ b/samples/net/sockets/dumb_http_server/CMakeLists.txt @@ -0,0 +1,14 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +# Write the generated file into the include/generated directory, which +# is already in the system path +set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/) + +generate_inc_file_for_target(app src/response_small.html.bin ${gen_dir}/response_small.html.bin.inc) +generate_inc_file_for_target(app src/response_big.html.bin ${gen_dir}/response_big.html.bin.inc) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/sockets/echo/CMakeLists.txt b/samples/net/sockets/echo/CMakeLists.txt new file mode 100644 index 0000000000..e6bf10afba --- /dev/null +++ b/samples/net/sockets/echo/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/sockets/echo_async/CMakeLists.txt b/samples/net/sockets/echo_async/CMakeLists.txt new file mode 100644 index 0000000000..e6bf10afba --- /dev/null +++ b/samples/net/sockets/echo_async/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/sockets/http_get/CMakeLists.txt b/samples/net/sockets/http_get/CMakeLists.txt new file mode 100644 index 0000000000..e6bf10afba --- /dev/null +++ b/samples/net/sockets/http_get/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/telnet/CMakeLists.txt b/samples/net/telnet/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/net/telnet/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/wpan_serial/CMakeLists.txt b/samples/net/wpan_serial/CMakeLists.txt new file mode 100644 index 0000000000..e5ef543f2e --- /dev/null +++ b/samples/net/wpan_serial/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/wpanusb/CMakeLists.txt b/samples/net/wpanusb/CMakeLists.txt new file mode 100644 index 0000000000..e5ef543f2e --- /dev/null +++ b/samples/net/wpanusb/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/net/zperf/CMakeLists.txt b/samples/net/zperf/CMakeLists.txt new file mode 100644 index 0000000000..0d3312412d --- /dev/null +++ b/samples/net/zperf/CMakeLists.txt @@ -0,0 +1,49 @@ +set(QEMU_NET_STACK 1) + +macro(set_conf_file) + if(PROFILER) + set(CONF_FILE prj_${BOARD}_prof.conf) + else() + set(CONF_FILE prj_${BOARD}.conf) + endif() +endmacro() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources( + app PRIVATE + src/shell_utils.c + src/zperf_session.c + src/zperf_shell.c + ) +target_sources_ifdef( + CONFIG_NET_UDP + app PRIVATE + src/zperf_udp_receiver.c + src/zperf_udp_uploader.c + ) +target_sources_ifdef( + CONFIG_NET_TCP + app PRIVATE + src/zperf_tcp_receiver.c + src/zperf_tcp_uploader.c + ) + +target_compile_definitions_ifdef( + PROFILER + app PRIVATE + PROFILER + ) + +target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE}/subsys/net/ip + $ENV{ZEPHYR_BASE}/samples/task_profiler/profiler/src + ) + +if(PROFILER) + assert(0 "PROFILER is not supported yet") + # KBuild did this, but this did not work, not sure why. + # export PROFILER_NO_SHELL_REGISTER=1 + # obj-y += ../../../task_profiler/profiler/ +endif() diff --git a/samples/nfc/nfc_hello/CMakeLists.txt b/samples/nfc/nfc_hello/CMakeLists.txt new file mode 100644 index 0000000000..193e7d1ebb --- /dev/null +++ b/samples/nfc/nfc_hello/CMakeLists.txt @@ -0,0 +1,7 @@ +list(APPEND QEMU_EXTRA_FLAGS -serial tcp:localhost:8888) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/philosophers/CMakeLists.txt b/samples/philosophers/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/philosophers/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/sensor/apds9960/CMakeLists.txt b/samples/sensor/apds9960/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/apds9960/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/bme280/CMakeLists.txt b/samples/sensor/bme280/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/bme280/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/bmg160/CMakeLists.txt b/samples/sensor/bmg160/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/bmg160/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/bmi160/CMakeLists.txt b/samples/sensor/bmi160/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/bmi160/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/bmm150/CMakeLists.txt b/samples/sensor/bmm150/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/bmm150/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/fxas21002/CMakeLists.txt b/samples/sensor/fxas21002/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/fxas21002/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/fxos8700/CMakeLists.txt b/samples/sensor/fxos8700/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/fxos8700/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/hts221/CMakeLists.txt b/samples/sensor/hts221/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/hts221/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/magn_polling/CMakeLists.txt b/samples/sensor/magn_polling/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/magn_polling/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/max30101/CMakeLists.txt b/samples/sensor/max30101/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/max30101/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/max44009/CMakeLists.txt b/samples/sensor/max44009/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/max44009/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/mcp9808/CMakeLists.txt b/samples/sensor/mcp9808/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/mcp9808/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/sx9500/CMakeLists.txt b/samples/sensor/sx9500/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/sx9500/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/th02/CMakeLists.txt b/samples/sensor/th02/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/th02/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/thermometer/CMakeLists.txt b/samples/sensor/thermometer/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/thermometer/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/sensor/tmp112/CMakeLists.txt b/samples/sensor/tmp112/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/sensor/tmp112/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/console/echo/CMakeLists.txt b/samples/subsys/console/echo/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/subsys/console/echo/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/console/getchar/CMakeLists.txt b/samples/subsys/console/getchar/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/subsys/console/getchar/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/console/getline/CMakeLists.txt b/samples/subsys/console/getline/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/subsys/console/getline/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/debug/sysview/CMakeLists.txt b/samples/subsys/debug/sysview/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/debug/sysview/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/ipc/ipm_mailbox/ap/CMakeLists.txt b/samples/subsys/ipc/ipm_mailbox/ap/CMakeLists.txt new file mode 100644 index 0000000000..6e5bd0a63c --- /dev/null +++ b/samples/subsys/ipc/ipm_mailbox/ap/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/drivers) +target_sources(app PRIVATE src/hello.c) diff --git a/samples/subsys/ipc/ipm_mailbox/sensor/CMakeLists.txt b/samples/subsys/ipc/ipm_mailbox/sensor/CMakeLists.txt new file mode 100644 index 0000000000..6e5bd0a63c --- /dev/null +++ b/samples/subsys/ipc/ipm_mailbox/sensor/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/drivers) +target_sources(app PRIVATE src/hello.c) diff --git a/samples/subsys/logging/kernel_event_logger/CMakeLists.txt b/samples/subsys/logging/kernel_event_logger/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/logging/kernel_event_logger/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/logging/logger-hook/CMakeLists.txt b/samples/subsys/logging/logger-hook/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/logging/logger-hook/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/shell/shell/CMakeLists.txt b/samples/subsys/shell/shell/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/shell/shell/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/cdc_acm/CMakeLists.txt b/samples/subsys/usb/cdc_acm/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/usb/cdc_acm/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/console/CMakeLists.txt b/samples/subsys/usb/console/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/usb/console/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/dfu/CMakeLists.txt b/samples/subsys/usb/dfu/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/usb/dfu/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/mass/CMakeLists.txt b/samples/subsys/usb/mass/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/usb/mass/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/webusb/CMakeLists.txt b/samples/subsys/usb/webusb/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/subsys/usb/webusb/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/synchronization/CMakeLists.txt b/samples/synchronization/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/samples/synchronization/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/testing/integration/CMakeLists.txt b/samples/testing/integration/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/samples/testing/integration/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/testing/unit/CMakeLists.txt b/samples/testing/unit/CMakeLists.txt new file mode 100644 index 0000000000..9e30fa8d89 --- /dev/null +++ b/samples/testing/unit/CMakeLists.txt @@ -0,0 +1,5 @@ +list(APPEND INCLUDE subsys) + +include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) +project(none) + diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100644 index 0000000000..9d59674451 --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.6) +Project(Zehpyr-Host-Tools) + +# fixdep is added because all files depend on autoconf.h, +# which would imply that changing the configuration triggers a complete rebuild. +# The build time is not that long though, and also fixdep would not work with Ninja +# as the build system generator because Ninja creates it's on header dependency cache. +# Suggestion is to stop using fixdep. +# add_executable(fixdep basic/fixdep.c) + +add_subdirectory(kconfig) diff --git a/scripts/cmake/FindRegex.cmake b/scripts/cmake/FindRegex.cmake new file mode 100644 index 0000000000..152867fa8f --- /dev/null +++ b/scripts/cmake/FindRegex.cmake @@ -0,0 +1,20 @@ +find_path(Regex_INCLUDE_DIR NAMES regex.h DOC "libregex include directory") +mark_as_advanced(Regex_INCLUDE_DIR) + +find_library(Regex_LIBRARY "regex" DOC "libregex libraries") +mark_as_advanced(Regex_LIBRARY) + +find_package_handle_standard_args(Regex + FOUND_VAR Regex_FOUND + REQUIRED_VARS Regex_INCLUDE_DIR + FAIL_MESSAGE "Failed to find libregex" +) + +if(Regex_FOUND) + set(Regex_INCLUDE_DIRS ${Regex_INCLUDE_DIRS}) + if(Regex_LIBRARY) + set(Regex_LIBRARIES ${Regex_LIBRARY}) + else() + unset(Regex_LIBRARIES) + endif() +endif() diff --git a/scripts/kconfig/CMakeLists.txt b/scripts/kconfig/CMakeLists.txt new file mode 100644 index 0000000000..7248cfd5ef --- /dev/null +++ b/scripts/kconfig/CMakeLists.txt @@ -0,0 +1,115 @@ +add_compile_options( + -Wall + -Wmissing-prototypes + -Wstrict-prototypes + -O2 + -fomit-frame-pointer + -std=gnu89 + -Wno-format-security + -DKBUILD_NO_NLS +) + +# TODO: fix these warnings +add_compile_options( + -Wno-pointer-to-int-cast + -Wno-int-to-pointer-cast +) + +add_definitions( + -DKERNEL_VERSION=0 + -DCURSES_LOC= + -DNCURSES_WIDECHAR=1 + -DLOCALE + -DKBUILD_NO_NL +) + +if(MINGW) + get_filename_component(MINGW_BIN_DIR ${CMAKE_C_COMPILER} DIRECTORY) + set(CMAKE_INCLUDE_PATH ${MINGW_BIN_DIR}/../include) + set(CMAKE_LIBRARY_PATH ${MINGW_BIN_DIR}/../lib) +endif() + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +find_package(Curses REQUIRED) +find_package(Regex REQUIRED) + +include_directories( + ${CURSES_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) +if(CURSES_HAVE_NCURSES_CURSES_H) + include_directories(${CURSES_INCLUDE_DIRS}/ncurses) +endif() + + +configure_file(zconf.tab.c_shipped zconf.tab.c @ONLY) +configure_file(zconf.lex.c_shipped zconf.lex.c @ONLY) +configure_file(zconf.hash.c_shipped zconf.hash.c @ONLY) + +add_executable(conf + conf.c + zconf.tab.c +) +target_link_libraries(conf ${Regex_LIBRARIES}) + +add_executable(mconf + mconf.c + zconf.tab.c + lxdialog/checklist.c + lxdialog/inputbox.c + lxdialog/menubox.c + lxdialog/textbox.c + lxdialog/util.c + lxdialog/yesno.c +) +target_link_libraries(mconf ${CURSES_LIBRARIES} ${Regex_LIBRARIES}) + +# Build a GTK-based frontend to Kconfig if the necessary dependencies +# are already installed. +find_package (PkgConfig) +if(PkgConfig_FOUND) + pkg_check_modules (GTK2 gtk+-2.0 libglade-2.0) + if(GTK2_FOUND) + message(STATUS "Found GTK+-2.0 and libglade-2.0, will build gconf") + add_executable(gconf + gconf.c + zconf.tab.c + ) + target_include_directories( gconf PRIVATE ${GTK2_INCLUDE_DIRS}) + target_link_libraries( gconf PRIVATE ${GTK2_LIBRARY_DIRS}) + target_compile_options( gconf PRIVATE ${GTK2_CFLAGS_OTHER}) + target_link_libraries( gconf PRIVATE ${GTK2_LIBRARIES}) + target_link_libraries( gconf PRIVATE -Wl,--export-dynamic) + file(COPY gconf.glade DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + endif() +endif() +if(NOT GTK2_FOUND) + message(STATUS "Skipped building gconf since GTK dependencies were not met.") +endif() + +# Build a QT-based frontend to Kconfig if the necessary dependencies +# are already installed. +# FIXME: Support other QT versions +find_package(Qt4 COMPONENTS QtGui QtNetwork QtSql QtCore Qt3Support) +if(Qt4_FOUND) + set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(CMAKE_AUTOMOC ON) + + add_executable(qconf + qconf.cc + zconf.tab.c + ) + target_compile_options(qconf PRIVATE -Wfatal-errors) + + target_link_libraries(qconf + Qt4::QtGui + Qt4::QtNetwork + Qt4::QtSql + Qt4::QtCore + Qt4::Qt3Support + ) +else() + message(STATUS "Skipped building qconf since QT dependencies were not found.") +endif() diff --git a/scripts/kconfig/merge_config.py b/scripts/kconfig/merge_config.py new file mode 100644 index 0000000000..c4ab8c5d1f --- /dev/null +++ b/scripts/kconfig/merge_config.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import argparse +import re + +def arguments_parse(): + parser = argparse.ArgumentParser() + parser.add_argument('-q', dest="quiet", action='store_true') + parser.add_argument('-m', dest='runmake', action='store_false', + help='only merge the fragments, do not execute the make command') + parser.add_argument('-n', dest='alltarget', action='store_const', const='allnoconfig', default='alldefconfig', + help='use allnoconfig instead of alldefconfig') + parser.add_argument('-r', dest='warnredun', action='store_true', + help='list redundant entries when merging fragments') + parser.add_argument('-O', dest='output_dir', + help='to put generated output files', default='.') + parser.add_argument('config', nargs='+') + + return parser.parse_args() + + +def main(): + args = arguments_parse() + + pattern = re.compile('^(CONFIG_[a-zA-Z0-9_]*)[= ].*') + config_values = {} + + for config_file in args.config[:]: + print("Merging %s" % config_file) + with open(config_file, 'r') as file: + for line in file: + match = pattern.match(line) + if match: + config_name = match.group(1) + config_full = match.group(0) + if config_name in config_values: + if config_values[config_name] != config_full and not args.quiet: + print("Value of %s is redefined by fragment %s" % (config_name, config_file)) + print("Previous value %s" % config_values[config_name]) + print("new value %s" % config_full) + elif args.warnredun: + print("Value of %s is redundant by fragment %s" % (config_name, config_file)) + config_values[config_name] = config_full + + if args.runmake: + print("Running make not yet supported") + + with open('%s/.config' % args.output_dir, 'w') as out_config: + out_config.write('\n'.join(map(lambda x: x[1], config_values.items()))) + +if __name__ == "__main__": + main() diff --git a/subsys/CMakeLists.txt b/subsys/CMakeLists.txt new file mode 100644 index 0000000000..ebe34b624a --- /dev/null +++ b/subsys/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(debug) +add_subdirectory(logging) +add_subdirectory_ifdef(CONFIG_BT bluetooth) +add_subdirectory_ifdef(CONFIG_CONSOLE_PULL console) +add_subdirectory_ifdef(CONFIG_CONSOLE_SHELL shell) +add_subdirectory_ifdef(CONFIG_CPLUSPLUS cpp) +add_subdirectory_ifdef(CONFIG_DISK_ACCESS disk) +add_subdirectory_ifdef(CONFIG_FILE_SYSTEM fs) +add_subdirectory_ifdef(CONFIG_MCUBOOT_IMG_MANAGER dfu) +add_subdirectory_ifdef(CONFIG_NET_BUF net) +add_subdirectory_ifdef(CONFIG_USB usb) +add_subdirectory(random) diff --git a/subsys/bluetooth/CMakeLists.txt b/subsys/bluetooth/CMakeLists.txt new file mode 100644 index 0000000000..0722d5bc44 --- /dev/null +++ b/subsys/bluetooth/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(subsys__bluetooth INTERFACE) + +target_include_directories(subsys__bluetooth INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +add_subdirectory(common) +add_subdirectory_ifdef(CONFIG_BT_HCI host) +add_subdirectory_ifdef(CONFIG_BT_CTLR controller) +add_subdirectory_ifdef(CONFIG_BT_SHELL shell) + +target_link_libraries(subsys__bluetooth INTERFACE zephyr_interface) diff --git a/subsys/bluetooth/common/CMakeLists.txt b/subsys/bluetooth/common/CMakeLists.txt new file mode 100644 index 0000000000..50d1afe481 --- /dev/null +++ b/subsys/bluetooth/common/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_library() + +zephyr_library_sources(dummy.c) + +zephyr_library_sources_ifdef(CONFIG_BT_DEBUG log.c) +zephyr_library_sources_ifdef(CONFIG_BT_RPA rpa.c) + +zephyr_library_link_libraries(subsys__bluetooth) diff --git a/subsys/bluetooth/controller/CMakeLists.txt b/subsys/bluetooth/controller/CMakeLists.txt new file mode 100644 index 0000000000..f5a70c9dda --- /dev/null +++ b/subsys/bluetooth/controller/CMakeLists.txt @@ -0,0 +1,39 @@ +zephyr_library() +zephyr_library_sources( + util/mem.c + util/memq.c + util/mayfly.c + util/util.c + hal/nrf5/cntr.c + hal/nrf5/rand.c + hal/nrf5/ecb.c + hal/nrf5/radio.c + ticker/ticker.c + ll_sw/ctrl.c + ll_sw/crypto.c + ll_sw/ll.c + ll_sw/ll_filter.c + hci/hci_driver.c + hci/hci.c + ) + +zephyr_library_sources_ifdef(CONFIG_BT_BROADCASTER ll_sw/ll_adv.c) +zephyr_library_sources_ifdef(CONFIG_BT_OBSERVER ll_sw/ll_scan.c) +zephyr_library_sources_ifdef(CONFIG_BT_CENTRAL ll_sw/ll_master.c) +zephyr_library_sources_ifdef(CONFIG_BT_CTLR_DTM ll_sw/ll_test.c) + +zephyr_library_include_directories( + . + util + hal + ticker + ll + include +) + +zephyr_library_compile_options_ifdef( + CONFIG_BT_CTLR_FAST_ENC + -Ofast + ) + +zephyr_library_link_libraries(subsys__bluetooth) diff --git a/subsys/bluetooth/host/CMakeLists.txt b/subsys/bluetooth/host/CMakeLists.txt new file mode 100644 index 0000000000..d1cc3ddc11 --- /dev/null +++ b/subsys/bluetooth/host/CMakeLists.txt @@ -0,0 +1,56 @@ +zephyr_library() +zephyr_library_link_libraries(subsys__bluetooth) + +zephyr_library_sources_ifdef(CONFIG_BT_HCI_RAW hci_raw.c) +zephyr_library_sources_ifdef(CONFIG_BT_DEBUG_MONITOR monitor.c) +zephyr_library_sources_ifdef(CONFIG_BT_TINYCRYPT_ECC hci_ecc.c) +zephyr_library_sources_ifdef(CONFIG_BT_INTERNAL_STORAGE storage.c) +zephyr_library_sources_ifdef(CONFIG_BT_A2DP a2dp.c) +zephyr_library_sources_ifdef(CONFIG_BT_AVDTP avdtp.c) +zephyr_library_sources_ifdef(CONFIG_BT_RFCOMM rfcomm.c) + +zephyr_library_sources_ifdef( + CONFIG_BT_BREDR + keys_br.c + l2cap_br.c + sdp.c + ) + +zephyr_library_sources_ifdef( + CONFIG_BT_HFP_HF + hfp_hf.c + at.c + ) + +if(CONFIG_BT_HCI_HOST) + zephyr_library_sources( + uuid.c + hci_core.c + ) + zephyr_library_sources_ifdef( + CONFIG_BT_HOST_CRYPTO + crypto.c + ) + + if(CONFIG_BT_CONN) + zephyr_library_sources( + conn.c + l2cap.c + att.c + gatt.c + ) + + if(CONFIG_BT_SMP) + zephyr_library_sources( + smp.c + keys.c + ) + else() + zephyr_library_sources( + smp_null.c + ) + endif() + endif() +endif() + +add_subdirectory_ifdef(CONFIG_BT_MESH mesh) diff --git a/subsys/bluetooth/host/mesh/CMakeLists.txt b/subsys/bluetooth/host/mesh/CMakeLists.txt new file mode 100644 index 0000000000..35df5ab930 --- /dev/null +++ b/subsys/bluetooth/host/mesh/CMakeLists.txt @@ -0,0 +1,24 @@ +zephyr_library() +zephyr_library_link_libraries(subsys__bluetooth) + +zephyr_library_sources_ifdef(CONFIG_BT_MESH + main.c + adv.c + beacon.c + net.c + transport.c + crypto.c + access.c + cfg.c + health.c +) + +zephyr_library_sources_ifdef(CONFIG_BT_MESH_LOW_POWER lpn.c) + +zephyr_library_sources_ifdef(CONFIG_BT_MESH_FRIEND friend.c) + +zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV prov.c) + +zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROXY proxy.c) + +zephyr_library_sources_ifdef(CONFIG_BT_MESH_SELF_TEST test.c) diff --git a/subsys/bluetooth/shell/CMakeLists.txt b/subsys/bluetooth/shell/CMakeLists.txt new file mode 100644 index 0000000000..98db038b99 --- /dev/null +++ b/subsys/bluetooth/shell/CMakeLists.txt @@ -0,0 +1,10 @@ +zephyr_library() +zephyr_library_sources( + bt.c + gatt.c + ) +zephyr_library_sources_ifdef(CONFIG_BT_CTLR + ll.c + ticker.c + ) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF5 flash.c) diff --git a/subsys/console/CMakeLists.txt b/subsys/console/CMakeLists.txt new file mode 100644 index 0000000000..6a54379e96 --- /dev/null +++ b/subsys/console/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_CONSOLE_GETCHAR getchar.c) +zephyr_sources_ifdef(CONFIG_CONSOLE_GETLINE getline.c) diff --git a/subsys/cpp/CMakeLists.txt b/subsys/cpp/CMakeLists.txt new file mode 100644 index 0000000000..5daacc8a2c --- /dev/null +++ b/subsys/cpp/CMakeLists.txt @@ -0,0 +1,7 @@ +zephyr_sources_ifdef(CONFIG_CPLUSPLUS + cpp_virtual.c + cpp_vtable.cpp + cpp_init_array.c + cpp_ctors.c + cpp_dtors.c +) diff --git a/subsys/debug/CMakeLists.txt b/subsys/debug/CMakeLists.txt new file mode 100644 index 0000000000..e7aeac85e4 --- /dev/null +++ b/subsys/debug/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources_ifdef( + CONFIG_OPENOCD_SUPPORT + openocd.c + ) diff --git a/subsys/dfu/CMakeLists.txt b/subsys/dfu/CMakeLists.txt new file mode 100644 index 0000000000..d7d4d6ebd0 --- /dev/null +++ b/subsys/dfu/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(boot) +add_subdirectory(img_util) diff --git a/subsys/dfu/boot/CMakeLists.txt b/subsys/dfu/boot/CMakeLists.txt new file mode 100644 index 0000000000..b3c922014c --- /dev/null +++ b/subsys/dfu/boot/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_MCUBOOT_IMG_MANAGER mcuboot.c) diff --git a/subsys/dfu/img_util/CMakeLists.txt b/subsys/dfu/img_util/CMakeLists.txt new file mode 100644 index 0000000000..5f1553ea94 --- /dev/null +++ b/subsys/dfu/img_util/CMakeLists.txt @@ -0,0 +1 @@ +zephyr_sources_ifdef(CONFIG_MCUBOOT_IMG_MANAGER flash_img.c) diff --git a/subsys/disk/CMakeLists.txt b/subsys/disk/CMakeLists.txt new file mode 100644 index 0000000000..5ddf689801 --- /dev/null +++ b/subsys/disk/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_DISK_ACCESS_RAM disk_access_ram.c) +zephyr_sources_ifdef(CONFIG_DISK_ACCESS_FLASH disk_access_flash.c) diff --git a/subsys/fs/CMakeLists.txt b/subsys/fs/CMakeLists.txt new file mode 100644 index 0000000000..cb2d299c38 --- /dev/null +++ b/subsys/fs/CMakeLists.txt @@ -0,0 +1,10 @@ +zephyr_link_interface_ifdef(CONFIG_FAT_FILESYSTEM_ELM ELMFAT) +zephyr_link_interface_ifdef(CONFIG_FILE_SYSTEM_NFFS NFFS) + +zephyr_library() +zephyr_library_sources_ifdef(CONFIG_FAT_FILESYSTEM_ELM fat_fs.c) +zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_NFFS nffs_fs.c) +zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_SHELL shell.c) + +zephyr_library_link_libraries_ifdef(CONFIG_FAT_FILESYSTEM_ELM ELMFAT) +zephyr_library_link_libraries_ifdef(CONFIG_FILE_SYSTEM_NFFS NFFS) diff --git a/subsys/logging/CMakeLists.txt b/subsys/logging/CMakeLists.txt new file mode 100644 index 0000000000..4a6a1de6b1 --- /dev/null +++ b/subsys/logging/CMakeLists.txt @@ -0,0 +1,6 @@ +zephyr_sources_ifdef(CONFIG_SYS_LOG sys_log.c) +zephyr_sources_ifdef( + CONFIG_KERNEL_EVENT_LOGGER + event_logger.c + kernel_event_logger.c + ) diff --git a/subsys/net/CMakeLists.txt b/subsys/net/CMakeLists.txt new file mode 100644 index 0000000000..97856919b6 --- /dev/null +++ b/subsys/net/CMakeLists.txt @@ -0,0 +1,13 @@ +zephyr_library() +zephyr_library_sources_ifdef(CONFIG_NET_BUF buf.c) +zephyr_library_sources_ifdef(CONFIG_NET_HOSTNAME_ENABLE hostname.c) + +if(CONFIG_NETWORKING) + if(CONFIG_NET_L2_RAW_CHANNEL) + zephyr_library_sources(ip/net_pkt.c) + else() + add_subdirectory(ip) + endif() +endif() + +add_subdirectory(lib) diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt new file mode 100644 index 0000000000..200d62f17d --- /dev/null +++ b/subsys/net/ip/CMakeLists.txt @@ -0,0 +1,47 @@ +zephyr_link_interface_ifdef(CONFIG_MBEDTLS mbedTLS) +zephyr_library() +zephyr_library_include_directories(.) +zephyr_library_compile_definitions_ifdef(CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__) + +zephyr_library_sources( + net_context.c + net_core.c + net_if.c + net_pkt.c + utils.c + ) + +zephyr_library_sources_ifdef(CONFIG_NET_6LO 6lo.c) +zephyr_library_sources_ifdef(CONFIG_NET_DHCPV4 dhcpv4.c) +zephyr_library_sources_ifdef(CONFIG_NET_IPV4 icmpv4.c ipv4.c) +zephyr_library_sources_ifdef(CONFIG_NET_IPV6 icmpv6.c nbr.c ipv6.c) +zephyr_library_sources_ifdef(CONFIG_NET_MGMT_EVENT net_mgmt.c) +zephyr_library_sources_ifdef(CONFIG_NET_ROUTE route.c) +zephyr_library_sources_ifdef(CONFIG_NET_RPL rpl.c) +zephyr_library_sources_ifdef(CONFIG_NET_RPL_MRHOF rpl-mrhof.c) +zephyr_library_sources_ifdef(CONFIG_NET_RPL_OF0 rpl-of0.c) +zephyr_library_sources_ifdef(CONFIG_NET_SHELL net_shell.c) +zephyr_library_sources_ifdef(CONFIG_NET_STATISTICS net_stats.c) +zephyr_library_sources_ifdef(CONFIG_NET_TCP connection.c tcp.c) +zephyr_library_sources_ifdef(CONFIG_NET_TRICKLE trickle.c) +zephyr_library_sources_ifdef(CONFIG_NET_UDP connection.c udp.c) + +zephyr_library_sources_ifdef(CONFIG_NET_ARP l2/arp.c) +zephyr_library_sources_ifdef(CONFIG_NET_L2_BT l2/bluetooth.c) +zephyr_library_sources_ifdef(CONFIG_NET_L2_BT_SHELL l2/bluetooth_shell.c) +zephyr_library_sources_ifdef(CONFIG_NET_L2_DUMMY l2/dummy.c) +zephyr_library_sources_ifdef(CONFIG_NET_L2_ETHERNET l2/ethernet.c) + +if(CONFIG_NET_L2_IEEE802154) + zephyr_library_sources(l2/ieee802154/ieee802154.c) + zephyr_library_sources(l2/ieee802154/ieee802154_frame.c) + + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154_FRAGMENT l2/ieee802154/ieee802154_fragment.c) + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154_MGMT l2/ieee802154/ieee802154_mgmt.c) + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154_RADIO_ALOHA l2/ieee802154/ieee802154_radio_aloha.c) + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA l2/ieee802154/ieee802154_radio_csma_ca.c) + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154_SECURITY l2/ieee802154/ieee802154_security.c) + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154_SHELL l2/ieee802154/ieee802154_shell.c) +endif() + +zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/subsys/net/ip/l2/CMakeLists.txt b/subsys/net/ip/l2/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/subsys/net/ip/l2/ieee802154/CMakeLists.txt b/subsys/net/ip/l2/ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt new file mode 100644 index 0000000000..f1cfbc3921 --- /dev/null +++ b/subsys/net/lib/CMakeLists.txt @@ -0,0 +1,9 @@ +add_subdirectory_if_kconfig(coap) +add_subdirectory_if_kconfig(lwm2m) +add_subdirectory_if_kconfig(sntp) +add_subdirectory_if_kconfig(zoap) +add_subdirectory_ifdef(CONFIG_DNS_RESOLVER dns) +add_subdirectory_ifdef(CONFIG_HTTP http) +add_subdirectory_ifdef(CONFIG_MQTT_LIB mqtt) +add_subdirectory_ifdef(CONFIG_NET_APP_SETTINGS app) +add_subdirectory_ifdef(CONFIG_NET_SOCKETS sockets) diff --git a/subsys/net/lib/app/CMakeLists.txt b/subsys/net/lib/app/CMakeLists.txt new file mode 100644 index 0000000000..0bfaf05325 --- /dev/null +++ b/subsys/net/lib/app/CMakeLists.txt @@ -0,0 +1,13 @@ +zephyr_link_interface_ifdef(CONFIG_MBEDTLS mbedTLS) +zephyr_library() +zephyr_library_compile_definitions_ifdef(CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__) + +zephyr_library_sources_ifdef(CONFIG_NET_APP init.c) +zephyr_library_sources_ifdef(CONFIG_NET_APP_SERVER net_app.c server.c) +zephyr_library_sources_ifdef(CONFIG_NET_APP_CLIENT net_app.c client.c) + +if(CONFIG_NET_APP_SETTINGS) + zephyr_library_sources_ifdef(CONFIG_NET_L2_IEEE802154 ieee802154_settings.c) + zephyr_library_sources_ifdef(CONFIG_NET_L2_BT bt_settings.c) +endif() +zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/subsys/net/lib/coap/CMakeLists.txt b/subsys/net/lib/coap/CMakeLists.txt new file mode 100644 index 0000000000..e304d0ba24 --- /dev/null +++ b/subsys/net/lib/coap/CMakeLists.txt @@ -0,0 +1,6 @@ +zephyr_include_directories(.) + +zephyr_sources( + coap.c + coap_link_format.c +) diff --git a/subsys/net/lib/dns/CMakeLists.txt b/subsys/net/lib/dns/CMakeLists.txt new file mode 100644 index 0000000000..631bf817ee --- /dev/null +++ b/subsys/net/lib/dns/CMakeLists.txt @@ -0,0 +1,12 @@ +zephyr_include_directories(.) + +zephyr_library() +zephyr_library_sources(dns_pack.c) + +zephyr_library_sources_ifdef(CONFIG_DNS_RESOLVER resolve.c) + +if(CONFIG_MDNS_RESPONDER) + zephyr_library_sources(mdns_responder.c) + zephyr_library_include_directories($ENV{ZEPHYR_BASE}/subsys/net/ip) +endif() + diff --git a/subsys/net/lib/http/CMakeLists.txt b/subsys/net/lib/http/CMakeLists.txt new file mode 100644 index 0000000000..9510b0850a --- /dev/null +++ b/subsys/net/lib/http/CMakeLists.txt @@ -0,0 +1,21 @@ +zephyr_link_interface_ifdef(CONFIG_MBEDTLS mbedTLS) +zephyr_library() + +if(CONFIG_HTTP_PARSER_STRICT) +zephyr_library_compile_definitions(HTTP_PARSER_STRICT) +endif() + +zephyr_library_sources_if_kconfig(http_parser.c) +zephyr_library_sources_if_kconfig(http_parser_url.c) + +if(CONFIG_HTTP_APP) + zephyr_library_sources(http_app.c) + + zephyr_library_sources_ifdef(CONFIG_HTTP_SERVER http_app_server.c) + zephyr_library_sources_ifdef(CONFIG_HTTP_CLIENT http_app_client.c) +else() + zephyr_library_sources_ifdef(CONFIG_HTTP_SERVER http_server.c) + zephyr_library_sources_ifdef(CONFIG_HTTP_CLIENT http_client.c) +endif() + +zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/subsys/net/lib/lwm2m/CMakeLists.txt b/subsys/net/lib/lwm2m/CMakeLists.txt new file mode 100644 index 0000000000..291d356082 --- /dev/null +++ b/subsys/net/lib/lwm2m/CMakeLists.txt @@ -0,0 +1,36 @@ +zephyr_include_directories(.) + +zephyr_sources( + lwm2m_engine.c + lwm2m_obj_security.c + lwm2m_obj_server.c + lwm2m_obj_device.c + lwm2m_rw_plain_text.c + lwm2m_rw_oma_tlv.c + ) + +# LWM2M RD Client Support +zephyr_sources_ifdef(CONFIG_LWM2M_RD_CLIENT_SUPPORT + lwm2m_rd_client.c + ) + +# LWM2M Object Support +zephyr_sources_ifdef(CONFIG_LWM2M_FIRMWARE_UPDATE_OBJ_SUPPORT + lwm2m_obj_firmware.c + ) +zephyr_sources_ifdef(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT + lwm2m_obj_firmware_pull.c + ) + +# JSON Support +zephyr_sources_ifdef(CONFIG_LWM2M_RW_JSON_SUPPORT + lwm2m_rw_json.c + ) + +# IPSO Objects +zephyr_sources_ifdef(CONFIG_LWM2M_IPSO_TEMP_SENSOR + ipso_temp_sensor.c + ) +zephyr_sources_ifdef(CONFIG_LWM2M_IPSO_LIGHT_CONTROL + ipso_light_control.c + ) diff --git a/subsys/net/lib/mqtt/CMakeLists.txt b/subsys/net/lib/mqtt/CMakeLists.txt new file mode 100644 index 0000000000..8455fb6d27 --- /dev/null +++ b/subsys/net/lib/mqtt/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_link_interface_ifdef(CONFIG_MBEDTLS mbedTLS) +zephyr_library() +zephyr_library_sources( + mqtt_pkt.c + mqtt.c +) + +zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/subsys/net/lib/sntp/CMakeLists.txt b/subsys/net/lib/sntp/CMakeLists.txt new file mode 100644 index 0000000000..da2b097d4e --- /dev/null +++ b/subsys/net/lib/sntp/CMakeLists.txt @@ -0,0 +1,3 @@ +zephyr_sources( + sntp.c +) diff --git a/subsys/net/lib/sockets/CMakeLists.txt b/subsys/net/lib/sockets/CMakeLists.txt new file mode 100644 index 0000000000..94ed549b22 --- /dev/null +++ b/subsys/net/lib/sockets/CMakeLists.txt @@ -0,0 +1,5 @@ +zephyr_include_directories(.) +zephyr_sources( + getaddrinfo.c + sockets.c + ) diff --git a/subsys/net/lib/zoap/CMakeLists.txt b/subsys/net/lib/zoap/CMakeLists.txt new file mode 100644 index 0000000000..aaa238a9d7 --- /dev/null +++ b/subsys/net/lib/zoap/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_include_directories(.) +zephyr_sources(zoap.c zoap_link_format.c) diff --git a/subsys/random/CMakeLists.txt b/subsys/random/CMakeLists.txt new file mode 100644 index 0000000000..25846773d2 --- /dev/null +++ b/subsys/random/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources_ifdef(CONFIG_TIMER_RANDOM_GENERATOR rand32_timer.c) +zephyr_sources_ifdef(CONFIG_X86_TSC_RANDOM_GENERATOR rand32_timestamp.c) +zephyr_sources_ifdef(CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR rand32_entropy_device.c) +zephyr_sources_ifdef(CONFIG_XOROSHIRO_RANDOM_GENERATOR rand32_xoroshiro128.c) diff --git a/subsys/shell/CMakeLists.txt b/subsys/shell/CMakeLists.txt new file mode 100644 index 0000000000..0db0cb74a5 --- /dev/null +++ b/subsys/shell/CMakeLists.txt @@ -0,0 +1,10 @@ +zephyr_include_directories_ifdef(CONFIG_CONSOLE_SHELL + $ENV{ZEPHYR_BASE}/include/drivers + ) + +zephyr_sources( + shell_service.c + shell.c + ) + +add_subdirectory(modules) diff --git a/subsys/shell/modules/CMakeLists.txt b/subsys/shell/modules/CMakeLists.txt new file mode 100644 index 0000000000..a1d03ece07 --- /dev/null +++ b/subsys/shell/modules/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources_ifdef( + CONFIG_KERNEL_SHELL + kernel_service.c + ) diff --git a/subsys/usb/CMakeLists.txt b/subsys/usb/CMakeLists.txt new file mode 100644 index 0000000000..4052cce5c6 --- /dev/null +++ b/subsys/usb/CMakeLists.txt @@ -0,0 +1,14 @@ +if(CONFIG_USB_DEVICE_STACK) + zephyr_sources( + usb_device.c + usb_descriptor.c + ) + + add_subdirectory(class) +endif() + +if(CONFIG_USB_COMPOSITE_DEVICE) + zephyr_sources( + composite.c + ) +endif() diff --git a/subsys/usb/class/CMakeLists.txt b/subsys/usb/class/CMakeLists.txt new file mode 100644 index 0000000000..9060918365 --- /dev/null +++ b/subsys/usb/class/CMakeLists.txt @@ -0,0 +1,4 @@ +zephyr_sources_ifdef(CONFIG_USB_CDC_ACM cdc_acm.c) +zephyr_sources_ifdef(CONFIG_USB_MASS_STORAGE mass_storage.c) + +add_subdirectory_ifdef(CONFIG_USB_DEVICE_NETWORK netusb) diff --git a/subsys/usb/class/netusb/CMakeLists.txt b/subsys/usb/class/netusb/CMakeLists.txt new file mode 100644 index 0000000000..d0266f64b8 --- /dev/null +++ b/subsys/usb/class/netusb/CMakeLists.txt @@ -0,0 +1,22 @@ +zephyr_library() + +zephyr_library_include_directories( + # USB headers + $ENV{ZEPHYR_BASE}/include/drivers/usb + $ENV{ZEPHYR_BASE}/include/usb/ + $ENV{ZEPHYR_BASE}/usb/include/ + .. + + # IP headers + $ENV{ZEPHYR_BASE}/subsys/net/ip + ) + +zephyr_library_sources_ifdef( + netusb.c + eth_emu.c + ) + +zephyr_library_sources_ifdef( + CONFIG_USB_DEVICE_NETWORK_ECM + function_ecm.c + ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000000..e5c196577c --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory_if_kconfig(ztest) diff --git a/tests/application_development/gen_inc_file/CMakeLists.txt b/tests/application_development/gen_inc_file/CMakeLists.txt new file mode 100644 index 0000000000..0be9c9862c --- /dev/null +++ b/tests/application_development/gen_inc_file/CMakeLists.txt @@ -0,0 +1,13 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +# Write the generated file into the include/generated directory, which +# is already in the system path +set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/) +set(source_file src/file.bin) + +generate_inc_file_for_target(app ${source_file} ${gen_dir}/file.bin.inc) +generate_inc_file_for_target(app ${source_file} ${gen_dir}/file.bin.gz.inc --gzip) diff --git a/tests/benchmarks/app_kernel/CMakeLists.txt b/tests/benchmarks/app_kernel/CMakeLists.txt new file mode 100644 index 0000000000..5869951855 --- /dev/null +++ b/tests/benchmarks/app_kernel/CMakeLists.txt @@ -0,0 +1,11 @@ +if(BOARD STREQUAL "minnowboard") + set(CONF_FILE prj_fp.conf) +else() + set(CONF_FILE prj_no_fp.conf) +endif() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/benchmarks/boot_time/CMakeLists.txt b/tests/benchmarks/boot_time/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/benchmarks/boot_time/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/benchmarks/footprint/CMakeLists.txt b/tests/benchmarks/footprint/CMakeLists.txt new file mode 100644 index 0000000000..7d5ada79c0 --- /dev/null +++ b/tests/benchmarks/footprint/CMakeLists.txt @@ -0,0 +1,24 @@ +if(NOT DEFINED TEST) + set(TEST min) # Have TEST default to min +endif() + +macro(set_conf_file) + if(EXISTS $ENV{ZEPHYR_BASE}/tests/benchmarks/footprint/${TEST}/${BOARD}.conf) + set(CONF_FILE $ENV{ZEPHYR_BASE}/tests/benchmarks/footprint/${TEST}/${BOARD}.conf) + elseif(EXISTS $ENV{ZEPHYR_BASE}/tests/benchmarks/footprint/${TEST}/${ARCH}.conf) + set(CONF_FILE $ENV{ZEPHYR_BASE}/tests/benchmarks/footprint/${TEST}/${ARCH}.conf) + endif() +endmacro() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +if(${TEST} STREQUAL "float") + set(test_define TEST_max) +else() + set(test_define TEST_${TEST}) +endif() +target_compile_definitions(app PRIVATE ${test_define}) diff --git a/tests/benchmarks/latency_measure/CMakeLists.txt b/tests/benchmarks/latency_measure/CMakeLists.txt new file mode 100644 index 0000000000..366263d183 --- /dev/null +++ b/tests/benchmarks/latency_measure/CMakeLists.txt @@ -0,0 +1,15 @@ +set(small_freq_divider_frdm_k64f TRUE) +set(small_freq_divider_arduino_due TRUE) +set(small_freq_divider_qemu_cortex_m3 TRUE) + +if(small_freq_divider_${BOARD}) + set(CONF_FILE prj_small_freq_divider.conf) +else() + set(CONF_FILE prj.conf) +endif() + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/benchmarks/object_footprint/CMakeLists.txt b/tests/benchmarks/object_footprint/CMakeLists.txt new file mode 100644 index 0000000000..1e59d13795 --- /dev/null +++ b/tests/benchmarks/object_footprint/CMakeLists.txt @@ -0,0 +1,7 @@ +set(KCONFIG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Kconfig) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/benchmarks/sys_kernel/CMakeLists.txt b/tests/benchmarks/sys_kernel/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/benchmarks/sys_kernel/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/benchmarks/timing_info/CMakeLists.txt b/tests/benchmarks/timing_info/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/benchmarks/timing_info/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/bluetooth/bluetooth/CMakeLists.txt b/tests/bluetooth/bluetooth/CMakeLists.txt new file mode 100644 index 0000000000..443d3d49be --- /dev/null +++ b/tests/bluetooth/bluetooth/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/bluetooth.c) diff --git a/tests/bluetooth/init/CMakeLists.txt b/tests/bluetooth/init/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/bluetooth/init/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/bluetooth/mesh/CMakeLists.txt b/tests/bluetooth/mesh/CMakeLists.txt new file mode 100644 index 0000000000..47793145b8 --- /dev/null +++ b/tests/bluetooth/mesh/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr -s) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) +target_sources(app PRIVATE src/main.c) +if(CONFIG_BOARD_BBC_MICROBIT) +target_sources(app PRIVATE src/microbit.c) +endif() diff --git a/tests/bluetooth/shell/CMakeLists.txt b/tests/bluetooth/shell/CMakeLists.txt new file mode 100644 index 0000000000..cf3c18eea0 --- /dev/null +++ b/tests/bluetooth/shell/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) +set(QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/bluetooth/tester/CMakeLists.txt b/tests/bluetooth/tester/CMakeLists.txt new file mode 100644 index 0000000000..b607b23e17 --- /dev/null +++ b/tests/bluetooth/tester/CMakeLists.txt @@ -0,0 +1,18 @@ +set(CONF_FILE default.conf) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +LIST(APPEND QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-stack-tester) +LIST(APPEND QEMU_EXTRA_FLAGS -serial unix:/tmp/bt-server-bredr) + +zephyr_library_include_directories($ENV{ZEPHYR_BASE}/samples/bluetooth) +target_sources(app PRIVATE + src/main.c + src/bttester.c + src/gap.c + src/gatt.c + ) +if(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL) +target_sources(app PRIVATE src/l2cap.c) +endif() diff --git a/tests/booting/stub/CMakeLists.txt b/tests/booting/stub/CMakeLists.txt new file mode 100644 index 0000000000..6daa0b7cc7 --- /dev/null +++ b/tests/booting/stub/CMakeLists.txt @@ -0,0 +1,4 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/crypto/aes/CMakeLists.txt b/tests/crypto/aes/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/aes/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/cbc_mode/CMakeLists.txt b/tests/crypto/cbc_mode/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/cbc_mode/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/ccm_mode/CMakeLists.txt b/tests/crypto/ccm_mode/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/ccm_mode/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/cmac_mode/CMakeLists.txt b/tests/crypto/cmac_mode/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/cmac_mode/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/ctr_mode/CMakeLists.txt b/tests/crypto/ctr_mode/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/ctr_mode/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/ctr_prng/CMakeLists.txt b/tests/crypto/ctr_prng/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/ctr_prng/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/ecc_dh/CMakeLists.txt b/tests/crypto/ecc_dh/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/ecc_dh/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/ecc_dsa/CMakeLists.txt b/tests/crypto/ecc_dsa/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/ecc_dsa/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/hmac/CMakeLists.txt b/tests/crypto/hmac/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/hmac/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/hmac_prng/CMakeLists.txt b/tests/crypto/hmac_prng/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/hmac_prng/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/mbedtls/CMakeLists.txt b/tests/crypto/mbedtls/CMakeLists.txt new file mode 100644 index 0000000000..d21359d836 --- /dev/null +++ b/tests/crypto/mbedtls/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app mbedTLS) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/crypto/sha256/CMakeLists.txt b/tests/crypto/sha256/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/crypto/sha256/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/adc/CMakeLists.txt b/tests/drivers/adc/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/adc/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/adc/adc_api/CMakeLists.txt b/tests/drivers/adc/adc_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/adc/adc_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/adc/adc_simple/CMakeLists.txt b/tests/drivers/adc/adc_simple/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/adc/adc_simple/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/aio/aio_basic_api/CMakeLists.txt b/tests/drivers/aio/aio_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/aio/aio_basic_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/aon_counter/aon_api/CMakeLists.txt b/tests/drivers/aon_counter/aon_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/aon_counter/aon_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/build_all/CMakeLists.txt b/tests/drivers/build_all/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/build_all/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/dma/chan_blen_transfer/CMakeLists.txt b/tests/drivers/dma/chan_blen_transfer/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/dma/loop_transfer/CMakeLists.txt b/tests/drivers/dma/loop_transfer/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/dma/loop_transfer/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/enc28j60/CMakeLists.txt b/tests/drivers/enc28j60/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/enc28j60/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/entropy/api/CMakeLists.txt b/tests/drivers/entropy/api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/entropy/api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/gpio/gpio_basic_api/CMakeLists.txt b/tests/drivers/gpio/gpio_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/i2c/i2c_api/CMakeLists.txt b/tests/drivers/i2c/i2c_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/ipm/CMakeLists.txt b/tests/drivers/ipm/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/ipm/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/nsim_uart/CMakeLists.txt b/tests/drivers/nsim_uart/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/nsim_uart/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/pci_enum/CMakeLists.txt b/tests/drivers/pci_enum/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/pci_enum/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/pinmux/pinmux_basic_api/CMakeLists.txt b/tests/drivers/pinmux/pinmux_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/pinmux/pinmux_basic_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/pwm/pwm_api/CMakeLists.txt b/tests/drivers/pwm/pwm_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/pwm/pwm_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/quark_clock/CMakeLists.txt b/tests/drivers/quark_clock/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/quark_clock/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/rtc/rtc_basic_api/CMakeLists.txt b/tests/drivers/rtc/rtc_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/rtc/rtc_basic_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_basic_api/CMakeLists.txt b/tests/drivers/spi/spi_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/spi/spi_basic_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/spi/spi_loopback/CMakeLists.txt b/tests/drivers/spi/spi_loopback/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/uart/uart_basic_api/CMakeLists.txt b/tests/drivers/uart/uart_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..eb0e8f38dd --- /dev/null +++ b/tests/drivers/uart/uart_basic_api/CMakeLists.txt @@ -0,0 +1,8 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE + src/main.c + src/test_uart_poll.c + ) +target_sources_ifdef(CONFIG_UART_INTERRUPT_DRIVEN app PRIVATE src/test_uart_fifo.c) diff --git a/tests/drivers/watchdog/wdt_basic_api/CMakeLists.txt b/tests/drivers/watchdog/wdt_basic_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/alert/alert_api/CMakeLists.txt b/tests/kernel/alert/alert_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/alert/alert_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/arm_irq_vector_table/CMakeLists.txt b/tests/kernel/arm_irq_vector_table/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/arm_irq_vector_table/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/arm_runtime_nmi/CMakeLists.txt b/tests/kernel/arm_runtime_nmi/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/arm_runtime_nmi/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/bitfield/CMakeLists.txt b/tests/kernel/bitfield/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/bitfield/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/common/CMakeLists.txt b/tests/kernel/common/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/common/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/context/CMakeLists.txt b/tests/kernel/context/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/context/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/critical/CMakeLists.txt b/tests/kernel/critical/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/critical/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/errno/CMakeLists.txt b/tests/kernel/errno/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/errno/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/fatal/CMakeLists.txt b/tests/kernel/fatal/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/fatal/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/fifo/fifo_api/CMakeLists.txt b/tests/kernel/fifo/fifo_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/fifo/fifo_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/fp_sharing/CMakeLists.txt b/tests/kernel/fp_sharing/CMakeLists.txt new file mode 100644 index 0000000000..4028d1cd4f --- /dev/null +++ b/tests/kernel/fp_sharing/CMakeLists.txt @@ -0,0 +1,12 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +# Some boards are significantly slower than others resulting in the test +# output being in the range of every few seconds to every few minutes. To +# compensate for this, one can control the number of iterations in the PI +# calculation through PI_NUM_ITERATIONS. Lowering this value will increase +# the speed of the test but it will come at the expense of precision. +zephyr_compile_definitions(PI_NUM_ITERATIONS=700000) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/gen_isr_table/CMakeLists.txt b/tests/kernel/gen_isr_table/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/gen_isr_table/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/irq_offload/CMakeLists.txt b/tests/kernel/irq_offload/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/irq_offload/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/libs/CMakeLists.txt b/tests/kernel/libs/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/libs/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/lifo/lifo_api/CMakeLists.txt b/tests/kernel/lifo/lifo_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/lifo/lifo_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mbox/mbox_api/CMakeLists.txt b/tests/kernel/mbox/mbox_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mbox/mbox_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_heap/mheap_api_concept/CMakeLists.txt b/tests/kernel/mem_heap/mheap_api_concept/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_heap/mheap_api_concept/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_pool/mem_pool/CMakeLists.txt b/tests/kernel/mem_pool/mem_pool/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_pool/mem_pool/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_pool/mem_pool_api/CMakeLists.txt b/tests/kernel/mem_pool/mem_pool_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_pool/mem_pool_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_pool/mem_pool_concept/CMakeLists.txt b/tests/kernel/mem_pool/mem_pool_concept/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_pool/mem_pool_concept/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_pool/mem_pool_threadsafe/CMakeLists.txt b/tests/kernel/mem_pool/mem_pool_threadsafe/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_pool/mem_pool_threadsafe/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_protect/app_memory/CMakeLists.txt b/tests/kernel/mem_protect/app_memory/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_protect/app_memory/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_protect/obj_validation/CMakeLists.txt b/tests/kernel/mem_protect/obj_validation/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_protect/obj_validation/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_protect/protection/CMakeLists.txt b/tests/kernel/mem_protect/protection/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_protect/protection/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_protect/stackprot/CMakeLists.txt b/tests/kernel/mem_protect/stackprot/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_protect/stackprot/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_slab/mslab/CMakeLists.txt b/tests/kernel/mem_slab/mslab/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_slab/mslab/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_slab/mslab_api/CMakeLists.txt b/tests/kernel/mem_slab/mslab_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_slab/mslab_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_slab/mslab_concept/CMakeLists.txt b/tests/kernel/mem_slab/mslab_concept/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_slab/mslab_concept/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mem_slab/mslab_threadsafe/CMakeLists.txt b/tests/kernel/mem_slab/mslab_threadsafe/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mem_slab/mslab_threadsafe/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/msgq/msgq_api/CMakeLists.txt b/tests/kernel/msgq/msgq_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/msgq/msgq_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/multilib/CMakeLists.txt b/tests/kernel/multilib/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/multilib/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mutex/mutex/CMakeLists.txt b/tests/kernel/mutex/mutex/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mutex/mutex/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/mutex/mutex_api/CMakeLists.txt b/tests/kernel/mutex/mutex_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/mutex/mutex_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/obj_tracing/CMakeLists.txt b/tests/kernel/obj_tracing/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/obj_tracing/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/pending/CMakeLists.txt b/tests/kernel/pending/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/pending/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/pipe/pipe_api/CMakeLists.txt b/tests/kernel/pipe/pipe_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/pipe/pipe_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/poll/CMakeLists.txt b/tests/kernel/poll/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/poll/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/profiling/profiling_api/CMakeLists.txt b/tests/kernel/profiling/profiling_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/profiling/profiling_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/pthread/CMakeLists.txt b/tests/kernel/pthread/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/pthread/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/queue/CMakeLists.txt b/tests/kernel/queue/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/queue/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/semaphore/sema_api/CMakeLists.txt b/tests/kernel/semaphore/sema_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/semaphore/sema_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/sleep/CMakeLists.txt b/tests/kernel/sleep/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/sleep/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/sprintf/CMakeLists.txt b/tests/kernel/sprintf/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/sprintf/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/stack/stack_api/CMakeLists.txt b/tests/kernel/stack/stack_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/stack/stack_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/static_idt/CMakeLists.txt b/tests/kernel/static_idt/CMakeLists.txt new file mode 100644 index 0000000000..3f7a715480 --- /dev/null +++ b/tests/kernel/static_idt/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +include($ENV{ZEPHYR_BASE}/cmake/test/CMakeLists.txt NO_POLICY_SCOPE) +project(NONE) + + +enable_language(C ASM) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources} src/test_stubs.S) diff --git a/tests/kernel/systhreads/CMakeLists.txt b/tests/kernel/systhreads/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/systhreads/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/test_build/CMakeLists.txt b/tests/kernel/test_build/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/test_build/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/test_build/src/main.c b/tests/kernel/test_build/src/main.c new file mode 100644 index 0000000000..3117175377 --- /dev/null +++ b/tests/kernel/test_build/src/main.c @@ -0,0 +1,90 @@ +/* main.c - Hello World demo */ + +/* + * Copyright (c) 2012-2014 Wind River Systems, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/* + * The hello world demo has two threads that utilize semaphores and sleeping + * to take turns printing a greeting message at a controlled rate. The demo + * shows both the static and dynamic approaches for spawning a thread; a real + * world application would likely use the static approach for both threads. + */ + + +/* size of stack area used by each thread */ +#define STACKSIZE 1024 + +/* scheduling priority used by each thread */ +#define PRIORITY 7 + +/* delay between greetings (in ms) */ +#define SLEEPTIME 500 + + +/* + * @param my_name thread identification string + * @param my_sem thread's own semaphore + * @param other_sem other thread's semaphore + */ +void helloLoop(const char *my_name, + struct k_sem *my_sem, struct k_sem *other_sem) +{ + while (1) { + /* take my semaphore */ + k_sem_take(my_sem, K_FOREVER); + + /* say "hello" */ + printk("%s: Hello World from %s!\n", my_name, CONFIG_ARCH); + + /* wait a while, then let other thread have a turn */ + k_sleep(SLEEPTIME); + k_sem_give(other_sem); + } +} + +/* define semaphores */ + +K_SEM_DEFINE(threadA_sem, 1, 1); /* starts off "available" */ +K_SEM_DEFINE(threadB_sem, 0, 1); /* starts off "not available" */ + + +/* threadB is a dynamic thread that is spawned by threadA */ + +void threadB(void *dummy1, void *dummy2, void *dummy3) +{ + ARG_UNUSED(dummy1); + ARG_UNUSED(dummy2); + ARG_UNUSED(dummy3); + + /* invoke routine to ping-pong hello messages with threadA */ + helloLoop(__func__, &threadB_sem, &threadA_sem); +} + +K_THREAD_STACK_DEFINE(threadB_stack_area, STACKSIZE); +static struct k_thread threadB_data; + +/* threadA is a static thread that is spawned automatically */ + +void threadA(void *dummy1, void *dummy2, void *dummy3) +{ + ARG_UNUSED(dummy1); + ARG_UNUSED(dummy2); + ARG_UNUSED(dummy3); + + /* spawn threadB */ + k_thread_create(&threadB_data, threadB_stack_area, STACKSIZE, + threadB, NULL, NULL, NULL, + PRIORITY, 0, K_NO_WAIT); + + /* invoke routine to ping-pong hello messages with threadB */ + helloLoop(__func__, &threadA_sem, &threadB_sem); +} + +K_THREAD_DEFINE(threadA_id, STACKSIZE, threadA, NULL, NULL, NULL, + PRIORITY, 0, K_NO_WAIT); diff --git a/tests/kernel/threads/custom_data/custom_data_api/CMakeLists.txt b/tests/kernel/threads/custom_data/custom_data_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/threads/custom_data/custom_data_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/threads/lifecycle/lifecycle_api/CMakeLists.txt b/tests/kernel/threads/lifecycle/lifecycle_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/threads/lifecycle/lifecycle_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/threads/lifecycle/thread_init/CMakeLists.txt b/tests/kernel/threads/lifecycle/thread_init/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/threads/lifecycle/thread_init/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/threads/scheduling/schedule_api/CMakeLists.txt b/tests/kernel/threads/scheduling/schedule_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/threads/scheduling/schedule_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/tickless/tickless/CMakeLists.txt b/tests/kernel/tickless/tickless/CMakeLists.txt new file mode 100644 index 0000000000..befb94946c --- /dev/null +++ b/tests/kernel/tickless/tickless/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_sources(app PRIVATE src/test_tickless.c) +target_sources_ifdef(CONFIG_ARM app PRIVATE src/timestamps.c) diff --git a/tests/kernel/tickless/tickless_concept/CMakeLists.txt b/tests/kernel/tickless/tickless_concept/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/tickless/tickless_concept/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/timer/timer_api/CMakeLists.txt b/tests/kernel/timer/timer_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/timer/timer_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/timer/timer_monotonic/CMakeLists.txt b/tests/kernel/timer/timer_monotonic/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/timer/timer_monotonic/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/workq/work_queue/CMakeLists.txt b/tests/kernel/workq/work_queue/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/workq/work_queue/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/workq/work_queue_api/CMakeLists.txt b/tests/kernel/workq/work_queue_api/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/workq/work_queue_api/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/kernel/xip/CMakeLists.txt b/tests/kernel/xip/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/kernel/xip/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/lib/json/CMakeLists.txt b/tests/lib/json/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/lib/json/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/6lo/CMakeLists.txt b/tests/net/6lo/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/6lo/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/all/CMakeLists.txt b/tests/net/all/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/net/all/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/app/CMakeLists.txt b/tests/net/app/CMakeLists.txt new file mode 100644 index 0000000000..1eabfaf8a0 --- /dev/null +++ b/tests/net/app/CMakeLists.txt @@ -0,0 +1,7 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) diff --git a/tests/net/arp/CMakeLists.txt b/tests/net/arp/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/arp/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/buf/CMakeLists.txt b/tests/net/buf/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/buf/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/context/CMakeLists.txt b/tests/net/context/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/context/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/dhcpv4/CMakeLists.txt b/tests/net/dhcpv4/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/dhcpv4/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/icmpv6/CMakeLists.txt b/tests/net/icmpv6/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/icmpv6/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ieee802154/CMakeLists.txt b/tests/net/ieee802154/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/ieee802154/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ieee802154/crypto/CMakeLists.txt b/tests/net/ieee802154/crypto/CMakeLists.txt new file mode 100644 index 0000000000..c29294d23c --- /dev/null +++ b/tests/net/ieee802154/crypto/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip $ENV{ZEPHYR_BASE}/subsys/net/ip/l2/ieee802154) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ieee802154/fragment/CMakeLists.txt b/tests/net/ieee802154/fragment/CMakeLists.txt new file mode 100644 index 0000000000..c29294d23c --- /dev/null +++ b/tests/net/ieee802154/fragment/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip $ENV{ZEPHYR_BASE}/subsys/net/ip/l2/ieee802154) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ieee802154/l2/CMakeLists.txt b/tests/net/ieee802154/l2/CMakeLists.txt new file mode 100644 index 0000000000..c29294d23c --- /dev/null +++ b/tests/net/ieee802154/l2/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip $ENV{ZEPHYR_BASE}/subsys/net/ip/l2/ieee802154) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/iface/CMakeLists.txt b/tests/net/iface/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/iface/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ip-addr/CMakeLists.txt b/tests/net/ip-addr/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/ip-addr/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ipv6/CMakeLists.txt b/tests/net/ipv6/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/ipv6/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/ipv6_fragment/CMakeLists.txt b/tests/net/ipv6_fragment/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/ipv6_fragment/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/coap/CMakeLists.txt b/tests/net/lib/coap/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/net/lib/coap/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/dns_packet/CMakeLists.txt b/tests/net/lib/dns_packet/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/net/lib/dns_packet/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/dns_resolve/CMakeLists.txt b/tests/net/lib/dns_resolve/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/lib/dns_resolve/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/http_header_fields/CMakeLists.txt b/tests/net/lib/http_header_fields/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/lib/http_header_fields/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/mqtt_packet/CMakeLists.txt b/tests/net/lib/mqtt_packet/CMakeLists.txt new file mode 100644 index 0000000000..1f03d0e41c --- /dev/null +++ b/tests/net/lib/mqtt_packet/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE}/subsys/net/ip + $ENV{ZEPHYR_BASE}/subsys/net/lib/mqtt + ) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/mqtt_publisher/CMakeLists.txt b/tests/net/lib/mqtt_publisher/CMakeLists.txt new file mode 100644 index 0000000000..58145cf117 --- /dev/null +++ b/tests/net/lib/mqtt_publisher/CMakeLists.txt @@ -0,0 +1,12 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE}/subsys/net/ip + $ENV{ZEPHYR_BASE}/subsys/net/lib/mqtt + ) +if(CONFIG_MBEDTLS) +target_link_libraries(app mbedTLS) +endif() +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/mqtt_subscriber/CMakeLists.txt b/tests/net/lib/mqtt_subscriber/CMakeLists.txt new file mode 100644 index 0000000000..1f03d0e41c --- /dev/null +++ b/tests/net/lib/mqtt_subscriber/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE}/subsys/net/ip + $ENV{ZEPHYR_BASE}/subsys/net/lib/mqtt + ) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/lib/zoap/CMakeLists.txt b/tests/net/lib/zoap/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/net/lib/zoap/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/mgmt/CMakeLists.txt b/tests/net/mgmt/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/mgmt/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/mld/CMakeLists.txt b/tests/net/mld/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/mld/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/neighbor/CMakeLists.txt b/tests/net/neighbor/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/neighbor/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/net_pkt/CMakeLists.txt b/tests/net/net_pkt/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/net_pkt/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/route/CMakeLists.txt b/tests/net/route/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/route/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/rpl/CMakeLists.txt b/tests/net/rpl/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/rpl/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/socket/tcp/CMakeLists.txt b/tests/net/socket/tcp/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/socket/tcp/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/socket/udp/CMakeLists.txt b/tests/net/socket/udp/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/socket/udp/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/tcp/CMakeLists.txt b/tests/net/tcp/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/tcp/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/trickle/CMakeLists.txt b/tests/net/trickle/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/trickle/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/udp/CMakeLists.txt b/tests/net/udp/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/udp/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/utils/CMakeLists.txt b/tests/net/utils/CMakeLists.txt new file mode 100644 index 0000000000..46796e144c --- /dev/null +++ b/tests/net/utils/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/power/multicore/arc/CMakeLists.txt b/tests/power/multicore/arc/CMakeLists.txt new file mode 100644 index 0000000000..99377b437a --- /dev/null +++ b/tests/power/multicore/arc/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/drivers) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/power/multicore/lmt/CMakeLists.txt b/tests/power/multicore/lmt/CMakeLists.txt new file mode 100644 index 0000000000..99377b437a --- /dev/null +++ b/tests/power/multicore/lmt/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/drivers) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/power/power_states/CMakeLists.txt b/tests/power/power_states/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/power/power_states/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/shell/CMakeLists.txt b/tests/shell/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/shell/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/debug/gdb_server/CMakeLists.txt b/tests/subsys/debug/gdb_server/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/subsys/debug/gdb_server/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/dfu/img_util/CMakeLists.txt b/tests/subsys/dfu/img_util/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/subsys/dfu/img_util/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/dfu/mcuboot/CMakeLists.txt b/tests/subsys/dfu/mcuboot/CMakeLists.txt new file mode 100644 index 0000000000..92a4288bc1 --- /dev/null +++ b/tests/subsys/dfu/mcuboot/CMakeLists.txt @@ -0,0 +1,5 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/fs/fat_fs_api/CMakeLists.txt b/tests/subsys/fs/fat_fs_api/CMakeLists.txt new file mode 100644 index 0000000000..03cf257105 --- /dev/null +++ b/tests/subsys/fs/fat_fs_api/CMakeLists.txt @@ -0,0 +1,6 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +target_link_libraries(app ELMFAT) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/fs/nffs_fs_api/CMakeLists.txt b/tests/subsys/fs/nffs_fs_api/CMakeLists.txt new file mode 100644 index 0000000000..4c15b571a2 --- /dev/null +++ b/tests/subsys/fs/nffs_fs_api/CMakeLists.txt @@ -0,0 +1,40 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +if(BOARD STREQUAL qemu_x86) + zephyr_compile_definitions( + -DTEST_FLASH_OFFSET=0 + -DFLASH_AREA_NFFS_OFFSET=0 + -DFLASH_AREA_NFFS_SIZE=1048576 + ) +elseif(BOARD STREQUAL nrf51_pca10028) + set(CONF_FILE nrf5x.conf) + zephyr_compile_definitions( + -DTEST_FLASH_OFFSET=0x20000 + ) +elseif(BOARD STREQUAL nrf52_pca10040) + set(CONF_FILE nrf5x.conf) + zephyr_compile_definitions( + -DTEST_FLASH_OFFSET=0x20000 + ) +elseif(BOARD STREQUAL nrf52840_pca10056) + set(CONF_FILE nrf5x.conf) + zephyrt_compile_definitions( + -DTEST_FLASH_OFFSET=0x20000 + ) +endif() + +if(NOT TEST) + target_compile_definitions(app PRIVATE + -DTEST_basic + ) +else() + target_compile_definitions(app PRIVATE + -DTEST_${TEST} + ) +endif() + + +target_link_libraries(app NFFS) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/unit/bluetooth/at/CMakeLists.txt b/tests/unit/bluetooth/at/CMakeLists.txt new file mode 100644 index 0000000000..c456de9569 --- /dev/null +++ b/tests/unit/bluetooth/at/CMakeLists.txt @@ -0,0 +1,9 @@ +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(NONE) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +target_include_directories(app PRIVATE + $ENV{ZEPHYR_BASE} + ) diff --git a/tests/unit/drivers/crc/CMakeLists.txt b/tests/unit/drivers/crc/CMakeLists.txt new file mode 100644 index 0000000000..9e30fa8d89 --- /dev/null +++ b/tests/unit/drivers/crc/CMakeLists.txt @@ -0,0 +1,5 @@ +list(APPEND INCLUDE subsys) + +include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) +project(none) + diff --git a/tests/unit/net/buf/CMakeLists.txt b/tests/unit/net/buf/CMakeLists.txt new file mode 100644 index 0000000000..9e30fa8d89 --- /dev/null +++ b/tests/unit/net/buf/CMakeLists.txt @@ -0,0 +1,5 @@ +list(APPEND INCLUDE subsys) + +include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) +project(none) + diff --git a/tests/unit/unittest.cmake b/tests/unit/unittest.cmake new file mode 100644 index 0000000000..8326131141 --- /dev/null +++ b/tests/unit/unittest.cmake @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 3.8.2) +cmake_policy(SET CMP0000 OLD) +cmake_policy(SET CMP0002 NEW) + +# Parameters: +# SOURCES: list of source files, default main.c +# INCLUDE: list of additional include paths relative to ZEPHYR_BASE + +if(NOT SOURCES) + set(SOURCES main.c) +endif() + +list(APPEND INCLUDE + tests/ztest/include + tests/include + include + . + ) + +add_executable(testbinary ${SOURCES}) + +target_compile_options(testbinary PRIVATE -Wall) + +if(COVERAGE) + target_compile_options(testbinary PRIVATE + -fno-default-inline + -fno-inline + -fprofile-arcs + -ftest-coverage + ) +endif() + +if(LIBS) + message(FATAL_ERROR "This variable is not supported, see SOURCES instead") +endif() + +target_sources(testbinary PRIVATE + $ENV{ZEPHYR_BASE}/tests/ztest/src/ztest.c + $ENV{ZEPHYR_BASE}/tests/ztest/src/ztest_mock.c + ) + +target_compile_definitions(testbinary PRIVATE ZTEST_UNITTEST) + +foreach(inc ${INCLUDE}) + target_include_directories(testbinary PRIVATE $ENV{ZEPHYR_BASE}/${inc}) +endforeach() + +find_program(VALGRIND_PROGRAM valgrind) +if(VALGRIND_PROGRAM) + set(VALGRIND ${VALGRIND_PROGRAM}) + set(VALGRIND_FLAGS + --leak-check=full + --error-exitcode=1 + --log-file=valgrind.log + ) +endif() + +add_custom_target(run-test + COMMAND + ${VALGRIND} ${VALGRIND_FLAGS} + $ + DEPENDS testbinary + WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} + ) +# TODO: Redirect output to unit.log diff --git a/tests/ztest/CMakeLists.txt b/tests/ztest/CMakeLists.txt new file mode 100644 index 0000000000..28edda457b --- /dev/null +++ b/tests/ztest/CMakeLists.txt @@ -0,0 +1,8 @@ +zephyr_include_directories( + $ENV{ZEPHYR_BASE}/tests/include + $ENV{ZEPHYR_BASE}/tests/ztest/include + ) + +zephyr_library() +zephyr_library_sources( src/ztest.c) +zephyr_library_sources_ifdef(CONFIG_ZTEST_MOCKING src/ztest_mock.c) diff --git a/tests/ztest/test/base/CMakeLists.txt b/tests/ztest/test/base/CMakeLists.txt new file mode 100644 index 0000000000..9de221d0c1 --- /dev/null +++ b/tests/ztest/test/base/CMakeLists.txt @@ -0,0 +1,12 @@ +if(BOARD STREQUAL unit_testing) + list(APPEND SOURCES src/main.c) + + include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) + project(none) +else() + include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) + project(NONE) + + FILE(GLOB app_sources src/*.c) + target_sources(app PRIVATE ${app_sources}) +endif() diff --git a/tests/ztest/test/mock/CMakeLists.txt b/tests/ztest/test/mock/CMakeLists.txt new file mode 100644 index 0000000000..9de221d0c1 --- /dev/null +++ b/tests/ztest/test/mock/CMakeLists.txt @@ -0,0 +1,12 @@ +if(BOARD STREQUAL unit_testing) + list(APPEND SOURCES src/main.c) + + include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) + project(none) +else() + include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) + project(NONE) + + FILE(GLOB app_sources src/*.c) + target_sources(app PRIVATE ${app_sources}) +endif() diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000000..ff2b3d3e3a --- /dev/null +++ b/version.h.in @@ -0,0 +1,14 @@ +#ifndef _KERNEL_VERSION_H_ +#define _KERNEL_VERSION_H_ + +#cmakedefine ZEPHYR_VERSION_CODE @ZEPHYR_VERSION_CODE@ +#define ZEPHYR_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) + +#define KERNELVERSION @KERNELVERSION@ +#define KERNEL_VERSION_NUMBER @KERNEL_VERSION_NUMBER@ +#define KERNEL_VERSION_MAJOR @KERNEL_VERSION_MAJOR@ +#define KERNEL_VERSION_MINOR @KERNEL_VERSION_MINOR@ +#define KERNEL_PATCHLEVEL @KERNEL_PATCHLEVEL@ +#define KERNEL_VERSION_STRING @KERNEL_VERSION_STRING@ + +#endif /* _KERNEL_VERSION_H_ */