diff options
Diffstat (limited to 'cmake-nRF5x/example')
-rw-r--r-- | cmake-nRF5x/example/CMakeLists.txt | 18 | ||||
-rw-r--r-- | cmake-nRF5x/example/README.md | 3 | ||||
-rw-r--r-- | cmake-nRF5x/example/src/CMakeLists.txt | 39 |
3 files changed, 60 insertions, 0 deletions
diff --git a/cmake-nRF5x/example/CMakeLists.txt b/cmake-nRF5x/example/CMakeLists.txt new file mode 100644 index 00000000..9d002518 --- /dev/null +++ b/cmake-nRF5x/example/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.12) + +set(NRF_TARGET nrf52) + +if (NOT DEFINED ARM_NONE_EABI_TOOLCHAIN_PATH) + set(ARM_NONE_EABI_TOOLCHAIN_PATH "/usr/local/bin") +endif () + +set(NRF5_SDK_PATH "${CMAKE_CURRENT_LIST_DIR}/../../toolchains/nRF5/nRF5_SDK") +set(NRFJPROG "${CMAKE_CURRENT_LIST_DIR}/../../toolchains/nRF5/nrfjprog/nrfjprog") + +include("${CMAKE_CURRENT_LIST_DIR}/../CMake_nRF5x.cmake") + +nRF5x_toolchainSetup() + +project(ExampleProject C) + +add_subdirectory(src)
\ No newline at end of file diff --git a/cmake-nRF5x/example/README.md b/cmake-nRF5x/example/README.md new file mode 100644 index 00000000..753d63f9 --- /dev/null +++ b/cmake-nRF5x/example/README.md @@ -0,0 +1,3 @@ +# Example + +This is an example to build the blinky project. It assumes nRF5 SDK is in `../../toolchains/nRF5/nRF5_SDK`. If not, modify `CMakeLists.txt`
\ No newline at end of file diff --git a/cmake-nRF5x/example/src/CMakeLists.txt b/cmake-nRF5x/example/src/CMakeLists.txt new file mode 100644 index 00000000..63ac6056 --- /dev/null +++ b/cmake-nRF5x/example/src/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 3.12) + +project(BlinkyExample C ASM) + +# define some variables just for this example to determine file locations +set(NRF_PROJECT_NAME ble_app_blinky) +set(NRF_BOARD pca10040) +set(NRF_SOFTDEVICE s132) + +# define some convenience variables to point to example project directories +set(NRF_PROJECT_PATH ${NRF5_SDK_PATH}/examples/ble_peripheral/${NRF_PROJECT_NAME}) +set(NRF_PROJECT_DEVICE_PATH ${NRF_PROJECT_PATH}/${NRF_BOARD}/${NRF_SOFTDEVICE}) + +# you can specify the location of the linker script if desired instead of using a specific file name +set(NRF5_LINKER_SCRIPT ${NRF_PROJECT_DEVICE_PATH}/armgcc/${NRF_PROJECT_NAME}_gcc_${NRF_TARGET}.ld) + +nRF5x_setup() + +nRF5x_addAppScheduler() +nRF5x_addAppFIFO() +nRF5x_addAppTimer() +nRF5x_addAppUART() +nRF5x_addAppButton() +nRF5x_addBSP(TRUE FALSE FALSE) +nRF5x_addBLEGATT() + +nRF5x_addBLEService(ble_lbs) + +add_definitions(-DCONFIG_GPIO_AS_PINRESET) + +# usually you would include files in this directory here, like so: +#include_directories(.) +#list(APPEND SOURCE_FILES main.c) + +# for example projects we include the example source files +include_directories(${NRF_PROJECT_DEVICE_PATH}/config) +list(APPEND SOURCE_FILES ${NRF_PROJECT_PATH}/main.c) + +nRF5x_addExecutable(BlinkyExample "${SOURCE_FILES}")
\ No newline at end of file |