Giter Club home page Giter Club logo

cmake-nrf5x's Introduction

nRF5 CMake

nRF5 CMake

This repository provides platform-agnostic CMake files that can be used to build custom nRF5 projects. Our goal is to cover the most used libraries and examples starting from nRF5 SDK version 15.3.0.

How to use

Copy all CMake files from the ./cmake folder located in this repository to your project location and create a basic CMakeLists.txt file:

cmake_minimum_required(VERSION 3.14)
project(blinky LANGUAGES C ASM)

include("nrf5")
add_executable(${CMAKE_PROJECT_NAME}
  "${NRF5_SDK_PATH}/examples/peripheral/blinky/main.c"
)

nrf5_target(${CMAKE_PROJECT_NAME})
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
  nrf5_nrfx_common
  nrf5_delay
  nrf5_boards
)

The above example compiles source from the SDK but the user is expected to copy main.c and modify it instead. Below you can look at a very basic bash script, which builds and flashes blinky example.

#!/bin/bash

# Generate project inside ./build folder.
cmake \
    -S . \
    -B build \
    -DCMAKE_TOOLCHAIN_FILE="./cmake/arm-none-eabi.cmake" \
    -DTOOLCHAIN_PREFIX="/Users/przemyslawlenart/git/nrf5-cmake/ci/toolchains/gcc" \
    -DNRF5_SDK_PATH="/Users/przemyslawlenart/git/nrf5-cmake/ci/sdks/16.0.0" \
    -DNRF5_BOARD="pca10056" \
    -DNRF5_SOFTDEVICE_VARIANT="s140"

# Build project
cmake --build build

# Erase all
cmake --build build --target erase_all

# Flash SoftDevice (if used)
cmake --build build --target flash_softdevice

# Flash progarm
cmake --build build --target flash

You can find more examples in the repo's ./ci/examples/ folder. Make sure to check all available cached variables, which are documented below and read Contributing readme file if you plan to automate SDK and tool downloads.

Configuration

CMake files are configured with cached variables. A lot of them are optional and can be deduced from other ones or SDK itself. Specify -DNAME=VALUE during project generation to pass them.

CMAKE_TOOLCHAIN_FILE (file path, requred)

Specifies a file path to the toolchain file which points to the ARM compiler utilities. Currently, only GCC toolchain is supported and arm-none-eabi.cmake file is included in ./cmake folder, which you should copy to your project.

TOOLCHAIN_PREFIX (directory path, optional)

Path to the directory containing GCC toolchain. If not specified, version installed globally is used.

NRF5_SDK_PATH (directory path, required)

Specifies a path to the nRF5 SDK, which should be used during compilation. Root directory should include folders like examples, components etc.

NRF5_SDK_VERSION (version string, optional)

You can explicily specify SDK version (e.g. "16.0.0"). When this cached variable is not provided, version is deduced from the SDK file contents.

NRF5_BOARD (board name, optional)

If you are using the nRF board you can specify it (e.g. "pca10056") and the value of NRF5_TARGET will be deduced accordingly. If defined, all board-specific defines (like -DBOARD_PCA10056) are included for all source files during compilation.

NRF5_TARGET (target name, optional)

If NRF5_BOARD is not specified, this variable is required. You can use alias value like nrf52840, but full target name is recommended: nrf52840_xxaa. CMake file will deduce all chip specific flags during compilation for all project sources (e.g. "-mcpu=cortex-m4").

NRF5_SOFTDEVICE_VARIANT (soft device name, required)

This variable specifies the SoftDevice binary. If the project doesn't require SoftDevice you can pass "blank" value, otherwise set SoftDevice name (e.g. "s140"). Following triple: (NRF5_SDK_VERSION, NRF5_TARGET, NRF5_SOFTDEVICE_VARIANT) is then verified to check if the combination is well supported. All SoftDevice related defines are included for all source files (e.g. "-DNRF_SD_BLE_API_VERSION=7"). The flash_softdevice target should be pointing to the correct SoftDevice file.

NRF5_SDKCONFIG_PATH (directory path, optional)

