Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

MCUXpresso: Importing Kinetis Design Studio Projects

DZone's Guide to

MCUXpresso: Importing Kinetis Design Studio Projects

The MCUXpresso IDE makes it easy to improt Kinetis Design Studio projects. Even better, you get updated features and toolchains to use on your work.

· IoT Zone
Free Resource

Download Red Hat’s blueprint for building an open IoT platform—open source from cloud to gateways to devices.

Many of my currently active projects are using Kinetis Design Studio (KDS) V3.2.0 from NXP (I have published many of my projects on GitHub). Now with the advent of the MCUXpresso IDE (see MCUXpresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers), I have migrated several projects from KDS to MCUXpresso. This post is about how to easily get KDS projects ported and running in MCUXpresso IDE.

Debugging KDS Project in MCUXpresso IDE

Debugging a KDS Project in MCUXpresso

This article is part of a series to get up to speed using the new NXP MCUXpresso IDE. Published so far are:

Outline

MCUXpresso uses the newer (Neon) Eclipse IDE than KDS (Luna) with a different build system: MCUXpresso IDE is using the same build system and integration as LPCXpresso, while KDS is using the GNU ARM Eclipse plugins. Both approaches have their pros and cons (as always). Plus, MCUXpresso does not include Processor Expert, but KDS does. To migrate and use KDS projects with the MCUXpresso IDE, there are the following basic approaches:

  1. Importing KDS (non-Processor Expert) projects: For this, the GNU ARM Eclipse plugins need to be installed, along with the GNU ARM Eclipse build tools. This allows us to use KDS projects as in KDS, but with the extra functionalities of MCUXpresso.
  2. Importing Processor Expert projects: Same as above, but this needs the installation of Processor Expert plugins, too. That way, I can continue to use Processor Expert projects as in KDS, but keep in mind that NXP does not offer newer device support for Processor Expert.
  3. Porting KDS projects to MCUXpresso IDE: This means migrating a KDS project to the MCUXpresso build system. This is a fairly simple approach, basically creating a new project in MCUXpresso and moving the files over.

In general I follow the approach not to switch IDEs or toolchains for projects. Migrating or porting a project only makes sense when it is really necessary. I do have many projects I keep maintained in older toolchains like CodeWarrior, and I only migrate projects that I continue to develop and evolve.

Because it is too much to describe everything in one post, I focus on approach 1 in this article.

At the time of this article, I’m using the following software:

I’m using Windows as my host, but similar steps apply to Mac and Linux hosts. I’m assuming you already have Kinetis Design Studio V3.2.0 installed. If not, the steps below install everything you need to use Kinetis Design Studio projects in MCUXpresso, and you don’t need KDS V3.2.0 installed (e.g. if you downloaded a project from somewhere).

Note that tutorial does not include the installation of Processor Expert into MCUXpresso IDE: This is the subject of a future article.

GNU ARM Embedded Toolchain

KDS has pre-installed the GNU ARM Embedded Toolchain. While it would be possible to use that same version, I’m using the latest version from https://launchpad.net/gcc-arm-embedded, which is the 6-2017-q1-update I can get from https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads:

GNU ARM Embedded Toolchain 6-2017-q1-update

GNU ARM Embedded Toolchain 6-2017-q1-update

I recommend downloading the installer and running the setup with the default settings:

Installing GNU ARM Embedded Toolchain

Installing GNU ARM Embedded Toolchain

On Windows, I need to install other build tools that are already part of Kinetis Design Studio (inside the <kds>\bin folder).

Follow the instructions at http://gnuarmeclipse.github.io/windows-build-tools/install/ and download the latest setup from https://github.com/gnuarmeclipse/windows-build-tools/releases, then run the setup with the default settings:

GNU ARM Eclipse Build Tools Setup

GNU ARM Eclipse Build Tools Setup

GNU ARM Eclipse Plugins

To have the build tools working in Eclipse, I need to install the GNU ARM Eclipse plugins. Otherwise, KDS projects in MCUXpresso IDE will show an error message similar to the one below:

Orphaned configuration. No base extension cfg exists for ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1376620489


Orphaned Configuration

Orphaned Configuration

Basically, it means that the project (.cproject file) needs the ilg.gnuarmeclipse.managedbuild.cross.config.elf build plugin/integration, which is not installed by default in MCUXpresso. The general process is described in http://gnuarmeclipse.github.io/install/.

