feat: porting for cmake prj
This commit is contained in:
@@ -29,7 +29,6 @@ BinPackParameters: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignTrailingComments: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
AlignConsecutiveMacros:
|
||||
@@ -50,6 +49,4 @@ AlignConsecutiveBitFields:
|
||||
AlignCompound: true
|
||||
PadOperators: true
|
||||
AlignEscapedNewlines: Right
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
...
|
||||
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:cmake.launchTargetPath}",
|
||||
"name": "(Ubuntu) launch & debug",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "jlink",
|
||||
"serverpath": "/opt/SEGGER/JLink/JLinkGDBServerCLExe",
|
||||
"serverArgs": [
|
||||
"-halt",
|
||||
"-ir",
|
||||
"-vd",
|
||||
"-strict",
|
||||
],
|
||||
"rttConfig": {
|
||||
"enabled": true,
|
||||
"address": "auto",
|
||||
"decoders": [
|
||||
{
|
||||
"label": "",
|
||||
"port": 0,
|
||||
"type": "console"
|
||||
}
|
||||
],
|
||||
},
|
||||
"armToolchainPath": "/opt/arm-none-eabi/bin",
|
||||
"device": "NRF52840_XXAA",
|
||||
"interface": "swd",
|
||||
"rtos": "FreeRTOS",
|
||||
"svdFile": "${workspaceRoot}/../bmd380_sdk/modules/nrfx/mdk/nrf52840.svd",
|
||||
"runToEntryPoint": "main",
|
||||
"preLaunchTask": "CMake: build"
|
||||
},
|
||||
{
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "${command:cmake.launchTargetPath}",
|
||||
"name": "(Windows) launch & debug",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "jlink",
|
||||
"serverpath": "C:/Program Files/SEGGER/JLink/JLinkGDBServerCL.exe",
|
||||
"serverArgs": [
|
||||
"-halt",
|
||||
"-ir",
|
||||
"-vd",
|
||||
"-strict",
|
||||
],
|
||||
"rttConfig": {
|
||||
"enabled": true,
|
||||
"address": "auto",
|
||||
"decoders": [
|
||||
{
|
||||
"label": "",
|
||||
"port": 0,
|
||||
"type": "console"
|
||||
}
|
||||
],
|
||||
},
|
||||
"armToolchainPath": "C:/sysgcc/arm-eabi/bin",
|
||||
"device": "NRF52840_XXAA",
|
||||
"interface": "swd",
|
||||
"rtos": "FreeRTOS",
|
||||
"svdFile": "${workspaceRoot}/../bmd380_sdk/modules/nrfx/mdk/nrf52840.svd",
|
||||
"runToEntryPoint": "main",
|
||||
"preLaunchTask": "CMake: build"
|
||||
},
|
||||
]
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cmake",
|
||||
"label": "CMake: build",
|
||||
"command": "build",
|
||||
"targets": [
|
||||
"all"
|
||||
],
|
||||
"preset": "Debug",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"detail": "CMake template build task"
|
||||
},
|
||||
{
|
||||
"type": "cmake",
|
||||
"label": "CMake: clean rebuild",
|
||||
"command": "cleanRebuild",
|
||||
"targets": [
|
||||
"all"
|
||||
],
|
||||
"preset": "Debug",
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"detail": "CMake template clean rebuild task"
|
||||
}
|
||||
]
|
||||
}
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
cmake_minimum_required(VERSION 3.10.0)
|
||||
|
||||
# ==========================
|
||||
# Toolchain Setup
|
||||
# ==========================
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/arm-none-eabi-gcc.cmake)
|
||||
|
||||
# ==========================
|
||||
# Project Setup
|
||||
# ==========================
|
||||
project(elite VERSION 0.1.0 LANGUAGES C ASM)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS ON)
|
||||
|
||||
set(EXECUTABLE ${PROJECT_NAME}.elf)
|
||||
set(NRF_SDK_DIR ${CMAKE_SOURCE_DIR}/../bmd380_sdk)
|
||||
set(NRF_SDK_LINKER_DIR ${NRF_SDK_DIR}/modules/nrfx/mdk)
|
||||
set(SD_LINKER_DIR ${CMAKE_SOURCE_DIR}/SoftdeviceLibraries/hard)
|
||||
set(LINKER_DIR ${CMAKE_SOURCE_DIR}/linkscripts)
|
||||
set(LINKER_FILE ${LINKER_DIR}/nRF52840_XXAA_S140_reserve.lds)
|
||||
|
||||
# ==========================
|
||||
# Compiler Flags and Defines
|
||||
# ==========================
|
||||
set(COMMON_COMPILE_OPT
|
||||
-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb
|
||||
-fdata-sections -ffunction-sections -Wall -Os -g3 -std=gnu99
|
||||
-Wno-unused-variable -Wno-pointer-sign -Wno-array-bounds
|
||||
)
|
||||
|
||||
set(COMMON_COMPILE_DEF
|
||||
-DDEBUG=1 -DNRF52840_XXAA -DS140_reserve -DCONFIG_GPIO_AS_PIN
|
||||
-DRESETHNRF_DFU_SETTINGS_VERSION=2 -DNRF_SD_BLE_API_VERSION=7
|
||||
-D__STACK_SIZE=1024 -D__HEAP_SIZE=1024 -DARM_MATH_CM4
|
||||
-DSOFTDEVICE_PRESENT -DUSE_APP_CONFIG
|
||||
)
|
||||
|
||||
set(COMMON_COMPILE_INC
|
||||
${ARM_TOOLCHAIN_DIR}/../arm-none-eabi/include
|
||||
${CMAKE_SOURCE_DIR}/app/inc
|
||||
${NRF_SDK_DIR}/components/ble/ble_db_discovery
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis_c
|
||||
${NRF_SDK_DIR}/components/ble/common/
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gatt
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gq
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_scan
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dfu
|
||||
${NRF_SDK_DIR}/components/ble/ble_advertising
|
||||
${NRF_SDK_DIR}/components/ble/peer_manager
|
||||
|
||||
${NRF_SDK_DIR}/components/libraries/atomic
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_flags
|
||||
${NRF_SDK_DIR}/components/libraries/balloc
|
||||
${NRF_SDK_DIR}/components/libraries/delay
|
||||
${NRF_SDK_DIR}/components/libraries/experimental_section_vars
|
||||
|
||||
${NRF_SDK_DIR}/components/libraries/memobj
|
||||
${NRF_SDK_DIR}/components/libraries/queue
|
||||
${NRF_SDK_DIR}/components/libraries/ringbuf
|
||||
${NRF_SDK_DIR}/components/libraries/strerror
|
||||
${NRF_SDK_DIR}/components/libraries/util
|
||||
${NRF_SDK_DIR}/components/libraries/block_dev
|
||||
${NRF_SDK_DIR}/components/libraries/bootloader
|
||||
${NRF_SDK_DIR}/components/libraries/bootloader/ble_dfu
|
||||
${NRF_SDK_DIR}/components/libraries/bootloader/dfu
|
||||
${NRF_SDK_DIR}/components/libraries/pwr_mgmt
|
||||
${NRF_SDK_DIR}/components/libraries/usbd
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/cdc
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/cdc/acm
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/nrf_dfu_trigger
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_fifo
|
||||
${NRF_SDK_DIR}/components/libraries/svc
|
||||
${NRF_SDK_DIR}/components/libraries/mutex
|
||||
|
||||
${NRF_SDK_DIR}/components/softdevice/common
|
||||
${NRF_SDK_DIR}/components/softdevice/mbr/headers
|
||||
${NRF_SDK_DIR}/components/softdevice/s140/headers
|
||||
|
||||
${NRF_SDK_DIR}/components/toolchain/cmsis/include
|
||||
${NRF_SDK_DIR}/modules/nrfx
|
||||
${NRF_SDK_DIR}/modules/nrfx/hal
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/include
|
||||
|
||||
${NRF_SDK_DIR}/external/fprintf
|
||||
${NRF_SDK_DIR}/external/segger_rtt
|
||||
${NRF_SDK_DIR}/external/utf_converter
|
||||
|
||||
${NRF_SDK_DIR}/integration/nrfx
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy
|
||||
)
|
||||
|
||||
# ==========================
|
||||
# Configuration Interface
|
||||
# ==========================
|
||||
add_library(prj_config INTERFACE)
|
||||
target_include_directories(prj_config INTERFACE ${COMMON_COMPILE_INC})
|
||||
target_compile_definitions(prj_config INTERFACE ${COMMON_COMPILE_DEF})
|
||||
target_compile_options(prj_config INTERFACE ${COMMON_COMPILE_OPT})
|
||||
|
||||
|
||||
# ==========================
|
||||
# Subdirectories
|
||||
# ==========================
|
||||
include(cmake/littlefs.cmake)
|
||||
include(cmake/freertos.cmake)
|
||||
include(cmake/nrf_log.cmake)
|
||||
|
||||
# ==========================
|
||||
# Source Files
|
||||
# ==========================
|
||||
set(STARTUP_SRC
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk/gcc_startup_nrf52840.S
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk/system_nrf52.c
|
||||
)
|
||||
|
||||
set(UTILS_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/util/nrf_assert.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_error.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_error_handler_gcc.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_error_weak.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_util_platform.c
|
||||
${NRF_SDK_DIR}/components/libraries/strerror/nrf_strerror.c
|
||||
${NRF_SDK_DIR}/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c
|
||||
)
|
||||
|
||||
set(ATOMIC_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/atomic/nrf_atomic.c
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_fifo/nrf_atfifo.c
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_flags/nrf_atflags.c
|
||||
${NRF_SDK_DIR}/components/libraries/memobj/nrf_memobj.c
|
||||
${NRF_SDK_DIR}/components/libraries/balloc/nrf_balloc.c
|
||||
${NRF_SDK_DIR}/components/libraries/ringbuf/nrf_ringbuf.c
|
||||
)
|
||||
|
||||
set(USBD_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd_core.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd_serial_num.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd_string_desc.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/nrf_dfu_trigger/app_usbd_nrf_dfu_trigger.c
|
||||
)
|
||||
|
||||
set(SOFTDEVICE_SRC
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh.c
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh_freertos.c
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh_ble.c
|
||||
)
|
||||
|
||||
set(BLE_SRC
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_advdata.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_conn_state.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_srv_common.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_advertising/ble_advertising.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis/ble_dis.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dfu/ble_dfu.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dfu/ble_dfu_unbonded.c
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gatt/nrf_ble_gatt.c
|
||||
)
|
||||
|
||||
set(PRINTF_SRC
|
||||
${NRF_SDK_DIR}/external/fprintf/nrf_fprintf.c
|
||||
${NRF_SDK_DIR}/external/fprintf/nrf_fprintf_format.c
|
||||
${NRF_SDK_DIR}/external/segger_rtt/SEGGER_RTT.c
|
||||
${NRF_SDK_DIR}/external/segger_rtt/SEGGER_RTT_printf.c
|
||||
)
|
||||
|
||||
set(NRFX_DRIVERS_SRC
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_clock.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_power.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_usbd.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/soc/nrfx_atomic.c
|
||||
)
|
||||
|
||||
set(NRFX_LEGACY_SRC
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy/nrf_drv_clock.c
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy/nrf_drv_power.c
|
||||
)
|
||||
|
||||
set(EXPERIMENTAL_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/experimental_section_vars/nrf_section_iter.c
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE APP_SOURCES "app/*.c")
|
||||
|
||||
# ==========================
|
||||
# Executable and Linker
|
||||
# ==========================
|
||||
add_executable(${EXECUTABLE}
|
||||
$<TARGET_OBJECTS:lfs>
|
||||
$<TARGET_OBJECTS:freertos>
|
||||
$<TARGET_OBJECTS:nrf_log>
|
||||
${APP_SOURCES}
|
||||
${STARTUP_SRC}
|
||||
${UTILS_SRC}
|
||||
${ATOMIC_SRC}
|
||||
${USBD_SRC}
|
||||
${SOFTDEVICE_SRC}
|
||||
${BLE_SRC}
|
||||
${PRINTF_SRC}
|
||||
${NRFX_DRIVERS_SRC}
|
||||
${NRFX_LEGACY_SRC}
|
||||
${EXPERIMENTAL_SRC}
|
||||
${NRF_SDK_DIR}/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c
|
||||
)
|
||||
|
||||
target_link_options(${EXECUTABLE} PRIVATE
|
||||
-T${LINKER_FILE}
|
||||
-L${LINKER_DIR}
|
||||
-L${SD_LINKER_DIR}
|
||||
-L${NRF_SDK_LINKER_DIR}
|
||||
-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb
|
||||
--specs=nano.specs --specs=nosys.specs -u _printf_float
|
||||
-lc -lm
|
||||
-Wl,-Map=${PROJECT_NAME}.map,--cref
|
||||
-Wl,--gc-sections
|
||||
-Xlinker -print-memory-usage -Xlinker
|
||||
)
|
||||
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
prj_config
|
||||
lfs
|
||||
freertos
|
||||
nrf_log
|
||||
)
|
||||
|
||||
# Optional: Print executable size as part of the post build process
|
||||
add_custom_command(TARGET ${EXECUTABLE}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_SIZE} ${EXECUTABLE})
|
||||
|
||||
# Optional: Create hex, bin and S-Record files after the build
|
||||
add_custom_command(TARGET ${EXECUTABLE}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_OBJCOPY} -O srec --srec-len=64 ${EXECUTABLE} ${PROJECT_NAME}.s19
|
||||
COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE} ${PROJECT_NAME}.hex
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE} ${PROJECT_NAME}.bin)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debug",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "RelWithDebInfo",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Release",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MinSizeRel",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "MinSizeRel"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "Debug",
|
||||
"configurePreset": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "RelWithDebInfo",
|
||||
"configurePreset": "RelWithDebInfo"
|
||||
},
|
||||
{
|
||||
"name": "Release",
|
||||
"configurePreset": "Release"
|
||||
},
|
||||
{
|
||||
"name": "MinSizeRel",
|
||||
"configurePreset": "MinSizeRel"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
# Call Cmake from the 'build' subfolder with the command below.
|
||||
# For using Make:
|
||||
# cmake -DCMAKE_MAKE_PROGRAM=make.exe -DCMAKE_TOOLCHAIN_FILE="arm-none-eabi-gcc.cmake" -G "Unix Makefiles" ..
|
||||
# followed by
|
||||
# 'make' or 'cmake --build .' to build it
|
||||
#
|
||||
# For using Ninja:
|
||||
# cmake -DCMAKE_MAKE_PROGRAM=ninja.exe -DCMAKE_TOOLCHAIN_FILE="arm-none-eabi-gcc.cmake" -G "Ninja" ..
|
||||
# followed by
|
||||
# 'ninja' or 'cmake --build .' to build it
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(EXECUTESUFFIX ".exe")
|
||||
set(ARM_TOOLCHAIN_DIR "C:/SysGCC/arm-eabi/bin")
|
||||
elseif(CMAKE_HOST_UNIX)
|
||||
set(EXECUTESUFFIX "")
|
||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
message(STATUS "Running on macOS")
|
||||
set(ARM_TOOLCHAIN_DIR "/opt/homebrew/bin")
|
||||
elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||
message(STATUS "Running on Linux (likely Ubuntu)")
|
||||
set(ARM_TOOLCHAIN_DIR "/opt/arm-none-eabi/bin")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Unknown host OS: ${CMAKE_HOST_SYSTEM_NAME}")
|
||||
endif()
|
||||
|
||||
set(BINUTILS_PATH ${ARM_TOOLCHAIN_DIR})
|
||||
|
||||
set(TOOLCHAIN_PREFIX arm-none-eabi-)
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
set(CMAKE_C_COMPILER ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}gcc${EXECUTESUFFIX})
|
||||
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
|
||||
set(CMAKE_CXX_COMPILER ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}g++${EXECUTESUFFIX})
|
||||
set(CMAKE_LINKER ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}ld${EXECUTESUFFIX})
|
||||
set(CMAKE_OBJCOPY ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy${EXECUTESUFFIX} CACHE INTERNAL "objcopy tool")
|
||||
set(CMAKE_SIZE ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size${EXECUTESUFFIX} CACHE INTERNAL "size tool")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
@@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.15.3)
|
||||
|
||||
file(GLOB FREERTO_KERNEL_SOURCES "${NRF_SDK_DIR}/external/freertos/source/*.c")
|
||||
|
||||
add_library(freertos OBJECT
|
||||
${NRF_SDK_DIR}/external/freertos/portable/GCC/nrf52/port.c
|
||||
${NRF_SDK_DIR}/external/freertos/portable/CMSIS/nrf52/port_cmsis.c
|
||||
${NRF_SDK_DIR}/external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c
|
||||
${NRF_SDK_DIR}/external/freertos/source/portable/MemMang/heap_4.c
|
||||
${FREERTO_KERNEL_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories(freertos PUBLIC
|
||||
${NRF_SDK_DIR}/external/freertos/portable/CMSIS/nrf52
|
||||
${NRF_SDK_DIR}/external/freertos/portable/GCC/nrf52
|
||||
${NRF_SDK_DIR}/external/freertos/source/include
|
||||
)
|
||||
|
||||
target_link_libraries(freertos PRIVATE
|
||||
prj_config
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.15.3)
|
||||
|
||||
file(GLOB_RECURSE LFS_SOURCES "littlefs/*.c")
|
||||
|
||||
add_library(lfs OBJECT ${LFS_SOURCES})
|
||||
|
||||
target_include_directories(lfs PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/littlefs
|
||||
)
|
||||
|
||||
target_link_libraries(lfs PRIVATE
|
||||
prj_config
|
||||
freertos
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.15.3)
|
||||
|
||||
set(NRF_LOG_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_backend_rtt.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_backend_serial.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_default_backends.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_frontend.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_str_formatter.c
|
||||
)
|
||||
|
||||
add_library(nrf_log OBJECT
|
||||
${NRF_LOG_SRC}
|
||||
)
|
||||
|
||||
target_include_directories(nrf_log PUBLIC
|
||||
${NRF_SDK_DIR}/components/libraries/log
|
||||
${NRF_SDK_DIR}/components/libraries/log/src
|
||||
)
|
||||
|
||||
target_link_libraries(nrf_log PRIVATE
|
||||
prj_config
|
||||
)
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
cmake_minimum_required(VERSION 3.15.3)
|
||||
|
||||
# ==========================
|
||||
# Source Files
|
||||
# ==========================
|
||||
set(STARTUP_SRC
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk/gcc_startup_nrf52840.S
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk/system_nrf52.c
|
||||
)
|
||||
|
||||
set(LOGGING_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_backend_rtt.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_backend_serial.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_default_backends.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_frontend.c
|
||||
${NRF_SDK_DIR}/components/libraries/log/src/nrf_log_str_formatter.c
|
||||
)
|
||||
|
||||
set(UTILS_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/util/nrf_assert.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_error.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_error_handler_gcc.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_error_weak.c
|
||||
${NRF_SDK_DIR}/components/libraries/util/app_util_platform.c
|
||||
${NRF_SDK_DIR}/components/libraries/strerror/nrf_strerror.c
|
||||
${NRF_SDK_DIR}/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c
|
||||
)
|
||||
|
||||
set(ATOMIC_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/atomic/nrf_atomic.c
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_fifo/nrf_atfifo.c
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_flags/nrf_atflags.c
|
||||
${NRF_SDK_DIR}/components/libraries/memobj/nrf_memobj.c
|
||||
${NRF_SDK_DIR}/components/libraries/balloc/nrf_balloc.c
|
||||
${NRF_SDK_DIR}/components/libraries/ringbuf/nrf_ringbuf.c
|
||||
)
|
||||
|
||||
set(USBD_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd_core.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd_serial_num.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/app_usbd_string_desc.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm.c
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/nrf_dfu_trigger/app_usbd_nrf_dfu_trigger.c
|
||||
)
|
||||
|
||||
set(SOFTDEVICE_SRC
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh.c
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh_freertos.c
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh_ble.c
|
||||
)
|
||||
|
||||
set(BLE_SRC
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_advdata.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_conn_state.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_srv_common.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_advertising/ble_advertising.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis/ble_dis.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dfu/ble_dfu.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dfu/ble_dfu_unbonded.c
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gatt/nrf_ble_gatt.c
|
||||
)
|
||||
|
||||
set(PRINTF_SRC
|
||||
${NRF_SDK_DIR}/external/fprintf/nrf_fprintf.c
|
||||
${NRF_SDK_DIR}/external/fprintf/nrf_fprintf_format.c
|
||||
${NRF_SDK_DIR}/external/segger_rtt/SEGGER_RTT.c
|
||||
${NRF_SDK_DIR}/external/segger_rtt/SEGGER_RTT_printf.c
|
||||
)
|
||||
|
||||
set(NRFX_DRIVERS_SRC
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_clock.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_power.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_usbd.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/soc/nrfx_atomic.c
|
||||
)
|
||||
|
||||
set(NRFX_LEGACY_SRC
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy/nrf_drv_clock.c
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy/nrf_drv_power.c
|
||||
)
|
||||
|
||||
set(EXPERIMENTAL_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/experimental_section_vars/nrf_section_iter.c
|
||||
)
|
||||
|
||||
set(PWR_MGMT_SRC
|
||||
${NRF_SDK_DIR}/components/libraries/pwr_mgmt/nrf_pwr_mgmt.c
|
||||
)
|
||||
|
||||
add_library(sdk OBJECT
|
||||
${STARTUP_SRC}
|
||||
${LOGGING_SRC}
|
||||
${UTILS_SRC}
|
||||
${ATOMIC_SRC}
|
||||
${USBD_SRC}
|
||||
${SOFTDEVICE_SRC}
|
||||
${BLE_SRC}
|
||||
${PRINTF_SRC}
|
||||
${NRFX_DRIVERS_SRC}
|
||||
${NRFX_LEGACY_SRC}
|
||||
${EXPERIMENTAL_SRC}
|
||||
${PWR_MGMT_SRC}
|
||||
)
|
||||
|
||||
target_include_directories(sdk PUBLIC
|
||||
${NRF_SDK_DIR}/components/ble/ble_db_discovery
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis_c
|
||||
${NRF_SDK_DIR}/components/ble/common/
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gatt
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gq
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_scan
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dfu
|
||||
${NRF_SDK_DIR}/components/ble/ble_advertising
|
||||
${NRF_SDK_DIR}/components/ble/peer_manager
|
||||
|
||||
${NRF_SDK_DIR}/components/libraries/atomic
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_flags
|
||||
${NRF_SDK_DIR}/components/libraries/balloc
|
||||
${NRF_SDK_DIR}/components/libraries/delay
|
||||
${NRF_SDK_DIR}/components/libraries/experimental_section_vars
|
||||
${NRF_SDK_DIR}/components/libraries/log
|
||||
${NRF_SDK_DIR}/components/libraries/log/src
|
||||
${NRF_SDK_DIR}/components/libraries/memobj
|
||||
${NRF_SDK_DIR}/components/libraries/queue
|
||||
${NRF_SDK_DIR}/components/libraries/ringbuf
|
||||
${NRF_SDK_DIR}/components/libraries/strerror
|
||||
${NRF_SDK_DIR}/components/libraries/util
|
||||
${NRF_SDK_DIR}/components/libraries/block_dev
|
||||
${NRF_SDK_DIR}/components/libraries/bootloader
|
||||
${NRF_SDK_DIR}/components/libraries/bootloader/ble_dfu
|
||||
${NRF_SDK_DIR}/components/libraries/bootloader/dfu
|
||||
${NRF_SDK_DIR}/components/libraries/pwr_mgmt
|
||||
${NRF_SDK_DIR}/components/libraries/usbd
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/cdc
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/cdc/acm
|
||||
${NRF_SDK_DIR}/components/libraries/usbd/class/nrf_dfu_trigger
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_fifo
|
||||
${NRF_SDK_DIR}/components/libraries/svc
|
||||
${NRF_SDK_DIR}/components/libraries/mutex
|
||||
|
||||
${NRF_SDK_DIR}/components/softdevice/common
|
||||
${NRF_SDK_DIR}/components/softdevice/mbr/headers
|
||||
${NRF_SDK_DIR}/components/softdevice/s140/headers
|
||||
|
||||
${NRF_SDK_DIR}/components/toolchain/cmsis/include
|
||||
${NRF_SDK_DIR}/modules/nrfx
|
||||
${NRF_SDK_DIR}/modules/nrfx/hal
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/include
|
||||
|
||||
${NRF_SDK_DIR}/external/fprintf
|
||||
${NRF_SDK_DIR}/external/freertos/portable/CMSIS/nrf52
|
||||
${NRF_SDK_DIR}/external/freertos/portable/GCC/nrf52
|
||||
${NRF_SDK_DIR}/external/freertos/source/include
|
||||
${NRF_SDK_DIR}/external/segger_rtt
|
||||
${NRF_SDK_DIR}/external/utf_converter
|
||||
|
||||
${NRF_SDK_DIR}/integration/nrfx
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy
|
||||
)
|
||||
|
||||
target_link_libraries(sdk PRIVATE
|
||||
prj_config
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user