It is highly recommended to specify a path to custom "sdk_config.h" file. Otherwise, based on the above variables' values, the CMake file tries to find the best matching file from the SDK. If you want to create a custom target which depends on the config file, link nrf5_config dependency. All builtin libraries are doing it by default.

NRF5_APPCONFIG_PATH (directory path, optional)

If your project is using app_config.h you can provide include directory pointing to this file.

NRF5_LINKER_SCRIPT (file path, optional)

It is highly recommended to specify a path to custom linker file. Otherwise, based on the above variables' values, the CMake file tries to find the best matching file from the SDK.

NRF5_NRFJPROG (executable file, optional)

Path to the nrfjprog executable used by targets flashing programs. If not specified, globally installed binary is used.

NRF5_STACK_SIZE (size in bytes, optional)

Defines __STACK_SIZE compile definition accordingly. If not passed, the startup file (.S) will take care of setting up default stack boundaries for the specified target.

NRF5_HEAP_SIZE (size in bytes, optional)

Defines __HEAP_SIZE compile definition accordingly. If not passed, the startup file (.S) will take care of setting up default heap boundaries for the specified target.

NRF_JLINK_SN (SEGGER J-Link serial number, optional)

Tells nrfjprog utility which SEGGER J-Link debugger to use based on its serial number. Particularily useful when working with multiple J-Links connected to the PC at the same time. If not specified, user may be prompted which J-Link to use when running commands like flashing and erasing.

Important: You must clear CMake cache and re-run CMake in order to change it.

Contributing

The project is developed in a semi-automated way and thoroughly tested with CI by compiling both SDK provided examples and libraries. You can find more information about the project's setup, structure, scripts, etc. in ./ci/README.md file.

Thank you!

License

MIT License

Copyright (c) 2020 Polidea

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Maintained by Polidea

Polidea

cmake-nrf5x's People

Contributors

borys-jelenski-polidea avatar borysjelenski avatar cierpliwy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmake-nrf5x's Issues

Introduce versioning

We need to come up with a strategy to introduce versioning shortly. Currently, a lot of names and features are unstable, and we should communicate than through versioning. I can see the following steps required to achieve it:

  • Define the versioning scheme in the README file.
  • Add changelog, when breaking changes are introduced.
  • Create release packs with bundled CMake files (should be a Github Action triggered by tags).

process_begin: CreateProcess(NULL, nrfjprog -c 4000 --eraseall --program untitled4.hex --sectorerase, ...) failed.

First of all, this is a question, not really an issue, but since you seem to have more knowledge for cmake files rather than me, I'd like to ask something. I have almost the same cmake file (customized yours for the NRF52) but when I try to build the project, I get the following error message:

mingw32-make.exe[2]: Leaving directory 'C:/Users/marcd/Google Drive/HBO ICT/Jaar 3/Stage/untitled4/cmake-build-debug'
process_begin: CreateProcess(NULL, nrfjprog -c 4000 --eraseall --program untitled4.hex --sectorerase, ...) failed.
mingw32-make.exe[1]: Leaving directory 'C:/Users/marcd/Google Drive/HBO ICT/Jaar 3/Stage/untitled4/cmake-build-debug'
make (e=2): The system cannot find the file specified.
mingw32-make.exe[2]: *** [CMakeFiles\flash_untitled4.dir\build.make:60: CMakeFiles/flash_untitled4] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:112: CMakeFiles/flash_untitled4.dir/all] Error 2
mingw32-make.exe: *** [Makefile:86: all] Error 2

It cannot create the process for some reason while I have nrfjprog installed and added to path. Also I am running the FLASH_${EXECUTABLE_NAME}, when I run the project. Do you have any suggestions?

Cover all examples from the `ble_peripheral` folder.

