Compare commits
1 Commits
vscode
...
vscode_bkup
| Author | SHA1 | Date | |
|---|---|---|---|
| c846950983 |
@@ -2,3 +2,4 @@
|
||||
/.visualgdb/
|
||||
/VisualGDB/
|
||||
*.vgdbsettings.*.user
|
||||
/build/
|
||||
|
||||
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
+33
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cmake",
|
||||
"label": "CMake: build",
|
||||
"command": "build",
|
||||
"targets": [
|
||||
"all"
|
||||
],
|
||||
"preset": "${command:cmake.activeBuildPresetName}",
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"detail": "CMake template build task"
|
||||
},
|
||||
{
|
||||
"type": "cmake",
|
||||
"label": "CMake: clean rebuild",
|
||||
"command": "cleanRebuild",
|
||||
"targets": [
|
||||
"all"
|
||||
],
|
||||
"group": {
|
||||
"isDefault": true,
|
||||
"kind": "build"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"detail": "CMake template clean rebuild task"
|
||||
}
|
||||
]
|
||||
}
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
cmake_minimum_required(VERSION 3.15.3)
|
||||
|
||||
# Verbose output (optional)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
# Toolchain must be set before project()
|
||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/arm-none-eabi-gcc.cmake)
|
||||
include(${CMAKE_TOOLCHAIN_FILE})
|
||||
|
||||
# Project setup
|
||||
project(bmd380_central
|
||||
VERSION 1.0.0
|
||||
LANGUAGES C ASM
|
||||
)
|
||||
set(EXECUTABLE ${PROJECT_NAME}.elf)
|
||||
set(NRF_SDK_DIR ${CMAKE_SOURCE_DIR}/../bmd380_sdk)
|
||||
#set(LINKER_FILE ${CMAKE_SOURCE_DIR}/linkscripts/nRF52840_XXAA_s140.lds)
|
||||
set(LINKER_FILE ${CMAKE_SOURCE_DIR}/linkscripts/nRF52840_XXAA_S140_reserve.lds)
|
||||
set(LINKER_DIR ${CMAKE_SOURCE_DIR}/linkscripts)
|
||||
set(NRF_SDK_LINKER_DIR ${NRF_SDK_DIR}/modules/nrfx/mdk)
|
||||
set(SD_LINKER_DIR ${CMAKE_SOURCE_DIR}/SoftdeviceLibraries/hard)
|
||||
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS ON)
|
||||
# Define the build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
|
||||
|
||||
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
|
||||
${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/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/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}/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}/integration/nrfx
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy
|
||||
${NRF_SDK_DIR}/modules/nrfx
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/include
|
||||
${NRF_SDK_DIR}/modules/nrfx/hal
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk
|
||||
)
|
||||
|
||||
# ==========================
|
||||
# Prj Configuration
|
||||
# ==========================
|
||||
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})
|
||||
|
||||
# ====================================================
|
||||
# Add FreeRTOS kernel and portable layer
|
||||
# Add application source files as an OBJECT library
|
||||
# Add board support package (BSP) source files as an OBJECT library
|
||||
# ====================================================
|
||||
add_subdirectory(app)
|
||||
include(cmake/freertos.cmake)
|
||||
|
||||
# ==========================
|
||||
# Executable Target
|
||||
# ==========================
|
||||
add_executable(${EXECUTABLE}
|
||||
$<TARGET_OBJECTS:app>
|
||||
${NRF_SDK_DIR}/components/ble/ble_db_discovery/ble_db_discovery.c
|
||||
${NRF_SDK_DIR}/components/ble/ble_services/ble_dis_c/ble_dis_c.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_advdata.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_conn_params.c
|
||||
${NRF_SDK_DIR}/components/ble/common/ble_conn_state.c
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gatt/nrf_ble_gatt.c
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_gq/nrf_ble_gq.c
|
||||
${NRF_SDK_DIR}/components/ble/nrf_ble_scan/nrf_ble_scan.c
|
||||
${NRF_SDK_DIR}/components/libraries/atomic/nrf_atomic.c
|
||||
${NRF_SDK_DIR}/components/libraries/atomic_flags/nrf_atflags.c
|
||||
${NRF_SDK_DIR}/components/libraries/balloc/nrf_balloc.c
|
||||
${NRF_SDK_DIR}/components/libraries/experimental_section_vars/nrf_section_iter.c
|
||||
${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
|
||||
${NRF_SDK_DIR}/components/libraries/memobj/nrf_memobj.c
|
||||
${NRF_SDK_DIR}/components/libraries/queue/nrf_queue.c
|
||||
${NRF_SDK_DIR}/components/libraries/ringbuf/nrf_ringbuf.c
|
||||
${NRF_SDK_DIR}/components/libraries/strerror/nrf_strerror.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/softdevice/common/nrf_sdh.c
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh_ble.c
|
||||
${NRF_SDK_DIR}/components/softdevice/common/nrf_sdh_freertos.c
|
||||
${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
|
||||
${NRF_SDK_DIR}/integration/nrfx/legacy/nrf_drv_clock.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/drivers/src/nrfx_clock.c
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk/gcc_startup_nrf52840.S
|
||||
${NRF_SDK_DIR}/modules/nrfx/mdk/system_nrf52.c
|
||||
)
|
||||
|
||||
target_include_directories(${EXECUTABLE} PRIVATE ${COMMON_COMPILE_INC})
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE ${COMMON_COMPILE_DEF})
|
||||
target_compile_options(${EXECUTABLE} PRIVATE ${COMMON_COMPILE_OPT})
|
||||
|
||||
# ==========================
|
||||
# Link configuration
|
||||
# ==========================
|
||||
|
||||
# Linker options (linker script and flags)
|
||||
target_link_options(${EXECUTABLE} PRIVATE
|
||||
-T${LINKER_FILE} # Linker script
|
||||
-L${SD_LINKER_DIR} # Linker library directory (SoftDevice)
|
||||
-L${NRF_SDK_LINKER_DIR} # Linker library directory (SDK)
|
||||
-L${LINKER_DIR} # Linker library directory
|
||||
-mcpu=cortex-m4 # CPU architecture
|
||||
-mfpu=fpv4-sp-d16 # Floating-point unit
|
||||
-mfloat-abi=hard
|
||||
-mthumb
|
||||
--specs=nano.specs # Use nano C library
|
||||
--specs=nosys.specs # Minimal syscall stubs
|
||||
-u _printf_float # Enable float support in printf
|
||||
-lc # Link C library
|
||||
-lm # Link math library
|
||||
-Wl,-Map=${PROJECT_NAME}.map,--cref # Generate memory map file
|
||||
-Wl,--gc-sections # Remove unused sections
|
||||
-Xlinker -print-memory-usage -Xlinker # Print memory usage after link
|
||||
)
|
||||
|
||||
# Link with logical (target-based) libraries
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
prj_config
|
||||
app
|
||||
freertos
|
||||
)
|
||||
|
||||
# ==========================
|
||||
# Post-build Actions
|
||||
# ==========================
|
||||
add_custom_command(TARGET ${EXECUTABLE}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_SIZE} ${EXECUTABLE}
|
||||
COMMENT "Print memory usage"
|
||||
)
|
||||
|
||||
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
|
||||
COMMENT "Generate .s19, .hex, and .bin output files"
|
||||
)
|
||||
@@ -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,15 @@
|
||||
@echo off
|
||||
REM Usage: ConvertSoftdevice.bat <Softdevice Name> <Intermediate Hex file name>
|
||||
set ARM_GCC_PREFIX=arm-none-eabi-
|
||||
cd /d %~dp0
|
||||
|
||||
if not exist soft mkdir soft
|
||||
if not exist hard mkdir hard
|
||||
|
||||
%ARM_GCC_PREFIX%objcopy.exe --gap-fill 0xFF -I ihex -O binary %2 %1_softdevice.bin
|
||||
|
||||
%ARM_GCC_PREFIX%gcc empty.c -c -o hard\%1_softdevice.o -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
%ARM_GCC_PREFIX%objcopy.exe --add-section .softdevice=%1_softdevice.bin --set-section-flags .softdevice=CONTENTS,ALLOC,LOAD,READONLY,CODE hard\%1_softdevice.o --remove-section .text --remove-section .data --remove-section .bss
|
||||
|
||||
%ARM_GCC_PREFIX%gcc empty.c -c -o soft\%1_softdevice.o -mcpu=cortex-m4 -mthumb -mfloat-abi=soft
|
||||
%ARM_GCC_PREFIX%objcopy.exe --add-section .softdevice=%1_softdevice.bin --set-section-flags .softdevice=CONTENTS,ALLOC,LOAD,READONLY,CODE soft\%1_softdevice.o --remove-section .text --remove-section .data --remove-section .bss
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
void dummyfunc()
|
||||
{
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.15.3)
|
||||
|
||||
file(GLOB_RECURSE APP_SOURCES "*.c")
|
||||
|
||||
add_library(app OBJECT ${APP_SOURCES})
|
||||
|
||||
target_link_libraries(app PRIVATE
|
||||
prj_config
|
||||
)
|
||||
@@ -5,6 +5,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "ble_advdata.h"
|
||||
|
||||
#include "nrf_ble_gatt.h"
|
||||
@@ -4,6 +4,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "ble_db_discovery.h"
|
||||
#include "nrf_ble_gatt.h"
|
||||
#include "nrf_ble_gq.h"
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "ble_dis_c.h"
|
||||
|
||||
#include "ble_gattc.h"
|
||||
@@ -7,7 +7,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "app_config.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "apply_old_config.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
@@ -4,6 +4,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "nrf_ble_gq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -3,6 +3,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "app_config.h"
|
||||
#include "ble_db_discovery.h"
|
||||
#include "ble_gattc.h"
|
||||
#include "ble_srv_common.h"
|
||||
@@ -6,6 +6,7 @@ extern "C"
|
||||
#include "ble_db_discovery.h"
|
||||
#include "ble_gattc.h"
|
||||
#include "ble_srv_common.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "nrf_ble_gq.h"
|
||||
|
||||
@@ -460,7 +461,7 @@ void le_uart_c_init(void)
|
||||
|
||||
m_le_uart_c.le_uart_c_cccd_timer = xTimerCreate("Timer", pdMS_TO_TICKS(1000), pdTRUE, (void *)1, le_uart_c_cccd_timer_cb);
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
xTaskCreate(ble_uart_echo, "ble uart echo", 2048, NULL, 3, NULL);
|
||||
#endif
|
||||
}
|
||||
+1
-1
@@ -121,7 +121,7 @@ static void initialize(void *p_context)
|
||||
|
||||
extern void le_uart_c_init(void);
|
||||
le_uart_c_init();
|
||||
|
||||
|
||||
extern void le_gap_init(void);
|
||||
le_gap_init();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "app_config.h"
|
||||
|
||||
#include "nrf_gpio.h"
|
||||
#include "nrf_spim.h"
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"path": "../bmd380_sdk"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"files.associations": {
|
||||
"ble_db_discovery.h": "c",
|
||||
"ble_dis_c.h": "c",
|
||||
"sdk_config.h": "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
)
|
||||
@@ -1,21 +1,15 @@
|
||||
/* Linker script for nRF52811_XXAA */
|
||||
/* Linker script for nRF52840_XXAA */
|
||||
|
||||
GROUP(S140_softdevice.o)
|
||||
MEMORY
|
||||
{
|
||||
FLASH_SOFTDEVICE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00027000
|
||||
FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000d9000
|
||||
EXTFLASH (rx) : ORIGIN = 0x12000000, LENGTH = 0x8000000
|
||||
RAM_SOFTDEVICE (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000
|
||||
RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 0x0002F000
|
||||
RTT (rwx) : ORIGIN = 0x2003F000, LENGTH = 0x00001000
|
||||
CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x6000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.segger_rtt (NOLOAD) :
|
||||
{
|
||||
} > RTT
|
||||
CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x40000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
@@ -23,14 +17,12 @@ SECTIONS
|
||||
.softdevice :
|
||||
{
|
||||
KEEP(*(.softdevice))
|
||||
FILL(0xFFFFFFFF);
|
||||
. = 0x00027000;
|
||||
} > FLASH_SOFTDEVICE
|
||||
|
||||
.softdevice_sram :
|
||||
{
|
||||
FILL(0xFFFFFFFF);
|
||||
. = 0x000079e0;
|
||||
. = 0x00010000;
|
||||
} > RAM_SOFTDEVICE
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
SECTIONS
|
||||
{
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.mem_section_dummy_ram :
|
||||
{
|
||||
}
|
||||
.cli_sorted_cmd_ptrs :
|
||||
{
|
||||
PROVIDE(__start_cli_sorted_cmd_ptrs = .);
|
||||
KEEP(*(.cli_sorted_cmd_ptrs))
|
||||
PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
|
||||
} > RAM
|
||||
.fs_data :
|
||||
{
|
||||
PROVIDE(__start_fs_data = .);
|
||||
KEEP(*(.fs_data))
|
||||
PROVIDE(__stop_fs_data = .);
|
||||
} > RAM
|
||||
.log_dynamic_data :
|
||||
{
|
||||
PROVIDE(__start_log_dynamic_data = .);
|
||||
KEEP(*(SORT(.log_dynamic_data*)))
|
||||
PROVIDE(__stop_log_dynamic_data = .);
|
||||
} > RAM
|
||||
.log_filter_data :
|
||||
{
|
||||
PROVIDE(__start_log_filter_data = .);
|
||||
KEEP(*(SORT(.log_filter_data*)))
|
||||
PROVIDE(__stop_log_filter_data = .);
|
||||
} > RAM
|
||||
|
||||
} INSERT AFTER .data;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.mem_section_dummy_rom :
|
||||
{
|
||||
}
|
||||
.sdh_soc_observers :
|
||||
{
|
||||
PROVIDE(__start_sdh_soc_observers = .);
|
||||
KEEP(*(SORT(.sdh_soc_observers*)))
|
||||
PROVIDE(__stop_sdh_soc_observers = .);
|
||||
} > FLASH
|
||||
.sdh_ble_observers :
|
||||
{
|
||||
PROVIDE(__start_sdh_ble_observers = .);
|
||||
KEEP(*(SORT(.sdh_ble_observers*)))
|
||||
PROVIDE(__stop_sdh_ble_observers = .);
|
||||
} > FLASH
|
||||
.pwr_mgmt_data :
|
||||
{
|
||||
PROVIDE(__start_pwr_mgmt_data = .);
|
||||
KEEP(*(SORT(.pwr_mgmt_data*)))
|
||||
PROVIDE(__stop_pwr_mgmt_data = .);
|
||||
} > FLASH
|
||||
.sdh_req_observers :
|
||||
{
|
||||
PROVIDE(__start_sdh_req_observers = .);
|
||||
KEEP(*(SORT(.sdh_req_observers*)))
|
||||
PROVIDE(__stop_sdh_req_observers = .);
|
||||
} > FLASH
|
||||
.sdh_state_observers :
|
||||
{
|
||||
PROVIDE(__start_sdh_state_observers = .);
|
||||
KEEP(*(SORT(.sdh_state_observers*)))
|
||||
PROVIDE(__stop_sdh_state_observers = .);
|
||||
} > FLASH
|
||||
.sdh_stack_observers :
|
||||
{
|
||||
PROVIDE(__start_sdh_stack_observers = .);
|
||||
KEEP(*(SORT(.sdh_stack_observers*)))
|
||||
PROVIDE(__stop_sdh_stack_observers = .);
|
||||
} > FLASH
|
||||
.nrf_queue :
|
||||
{
|
||||
PROVIDE(__start_nrf_queue = .);
|
||||
KEEP(*(.nrf_queue))
|
||||
PROVIDE(__stop_nrf_queue = .);
|
||||
} > FLASH
|
||||
.nrf_balloc :
|
||||
{
|
||||
PROVIDE(__start_nrf_balloc = .);
|
||||
KEEP(*(.nrf_balloc))
|
||||
PROVIDE(__stop_nrf_balloc = .);
|
||||
} > FLASH
|
||||
.cli_command :
|
||||
{
|
||||
PROVIDE(__start_cli_command = .);
|
||||
KEEP(*(.cli_command))
|
||||
PROVIDE(__stop_cli_command = .);
|
||||
} > FLASH
|
||||
.crypto_data :
|
||||
{
|
||||
PROVIDE(__start_crypto_data = .);
|
||||
KEEP(*(SORT(.crypto_data*)))
|
||||
PROVIDE(__stop_crypto_data = .);
|
||||
} > FLASH
|
||||
.log_const_data :
|
||||
{
|
||||
PROVIDE(__start_log_const_data = .);
|
||||
KEEP(*(SORT(.log_const_data*)))
|
||||
PROVIDE(__stop_log_const_data = .);
|
||||
} > FLASH
|
||||
.log_backends :
|
||||
{
|
||||
PROVIDE(__start_log_backends = .);
|
||||
KEEP(*(SORT(.log_backends*)))
|
||||
PROVIDE(__stop_log_backends = .);
|
||||
} > FLASH
|
||||
|
||||
} INSERT AFTER .text
|
||||
|
||||
|
||||
INCLUDE "nrf_common.ld"
|
||||
|
||||
PROVIDE(_sbss = __bss_start__);
|
||||
PROVIDE(_ebss = __bss_end__);
|
||||
PROVIDE(_sdata = __data_start__);
|
||||
PROVIDE(_sidata = __etext);
|
||||
PROVIDE(_estack = __StackTop);
|
||||
PROVIDE(_edata = __data_end__);
|
||||
PROVIDE(__isr_vector = __StackTop);
|
||||
PROVIDE(_etext = __etext);
|
||||
Reference in New Issue
Block a user