Importing Keil projects

If you are using a version of the SDK that supports SEGGER Embedded Studio (SES), thus nRF5 SDK v14.1.0 or later, you should open one of the supplied SES projects and skip this step. If you are using an older version of the SDK, for example, nRF5 SDK v12.3.0 for nRF51 Series devices, you must create your own SES projects based on the supplied Keil projects.

Before you begin, install the CMSIS-CORE Support Package. To do so, open SES, go to Tools > Package Manager, and select and install CMSIS-CORE Support Package.
Figure 1. SES Package Manager
SES Package Manager

Complete the following steps to import a Keil project into SES:

  1. Select File > Import Project > Import Keil MDK Project.
    In SES versions before 3.40, this option was located under File > Import IAR EWARM / Keil MDK Project.
  2. Navigate to the folder that contains the nRF5 SDK and select the example that you want to import.
    Use the *.uvprojx file that is located in the arm5_no_packs folder.
  3. In the Import Build Configuration window that appears, select Internal Toolchain.
    Import build configuration
  4. If the project that you imported contains a Target for flashing the SoftDevice, delete this Target in SES:
    1. Select Project > Build Configurations.
    2. Under Public Configurations, select the Target (for example, flash_s130_nrf51_2.0.1_softdevice).
    3. Click the - symbol to remove the Target.
    The build configuration should now look similar to this:
    Build configuration
  5. Add the nRF5 MDK files that are required for startup and system setup.
    In Keil µVision, these files are provided by the nRF_DeviceFamilyPack. Since this pack is not available for SES, you must add them manually to the SES project.
    1. Download ses_nrf51_startup.s and ses_nrf52_startup.s and save them in a new folder SDK_dir/components/toolchain/embedded_studio.
    2. In the Project Explorer, navigate to Internal Files and remove the Cortex_M_Startup.s file.
    3. Right-click Internal Files and select Add Existing File.
    4. Browse to the SDK_dir/components/toolchain/ folder and select the .c file that corresponds to your device (for example, system_nrf52.c).
    5. Right-click Internal Files and select Add Existing File again. This time, select the startup file that you downloaded, for example, SDK_dir/components/toolchain/embedded_studio/ses_nrf51_startup.s.
    The Project Explorer should now look similar to this:
    Project Explorer
  6. Include the device header files in the project:
    1. Right-click your project and select Edit Options.
    2. Select Preprocessor.
    3. Add the following path to the User Include Directories field: ../../../../../../components/device
    The user include directories should now look similar to this:
    SES user include directories
  7. If your project uses modules that require section variables (for example, the Peer Manager, Flash Data Storage, or Flash Storage), define where in the flash information from these modules should be stored.
    1. Download the flash_placement.xml and place it in your project directory.
      Files are provided for the following versions of the nRF5 SDK:
    2. If you are using SES v3.50 or later, right-click your project, select Edit Options, select Linker, and change the Linker option to GNU.
      SES linker option
      Note: This option does not exist in SES versions before 3.50.
    3. Right-click on your project in the Project Explorer and select Import Section Placement.
      Import Section Placement
    4. Confirm that you want to use the section placement for the current build configuration.