Examples to cover:

  • ble_peripheral/ble_app_alert_notification
  • ble_peripheral/ble_app_ancs_c
  • ble_peripheral/ble_app_beacon
  • ble_peripheral/ble_app_blinky
  • ble_peripheral/ble_app_bms
  • ble_peripheral/ble_app_bps
  • ble_peripheral/ble_app_buttonless_dfu
  • ble_peripheral/ble_app_cscs
  • ble_peripheral/ble_app_cts_c
  • ble_peripheral/ble_app_eddystone
  • ble_peripheral/ble_app_gatts_c
  • ble_peripheral/ble_app_gls
  • ble_peripheral/ble_app_hids_keyboard
  • ble_peripheral/ble_app_hids_mouse
  • ble_peripheral/ble_app_hrs
  • ble_peripheral/ble_app_hrs_freertos
  • ble_peripheral/ble_app_hts
  • ble_peripheral/ble_app_ias_c
  • ble_peripheral/ble_app_ipsp_acceptor
  • ble_peripheral/ble_app_proximity
  • ble_peripheral/ble_app_pwr_profiling
  • ble_peripheral/ble_app_rscs
  • ble_peripheral/ble_app_template
  • ble_peripheral/ble_app_tile
  • ble_peripheral/ble_app_uart
  • ble_peripheral/experimental/ble_app_cgms
  • ble_peripheral/experimental/ble_app_cli
  • ble_peripheral/experimental/ble_app_hids_keyboard_pairing_nfc
  • ble_peripheral/experimental/ble_app_hrs_nfc_pairing
  • ble_peripheral/experimental/ble_app_lls
  • ble_peripheral/experimental/ble_app_lns
  • ble_peripheral/experimental/ble_app_multiperipheral
  • ble_peripheral/experimental/ble_app_ots
  • ble_peripheral/experimental/ble_app_queued_writes
  • ble_peripheral/experimental/ble_nfc_pairing_reference
  • ble_peripheral/experimental/bluetoothds_template

Detect if nrfjprog is a recognised command

Currently the code does not check whether or not nrfjprog is actually included in PATH. One way to check if to see if nrfjprog.exe is found using find_program()

There's also no gurantee that if a user defines a path for NRF5_NRFJPROG that it is a valid path.

if(NOT NRF5_NRFJPROG)
    # Check if nrfjprog command is recognised
    find_program(NRFJPROG "nrfjprog")
    if(NRFJPROG)
        set(NRF5_NRFJPROG "nrfjprog" CACHE FILEPATH "" FORCE)
        message(STATUS "Using nrfjprog utility available from PATH: ${NRF5_NRFJPROG}")
    else()
        message(FATAL_ERROR "Could no find nrfjprog utlity from PATH")
    endif()
else()
  message(STATUS "Using nrfjprog utility: ${NRF5_NRFJPROG}")
endif()

Example is not working

I followed the example, it compiles, flashes both softdevice and firmware, but the Led1 that is supposed to be lit on the board is not and the ble is not broadcasting.

I also compiled the simple peripheral/blinky example and it also does not work.

Am I missing something?

Thank you

Add support for the nRF5 SDK 17.0.0

Library definitions and examples should be adapted if needed so they can be build with the version 17.0.0 of the nRF5 SDK. After this change, version 16.0.0 and 17.0.0 should be used for building on the CI.

Elf file

Can anyone lead me in the right direction of creating an elf file and setting up with Cortex-Debug for VS Code?

nrf5_drv_uart build failed

info: ci/examples/ble_peripheral/ble_app_blinky, SDK 16.0.0
command:

cmake . -D NRF5_SDK_PATH=/tmp/nRF5_SDK -D NRF5_TARGET=nrf52832 -D NRF5_SOFTDEVICE_VARIANT=s132 && make