To install the plugins, I have two ways:

  1. Eclipse Marketplace (preferred)
  2. Install new software

With the Eclipse Marketplace, you need that plugin installed (see MCUXpresso IDE: Adding the Eclipse Marketplace Client), then use the menu: Help > Eclipse Marketplace:

Eclipse Marketplace Menu

Eclipse Marketplace Menu

Search for the plugin and install it:

GNU ARM Eclipse in Eclipse Marketplace

GNU ARM Eclipse in Eclipse Marketplace

I recommend you install all plugins. That way, it is possible to create and debug any ARM Cortex-M projects (beyond NXP):

Installing from Marketplace

Installing from Marketplace

If you are running into a ‘handshake’ problem, then there is a problem with the security settings to get access to SourceForge (see this link).

Handshake problem

Handshake problem

In that case, I recommend downloading a ZIP file as described in the next step.

I can use the menu Help > Install New Software and point to the following update site:

http://gnuarmeclipse.sourceforge.net/updates


But beware that this might not work because SourceForge has recently changed the security settings (see this link). Instead, I recommend downloading the ZIP file from here. Use that ZIP file in the dialog accessible by Help > Install New Software:

 I can drag and drop the ZIP file into the dialog.

Installing GNU ARM Eclipse plugins from zip file

Installing GNU ARM Eclipse plugins from zip file

Importing Projects

NOTE: Be warned! I recommend to *copy* the projects, and *not* to try to use with MCUXpresso and KDS in parallel. MCUXpresso is using a newer Eclipse, but while it *might* work to open that project afterwards in KDS again, it is certainly not something I would like to do. So make a copy/backups of the project before importing (and changing) it in MCUXpresso! Likewise, you should NEVER share a workspace folder with different Eclipse versions.

With this, I have everything I need to import, build, and debug Kinetis Design Studio V3.2.0 projects! There are multiple ways to import projects. The easiest one is to use the Quickstart panel and use ‘Import project(s) from file system…’:

Import Projects from file system

Import Projects from file system

 Alternatively use the normal Eclipse way using the menu File > Import > General > Existing Projects into Workspace

Then browse to the folder or use the ZIP archive:

Importing Project Directory

Importing Project Directory

Then go through the dialog to import the project(s).

With the installed plugins and software in the previous steps, everything should be in place to build and debug the imported projects. Here are a few things to verify and check if everything is configured correctly.

Use the ‘edit project settings’ menu in the Quickstart panel (or use the menu Project > Settings):

Quickstart Panel Project Settings

Quickstart Panel Project Settings

Opening the project properties, the settings should show up as in KDS:

KDS Project in MCUXpresso

KDS Project in MCUXpresso

There is a small glitch in the Quickstart menu action where it might show only the ‘Error Parsers’. In that case, use the ‘left’ icon to get to the left side of the panels:

Only shows Error Parser

Only shows Error Parser

The toolchain shall show up as ‘GNU Tools for ARM Embedded Processors‘ in the project settings:

Tools Path in Project Settings

Tools Path in Project Settings

The GNU ARM Eclipse plugins allow a very flexible and powerful toolchain configuration (up to separate toolchains for each project). Below are the workspace settings (menu Window > Preferences). It specifies which toolchain and build tools are used, and it shows where I have installed them in the previous steps:

Global Tools Paths

Global Tools Paths

 I’m using here *different* (newer) build tools and tool chain than what is installed in KDS v3.2.0! If you have KDS installed, and if you want to use the same toolchain, then you can configure that in that dialog.

MCU Settings

MCUXpresso has an extra setting in the project to specify the microcontroller used. Because that project has been created outside the MCUXpresso IDE, the MCU is not correctly assigned. This setting is not important for building it with the GNU ARM tools, but it is needed if I want to use other advanced MCUXpresso IDE settings like automatic probe discovery (more about this later).

I recommend going to the C/C++ Build > MCU settings and assigning the correct MCU used in that project:

MCU Settings

MCU Settings

However, I need the MCUXpresso SDK (see MCUXpresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers) installed for that MCU!

 I recommend having the SDK installed. Otherwise (and if there is no SDK for the MCU used in the project), I recommend you set a matching ‘generic’ MCU from the preinstalled MCUs

Generic MCU

Generic MCU

With this, everything is set up to build and debug!

An important step after importing projects is to get rid of any old files with a ‘clean’. The easiest way is to use the ‘clean’ in the Quickstart panel (or use the menu Project > Clean):

