So say you have two different projects in Segger Embedded Studio that works on your nRF chip.

Here I assume only one of your projects use Bluetooth. For example ble_blinky and peripheral SPI.


Always copy from the project without Bluetooth to the one with.

Start by copying code from one main.c file to the other.

Make sure you do not have multiple includes. Make sure you do not repeat the same initialization, for example of the log.

Then go to the sdk_config.h and make sure all things in the side file is enabled. If for example SPI, SPI_ENABLED 1.

To find these more easily, use ctrl-F. Here you can enable the ".*". This is so you can use .* to substitute anything(See RegEx).

For example, you can search for .*ENABLED 1 to find all places where something is enabled in the config file.

You could probably use the "diff" command to see differences between the  two config files as well.

Next, go to the main.c and in the menu at top, go to Project→Options and Preprocessor→User Include Directories.

Here you need to include the paths of the header files used for the code. The paths need to be specified from the main.c file.

You can see paths of previously included files when you have selected preprocessor in the options window.

A path can for example be"../../../../../../components/boards". Do include the path to the folder of the header file, not the file itself.

Separate paths with semicolon ( ; ). 

To find the paths from the file name only, I recommend to search from the nRF5 bottom folder.

In Linux you can search for this using " find | grep filename.h".  for example "find | grep nrf_soc.h".

Then you need to add the .c files to you project. Right-click the (Bluetooth)project in Segger or one of the folders under it, preferably with the same name as where it is located in the non-bluetooth folder. Then click "Add existing file..." and navigate to the non-Bluetooth folder and the .c file, and select it.


Now try to build your project, and find it has a lot of errors. Repeat the previous steps with the errors in mind until it works.


Nordic Semiconductor also have a blog post on this, and there is a good explanation on this forum post as well.

  • No labels