[ 66%] Building C object CMakeFiles/nrf5_drv_uart.dir/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.c.o
In file included from /tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.c:41:
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.h:122:13: error: unknown type name 'nrf_uarte_baudrate_t'
     typedef nrf_uarte_baudrate_t        nrf_uart_baudrate_t;
             ^~~~~~~~~~~~~~~~~~~~
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.h:127:13: error: unknown type name 'nrf_uarte_error_mask_t'
     typedef nrf_uarte_error_mask_t      nrf_uart_error_mask_t;
             ^~~~~~~~~~~~~~~~~~~~~~
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.h:130:13: error: unknown type name 'nrf_uarte_hwfc_t'
     typedef nrf_uarte_hwfc_t            nrf_uart_hwfc_t;
             ^~~~~~~~~~~~~~~~
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.h:133:13: error: unknown type name 'nrf_uarte_parity_t'
     typedef nrf_uarte_parity_t          nrf_uart_parity_t;
             ^~~~~~~~~~~~~~~~~~
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.h:134:13: error: unknown type name 'nrf_uarte_task_t'
     typedef nrf_uarte_task_t            nrf_uart_task_t;
             ^~~~~~~~~~~~~~~~
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.h:135:13: error: unknown type name 'nrf_uarte_event_t'
     typedef nrf_uarte_event_t           nrf_uart_event_t;
             ^~~~~~~~~~~~~~~~~
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.c: In function 'nrf_drv_uart_init':
/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.c:124:27: warning: variable 'config' set but not used [-Wunused-but-set-variable]
     nrf_drv_uart_config_t config = *p_config;
                           ^~~~~~
