Upgrading to a new MDK release in Keil uVision 5

Introduction

The Microcontroller Development Kit (MDK) provides basic device support such as register header files, startup files and errata workarounds. Every release of the nRF5 SDK contains the latest version of the MDK at the time of release, but what happens if a new errata is discovered or if you need support for a new SoC revision? You should then upgrade your projects to use a newer MDK release. This guide explains how to do so for Keil µVision 5.

Getting the new MDK

For Keil µVision 5 you find the MDK in the Pack Installer, under the name nRF_DeviceFamilyPack.

Alternatively you can download MDK releases from the nRF MDK download page, as for other toolchains supported by the nRF5 SDK. First select the wanted toolchain/license combination from the dropdown. For Keil uVision 5 use "Pack". By default you are offered the latest MDK release (which is recommended,) but if for some reason you need a specific version you can select it from the radio buttons further down on the page.

Installing the MDK

  1. Install the pack,
    1. Either directly through the Pack Installer

    2. Or by running the .pack file downloaded from the nRF MDK download page.

Upgrading a project

  1. From the Build Toolbar, open the "Select Software Packs..." window.

    Select the new version of the nRF_DeviceFamilyPack component.
    Window: "Select Software Packs for Target"
    Click "OK" to confirm and close the window.

  2. From the Project pane, right click the "Device" component and open the "Options for Component Class 'Device'" window.

    Select the new version of the component from the "Version" drop down list. (If it is already selected, do nothing.)

    Click "OK" to confirm and close the window.

  3. From the Project pane, right click the target folder (e.g. nrf52840_xxaa) and open the "Options for Target 'target name'..." window.

    Go to the "C/C++" pane, and open the Include Paths" dialog box (the "..." button to the right of the entry.)

    1. For nRF5 SDK 14.2.0 and older, remove the path ending in \components\toolchain
    2. For nRF5 SDK 15.0.0 to 17.0.2, remove the path ending in \modules\nrfx\mdk

    Click "OK" in both windows, to save the changes and close the windows.

  4. On the Project pane, if Device and some or all of the files under Device has a red circle with a white x in the icon, those files of the pack must be updated.

    Right click on the files in need of an update, and select the "Update Config File" option in the pop-up menu.
  5. Recompile the project

Please note: You may experience that the startup c file in the Device component is from the newest (highest numbered) version of the nRF_DeviceFamilyPack on the system, while the header files are from the selected version. This is a known issue. The workaround is to make sure the pack selected in the project is the same as the highest numbered pack version installed on the system.