Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Best way to set up a SEGGER Project/Solution with the nRF SDK for version control?

I'm setting up a new project (solution?) for the nRF52-DK, using SEGGER,  based on one of the examples in the SDK, and would like to put it under version control (Github, etc.) in a folder outside the SDK directory structure.

Issue is that simply copying the .../ses/xxx.emProject file does *not* copy over all the required SDK files, so the solution suggested at

https://devzone.nordicsemi.com/f/nordic-q-a/38085/how-to-create-a-copy-of-examples-project---segger-embedded-studio

...only works when the new project is in the same folder as the example. This won't work for projects that need to be self-contained.

SEGGER's "Archive" doesn't seem to copy all the project dependencies either.

What's the recommended way to do this? I could manually copy, reorganize, and re-link the 50+ file dependencies from the project but there's got to be an easier way.

Parents
  • Hi,

    You can open the project file in a text editor that supports "search and replace" and replace the relative paths with a variable which you can define later in SES.  It should look something like this once you have done this:

    The next step is to set the variable with the path to your SDK copy. To do that, you open Segger embedded studio, select "Tools" from the menubar, then options. Here you can define the variable you used and configure the SDK path.  

Reply
  • Hi,

    You can open the project file in a text editor that supports "search and replace" and replace the relative paths with a variable which you can define later in SES.  It should look something like this once you have done this:

    The next step is to set the variable with the path to your SDK copy. To do that, you open Segger embedded studio, select "Tools" from the menubar, then options. Here you can define the variable you used and configure the SDK path.  

Children
  • This is very helpful, thanks - much easier to manually change paths in the .ses file.

    However, I'm getting an error with the preprocessor's inclusion of header files, specifically that it can't find a file which does in fact exist in the system.

    I've done the above with the SDK_ROOT set to an absolute path just for testing:

    SDK_ROOT=/home/drew/repositories/brittlestar/offboard/brittlestar_central/nrf_sdk

    When going to Build->Build (F7) in SEGGER, I get the following output transcript:

    Building 'brittlestar_central' from solution 'brittlestar_central' in configuration 'Debug'
    1> Compiling 'app_error_weak.c'
    2> Compiling 'app_error_handler_gcc.c'
    3> Compiling 'boards.c'
    3> In file included from /home/drew/repositories/brittlestar/offboard/brittlestar_central/nrf_sdk/modules/nrfx/hal/nrf_gpio.h:44,
    3> from /home/drew/repositories/brittlestar/offboard/brittlestar_central/nrf_sdk/components/boards/boards.h:43,
    3> from /home/drew/repositories/brittlestar/offboard/brittlestar_central/nrf_sdk/components/boards/boards.c:40:
    3> /home/drew/repositories/brittlestar/offboard/brittlestar_central/nrf_sdk/modules/nrfx/nrfx.h:44:10: fatal error: nrfx_config.h: No such file or directory
    3> compilation terminated.
    4> Compiling 'app_fifo.c'
    Build failed

    However, the file does indeed exist on my system, and it has the correct permissions (I'm using Ubuntu):

    drew@drewxps-ubuntu:~/repositories/brittlestar/offboard/brittlestar_central/nrf_sdk/modules/nrfx$ ls -lah
    total 60K
    drwxrwxr-x 9 drew drew 4.0K Oct 18 18:23 .
    drwxrwxr-x 3 drew drew 4.0K Oct 18 17:34 ..
    -rwxrwxr-- 1 drew drew 12K Oct 18 17:34 CHANGELOG.md
    drwxrwxr-x 3 drew drew 4.0K Oct 18 18:23 doc
    drwxrwxr-x 4 drew drew 4.0K Oct 18 17:34 drivers
    drwxrwxr-x 2 drew drew 4.0K Oct 18 17:34 hal
    drwxrwxr-x 3 drew drew 4.0K Oct 18 17:34 helpers
    -rwxrwxr-- 1 drew drew 2.1K Oct 18 22:22 LICENSE
    drwxrwxr-x 2 drew drew 4.0K Oct 18 17:34 mdk
    -rwxrwxr-x 1 drew drew 2.2K Oct 18 22:22 nrfx.h
    -rwxrwxr-- 1 drew drew 1.6K Oct 18 17:34 README.md
    drwxrwxr-x 2 drew drew 4.0K Oct 18 17:34 soc
    drwxrwxr-x 9 drew drew 4.0K Oct 18 17:34 templates

    Here's a screenshot:

    I would guess it's something with the C preprocessor including absolute paths to headers (with " ") versus however < > works, since boards.c has

    #include "boards.h"

    and boards.h has

    #include "nrf_gpio.h"

    but then nrf.gpio.h has

    #include <nrfx.h>

    ...which is where the compile seems to fail. Any thoughts?

  • Nevermind! This was my fault: typo in the .ses file where I didn't have the $(SDK_ROOT)/integration folder listed correctly. Everything compiles now, this is great, thank you Vidar!

Related