make[2]: *** [CMakeFiles/nrf5_drv_uart.dir/build.make:82: CMakeFiles/nrf5_drv_uart.dir/tmp/nRF5_SDK/integration/nrfx/legacy/nrf_drv_uart.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1454: CMakeFiles/nrf5_drv_uart.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

[FR] linker script database

in case user didn't provide linker a scripts, c-nRF can do smarter then now.
Based on this input:

  1. chip;
  2. SoftDevice;
  3. is this app or bootloader.

it can provide suitable linker script or generate it on the fly.

Has this gone stale?

I've noticed that there haven't been any commits in two years. Wanted to check if there are any plans to develop this further.

Thanks!

gcc_startup_nrf5 error

hello,
I follow your code. and I am using the clion IDE on Mac OS . now I am getting this error.

CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:9:157: warning: null character(s) ignored
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:9:169: warning: null character(s) ignored
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o: Assembler messages:
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:1: Error: junk at end of line, first unrecognized character valued 0x7f
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:2: Error: junk at end of line, first unrecognized character valued 0x3
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:3: Error: bad instruction `h�h'
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:4: Error: bad instruction `c�` H�h'
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:5: Error: bad instruction `c�J K�����'
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:5: Error: bad instruction `�x�p����������$�'
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:6: Error: junk at end of line, first unrecognized character is `:'
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:7: Error: junk at end of line, first unrecognized character is `4'
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:8: Error: junk at end of line, first unrecognized character valued 0x1
CMakeFiles/Blinky.dir/Users/atifshabbir/Development/SDK/components/toolchain/gcc/gcc_startup_nrf51.S.o:9: Error: junk at end of line, first unrecognized character valued 0x7
make[3]: *** [Blinky.out] Error 1
make[2]: *** [CMakeFiles/Blinky.dir/all] Error 2
make[1]: *** [CMakeFiles/Blinky.dir/rule] Error 2
make: *** [Blinky] Error 2

in the start he give me lot of warning but I just copy last two warning which is the same as previous warning. after then some error regarding the gcc_startup_nrf5.

thank you

Correctly handle the 'flash_softdevice' custom target in 'blank' and 'mbr' configurations

If blank or mbr will be specified as NRF5_SD_VARIANT, running the flash_softdevice target after a successful configuration will result in the nrfjprog reporting an error. This is due to the local_sd_hex_file_path CMake variable which in case of blank and MBR variants will remain uninitialized (empty). This will result in composing of an incorrect command line for the nrfjprog.

Supporting Thread and Zigbee SDK

Hello!

From that what I can see the Thread and Zigbee SDK has similar directory structure as the nRF SDK, but some of the components are missing and some of components are present only in the former.

The contributing guide explains how to support a new library to use within the "normal" SDK. Most probably to use another SDK some extra steps should be made or the existing steps should be made in another way. I could even try to contribute to support the Thread and Zigbee SDK, but I need support from the authors to take a look at the current project structure and say whether the normal approach is fine or no.

To support the Thread and Zigbee SDK we would need most probably to make some changes in the definition of the cache variables.

What do you think about that?

Make "missing separator. Stop"

Hi,

There are some .cmake files that have some kind of indent problem. When you try to compile blinky example adding "nrf5_app_scheduler" as target link library (SDK 16) on Linux environment it throws the following error:
Scanning dependencies of target nrf5_mdk [100%] Building ASM object CMakeFiles/nrf5_mdk.dir/nRF5_SDK_16.0.0/modules/nrfx/mdk/gcc_startup_nrf52.S.obj [100%] Building C object CMakeFiles/nrf5_mdk.dir/nRF5_SDK_16.0.0/modules/nrfx/mdk/system_nrf52.c.obj [100%] Built target nrf5_mdk Scanning dependencies of target nrf5_boards [100%] Building C object CMakeFiles/nrf5_boards.dir/nRF5_SDK_16.0.0/components/boards/boards.c.obj [100%] Built target nrf5_boards Scanning dependencies of target nrf5_app_scheduler CMakeFiles/nrf5_app_scheduler.dir/depend.make:4: *** missing separator. Stop. make[1]: *** [CMakeFiles/Makefile2:5985: CMakeFiles/nrf5_app_scheduler.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 stark@vm:~/workspace/cmake-nRF5x/build$

Afterwards, if you run again "make", it compiles. This error happens with many files of this project. I have idented all .cmake files but continues happening I do not know where is the problem.

Best regards

Cover all examples from the `peripheral` folder.

Examples to cover:

  • peripheral/blinky
  • peripheral/blinky_freertos
  • peripheral/blinky_rtc_freertos
  • peripheral/blinky_systick
  • peripheral/bsp
  • peripheral/cli
  • peripheral/cli_libuarte
  • peripheral/csense
  • peripheral/csense_drv
  • peripheral/fatfs
  • peripheral/flash_fds
  • peripheral/flash_fstorage
  • peripheral/flashwrite
  • peripheral/fpu_fft
  • peripheral/gfx
  • peripheral/gpiote
  • peripheral/i2s
  • peripheral/led_softblink
  • peripheral/libuarte
  • peripheral/low_power_pwm
  • peripheral/lpcomp
  • peripheral/nrfx_spim
  • peripheral/pin_change_int
  • peripheral/ppi
  • peripheral/preflash
  • peripheral/pwm_driver
  • peripheral/pwm_library
  • peripheral/pwr_mgmt
  • peripheral/qdec
  • peripheral/qspi
  • peripheral/qspi_bootloader
  • peripheral/radio_test
  • peripheral/radio/receiver
  • peripheral/radio/transmitter
  • peripheral/ram_retention
  • peripheral/rng
  • peripheral/rtc
  • peripheral/saadc
  • peripheral/serial
  • peripheral/serial_uartes
  • peripheral/simple_timer
  • peripheral/spi
  • peripheral/spi_master_using_nrf_spi_mngr
  • peripheral/spis
  • peripheral/temperature
  • peripheral/template_project
  • peripheral/timer
  • peripheral/twi_master_using_nrf_twi_mngr
  • peripheral/twi_master_with_twis_slave
  • peripheral/twi_scanner
  • peripheral/twi_sensor
  • peripheral/uart
  • peripheral/uicr_config
  • peripheral/usbd
  • peripheral/usbd_audio
  • peripheral/usbd_ble_uart
  • peripheral/usbd_ble_uart_freertos
  • peripheral/usbd_cdc_acm
  • peripheral/usbd_hid_composite
  • peripheral/usbd_hid_generic
  • peripheral/usbd_msc
  • peripheral/wdt

fails to link imported libraries

Redefinition of CMAKE_CXX_LINK_EXECUTABLE omits <LINK_LIBRARIES>. It should be:

set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> -lstdc++ -o <LINK_LIBRARIES>")

For example, without it, this fails with undefined references at link time:

add_library(bar STATIC IMPORTED)
set_target_properties( bar PROPERTIES IMPORTED_LOCATION /home/bootch/git/radioSoC/Debug52/bar.a )
nRF5x_addExecutable(foo main.cpp)
target_link_libraries( foo bar)

apparently cmake enacts that via <LINK_LIBRARIES>.

Also, what happens if the scripts don't redefine at all (and as you say, CMAKE_C_FLAGS are added implicitly)? I guess I should try it and see how CMAKE_C_FLAGS disrupt the link.

Incompatible with newer NRF SDK 14.2

It seems that Nordic restructured SDK directories and renamed some files, e.g. softdevice_handler.c is now called sdh.c ? And location of RTT files changed?

I don't expect anyone to fix this, just noting that users of the script might need to adjust for SDK versions other than 12.3 used by the script.

Support pca10100 board with SDK 16.0.0

In the nrf5_helpers.cmake file, the pca10100 seems to be the only board which does not support SDK 16. Is there any reason for this? Could it be a mistake?
If I change line 71 to the following:

  set(board_pca10100      nrf52833_xxaa BOARD_PCA10100 15.3.0 16.0.0)

I'm able to compile the blinky example just fine.

RTT viewer is not printing

Hello,

I am trying to use this framework and all is good, build files, flash, etc. Tho only problem is that I am trying to print something with RTT of Jlink and I can't see the output print. could you help me with this?

this is my src file:

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "bsp.h"
#include "nrf.h"
#include "system_nrf52.h"
#include "nrf_delay.h"
#include "sdk_config.h"

#define ENABLE_SWD 1

static const uint8_t leds_list[LEDS_NUMBER] = { 9, 7, LED_3, LED_4 };

int main(void)
{
    /* Configure LED-pins as outputs. */
    printf("yeah nene\n");
    LEDS_CONFIGURE(LEDS_MASK);
    while (true)
    {
        for (int i = 0; i < LEDS_NUMBER; i++)
        {
            LEDS_INVERT(1 << leds_list[i]);
            printf("testing print CMAKE\n");
            nrf_delay_ms(500);
        }
    }
}

RTT viewer is not printing

Hello,

I am trying to use this framework and all is good, build files, flash, etc. Tho only problem is that I am trying to print something with RTT of Jlink and I can't see the output print. could you help me with this?

this is my src file:

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "bsp.h"
#include "nrf.h"
#include "system_nrf52.h"
#include "nrf_delay.h"
#include "sdk_config.h"

#define ENABLE_SWD 1

static const uint8_t leds_list[LEDS_NUMBER] = { 9, 7, LED_3, LED_4 };

int main(void)
{
    /* Configure LED-pins as outputs. */
    printf("yeah nene\n");
    LEDS_CONFIGURE(LEDS_MASK);
    while (true)
    {
        for (int i = 0; i < LEDS_NUMBER; i++)
        {
            LEDS_INVERT(1 << leds_list[i]);
            printf("testing print CMAKE\n");
            nrf_delay_ms(500);
        }
    }
}

Add 'nrf5_bsp_defs' target with include dirs. only

There are examples in nRF5 SDK which rely on definitions found in bsp.h file however, they do not require the bsp.c to be compiled e.g. peripheral/uart. Actually, such examples do not contain the configuration required (in sdk_config.h) to compile the bsp.c. The problem is, when the nrf5_bsp target is linked in those examples, it cannot be built correctly.

The solution would be to create an interface target nrf5_bsp_defs containing only the include directory for the bsp.h file.

Cover all examples from the `ble_central` folder.

Examples to cover:

  • ble_central/ble_app_blinky_c
  • ble_central/ble_app_gatts
  • ble_central/ble_app_hrs_c
  • ble_central/ble_app_ias
  • ble_central/ble_app_ipsp_initiator
  • ble_central/ble_app_multilink_central
  • ble_central/ble_app_rscs_c
  • ble_central/ble_app_uart_c
  • ble_central/experimental/ble_app_hrs_nfc_c
  • ble_central/experimental/ble_app_ots_c
  • ble_central/experimental/ble_nfc_pairing_reference_c

Missing step : include("CMake_nRF5x.cmake") from CMakeLists.txt ?

Is this step missing from the tutorial in the readme?

Without it, I get:

CMake Error at CMakeLists.txt:13 (nRF5x_setup):
Unknown CMake command "nRF5x_setup".

when I run: cmake -H. -B"cmake-build" -G "Unix Makefiles"

although I think I followed your tutorial closely.

Alternatively, can you link to a project that uses your cmake script? Or put a template CMakeLists.txt in your repository? That might help other CMake newbies like myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.