Clean project after importing

Clean project after importing

Build

Yet again, use the Quickstart panel to build the project (or use the menu Project > Build):

Build Project

Build Project

This should build the project without errors (as in KDS).

KDS projects use normal Eclipse launch configuration files and settings. The launch files are usually stored in a ‘settings’ folder inside the project:

KDS project debug launch configurations

KDS project debug launch configurations

MCUXpresso, on the other hand, is able to detect debug probes automatically and create and manage the launch configurations (see MCUXpresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers).

I can continue to use the launch configurations in the project, the same way as in KDS. I can check them using the Debug Configurations menu:

Debug Configurations Menu

Debug Configurations Menu

The screenshot below shows some debug configurations in my workspace:

Debug Configurations

Debug Configurations

Compared to KDS, there is a group on the top for launch configurations for the LPC-Link/LPC-Link2 debug connection.

Because the debug plugin for P&E is the same (provided by P&E), the group combines both imported KDS and MCUXpresso configurations.

Notice that there are two groups for the Segger debug plugin: One for MCUXpresso and one for the GNU ARM Eclipse Segger plugin we installed in one of the previous steps. The one on the bottom is exactly the one you know from KDS.

 If you compare the features and responsiveness of the GNU ARM Eclipse SEGGER plugin and the one installed with the GNU ARM Eclipse plugins, then you might like the one from GNU ARM Eclipse more, especially as it provides more detailed settings. The good thing is that by installing the GNU ARM Eclipse plugins, you can use them for any project. However, it won’t work with the MCUXpresso automatic probe detection.

You can determine which Segger J-Link binaries are used by the GNU ARM Eclipse debugger plugin in a setting behind the menu Window > Preferences > Run/Debug > SEGGER J-Link:

GNU ARM Eclipse Path to SEGGER

GNU ARM Eclipse Path to SEGGER

Verify the folder settings or use the ‘Restore Defaults’ folder if you have updated the SEGGER files.

With this, I can debug my KDS project in MCUXpresso IDE:

Debugging KDS Project in MCUXpresso IDE

Debugging KDS Project in MCUXpresso IDE

Using MCUXpresso Probe Detection

One benefit of the ‘combined’ IDE and plugins is that now I can use the extra features of MCUXpresso for my imported project. And one of it is the automatic probe detection (see MCUXpresso IDE: Unified Eclipse IDE for NXPs ARM Cortex-M Microcontrollers). For this, I launch the debugger with the blue debug icon (instead of the normal green one):

Debug (blue) button

Debug (blue) button

If you get a dialog about “No MCU associated with this project. Please select an MCU before continuing,” then check the section “MCU Settings” from above: It means that the project settings have no MCU assigned.

No MCU associated with this project

No MCU associated with this project

Otherwise, I get the automatic probe discovery dialog:

Probes automatically discovered

Probes automatically discovered

And then it will create the selected debug connection/configuration, and I can debug with it.

To re-trigger the automatic probe discovery, a simple method is to remove the created launch configurations (but then I will lose any custom settings I have made):

Automatic Probe Launch Configurations

Automatic Probe Launch Configurations

The presented approach even works with Processor Expert projects, only that you won’t be able to generate Processor Expert code with it. So as long you have generated code in the KDS project, you can import it as any normal project using the above approach.

As for how you could continue to use Processor Expert projects in MCUXpresso and fully use Processor Expert as in KDS, that's the subject of a future article.

Summary

I can easily import existing Kinetis Design Studio (KDS) projects. By installing the toolchain (if not already installed) plus the GNU ARM Eclipse plugins in the MCUXpresso IDE, I can build and debug existing KDS projects without any porting effort or any project conversion: They simply work. Compared with the original KDS, I have a newer Eclipse, the latest toolchain, and can use the extra features offered in MCUXpresso. I have this working with several existing KDS projects, and it works very well — to the point that I might leave KDS behind and continue to use all KDS projects with the MCUXpresso IDE.

What I have not covered in this article is how to get Processor Expert running in MCUXpresso IDE, or how to switch the toolchain/project from KDS to the native MCUXpresso one. So this next on my list of things. I hope that what I was able to write up is already useful for you.

Happy Importing!

Build an open IoT platform with Red Hat—keep it flexible with open source software.

Topics:
microcontrollers ,kinetis ,mcuxpresso ,iot ,tutorial

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}