This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Building app with nRF Connect SDK in private repo

We would like the ability to build our application using a version of the nRF Connect SDK that we have in a private repo. This is desirable for both long term maintenance, as well as capturing any changes we make to the SDK (such as the private key used in app signing).

We are able to build the app using the standard build process described in the SDK documentation. However, we are having issues building the same app when using a version of the SDK in our own git repo. The main problem lies with the cmake command to configure Ninja. We get a cmake error trying to resolve the mbedtls project (despite it's presence in the build directory).

Here is the build output:

Loading solution McubootApp.emProject
Executing load commands
cmake -GNinja -DBOARD=nrf9160_pca10090ns -DBOARD_DIR=C:/ncs/nrf-connect-sdk/zephyr/boards/arm/nrf9160_pca10090 -DZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb -DGNUARMEMB_TOOLCHAIN_PATH=C:/gnuarmemb -BC:/software/Embedded/CMD/McubootApp/build_nrf9160_pca10090ns -HC:/software/Embedded/CMD/McubootApp -DDTC_OVERLAY_FILE=C:/software/Embedded/CMD/McubootApp/nrf9160_pca10090ns.overlay -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:/Users/Desktop/arm_segger_embedded_studio_v418_win_x64_nordic/html/configure_nordic_project_menuconfig.py
-- Using application from 'C:/software/Embedded/CMD/McubootApp'
Zephyr version: 1.14.99
-- git describe failed: fatal: Not a valid object name HEAD;
   BUILD_VERSION is left undefined
-- Selected BOARD nrf9160_pca10090ns
-- Found west: C:/Python37/Scripts/west.exe (found suitable version "0.5.8", minimum required is "0.5.6")
-- Cache files will be written to: C:\Users\bvajda\AppData\Local/.cache/zephyr
-- Loading C:/ncs/nrf-connect-sdk/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns.dts as base
-- Overlaying C:/ncs/nrf-connect-sdk/zephyr/dts/common/common.dts
-- Overlaying C:/software/Embedded/CMD/McubootApp/nrf9160_pca10090ns.overlay
Parsing Kconfig tree in C:/ncs/nrf-connect-sdk/zephyr/Kconfig
Loading C:/software/Embedded/CMD/McubootApp/build_nrf9160_pca10090ns/zephyr/.config as base
Configuration written to 'C:/software/Embedded/CMD/McubootApp/build_nrf9160_pca10090ns/zephyr/.config'
Including module: nrf in path: C:\ncs\nrf-connect-sdk\nrf
-- Using application from 'C:/ncs/nrf-connect-sdk/nrf/samples/nrf9160/spm'
Zephyr version: 1.14.99
Changed board to secure nrf9160_pca10090 (NOT NS)
-- Loading C:/ncs/nrf-connect-sdk/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090.dts as base
-- Overlaying C:/ncs/nrf-connect-sdk/zephyr/dts/common/common.dts
-- Overlaying C:/ncs/nrf-connect-sdk/nrf/samples/nrf9160/spm/nrf9160_pca10090.overlay
Parsing Kconfig tree in C:/ncs/nrf-connect-sdk/zephyr/Kconfig
Loading C:/software/Embedded/CMD/McubootApp/build_nrf9160_pca10090ns/spm/zephyr/.config as base
Configuration written to 'C:/software/Embedded/CMD/McubootApp/build_nrf9160_pca10090ns/spm/zephyr/.config'
Including module: nrf in path: C:\ncs\nrf-connect-sdk\nrf
Including module: mcuboot in path: C:\ncs\nrf-connect-sdk\mcuboot\zephyr
Including module: nrfxlib in path: C:\ncs\nrf-connect-sdk\nrfxlib
FATAL ERROR: The following projects are not cloned: mbedtls. Please clone them first with 'west clone'.
CMake Error at C:/ncs/nrf-connect-sdk/nrfxlib/nrf_security/CMakeLists.txt:30 (message):
  Failed to find mbedtls, cannot build security libraries

As a general question, what is the preferred approach to using a private repo for the SDK? The approach I took was admittedly brute force; basically taking the my local copy of the SDK, stripping the .git information, and committing the whole SDK into our repo.

Thanks-

Brian

  • Hi Brian,


    I would suggest making a fork of the nrf repo.

    (https://github.com/NordicPlayground/fw-nrfconnect-nrf)

    Then you would need to clone that fork to your local computer:

    mkdir ncs && cd ncs
    git clone https://github.com/<username>/fw-nrfconnect-nrf nrf
    

    Then you add the upstream repository as remote:

    cd nrf
    git remote add ncs https://github.com/NordicPlayground/fw-nrfconnect-nrf
    git remote -v

    Then you 'checkout' the latest stable tag (v1.0.0) and make a branch of that:

    git checkout v1.0.0
    git checkout -b <new-branch-name>

    Then you would need to initialize west and get the other repositories:

    cd ..
    west init -l nrf
    cd nrf
    west update

    and then you can 'git push' to get the changes up to your github.

    git push --set-upstream origin <name_of_your_branch>


    When there comes some new updates from upstream you can get those by:

    cd nrf
    git checkout master
    git fetch ncs
    git merge ncs/master

     

    Best Regards,

    Martin L.

Related