Tutorial: Rename, Copy or Clone Eclipse Projects with MCUXpresso

Especially in a lab or classroom environment it is convenient to start with a template project, and then explore different ways to shape the project for different needs. As for any IDE of this world, this requires an understanding of the inner workings to get it right. So in this article I show how to copy, clone or rename properly an Eclipse ‘template’ project in the MCUXpresso IDE.

Template Project

Template Project

In this article I’m using the NXP MCUXpresso version 11.11.1, but applies to earlier (and most likely later) versions too.

The template project has the usual things in it: folders, SDK source files, project settings, a .mex Configuration Tool file plus as an extra three different debug (.launch) configs for three different probe vendors (NXP LinkServer, P&E Multilink and Segger J-Link):

Template Project

Template Project in MCUXpresso IDE

Basically the process is to copy-paste the template project. But to make everything really good looking and for the perfectionists among us, I have added some optional extra steps.

Step 1: Copy the project

The first and easy step is to copy the project:

Copy project

Copy project

and then paste it:

Paste Project

Paste Project

Give it a new name and optionally specify it where it should be stored:

Name for copy

Name for copy

Now I have a second project in the workspace:

New copied project (Blinky)

New copied project (Blinky)

Step 2: Clean-Clean

Now we need to get rid of all the intermediate, build and object files of the previous project. The usual Project > Clean is not enough, as it still might leave things behind from the template project. To make sure that we have a clean-clean state, simply delete the output folder, typically named ‘Debug’:

Deleting Debug Folder

Deleting Debug Folder

Step 3: Build the Project

Build the project:

Build the project

Build the project

Step 4: Rename the Linker Files (optional)

This is more of a cosmetic thing: looking at the files in the output folder, there are the linker files with using the ‘old’ project name:

Selected again

Selected again

It works because the name does not matter: for the perfectionists (I’m one of it) to have them matching the new project name, I have to use a trick:

First: delete the files:

Deleting Linker Files

Deleting Linker Files

Then go into the project settings (Project > Properties) and de-select the ‘Manage Linker script’ option and press ‘Apply and Close’:

Deselect Managed Linker Script

Deselect Managed Linker Script

Then open the same settings, and now re-enable that option again and press ‘Apply and Close’:

Selected again

Selected again

Now do a build, and the files will use the new project name:

Linker Files with new names

Linker Files with new names

Step 5: Rename the Config Tools .mex Files (optional)

As we can see: Eclipse copied the project files and settings and created a new folder for the project. But it did not change the file names for the .mex or .launch files. The files work with whatever name they have, but I prefer to have them named matching the project name. So I rename the .mex file (if it exists):

Rename .mex File

Rename .mex File

Step 6: Rename .launch files (optional)

Because the NXP MCUXpresso IDE is re-creating the .launch files with a probe discovery, I simply could delete the .launch files and they would be re-recreated from the defaults. But if I have carefully crafted the settings in it, then it is easier to have them renamed too:

Renamed Launch Files

Renamed Launch Files

With the .launch files renamed, they still point to the previous project and binaries. For each of the .launch files, open it (double-click on it):

Changed Debugger Main Configuration

Changed Debugger Main Configuration

Make the change, press ‘Apply’ and close the dialog.

Result

Now I have a perfectly cloned project which I can start using (or clone again):

Cloned Project

Cloned Project

Summary

Making a copy of an Eclipse project in MCUXpresso is basically a copy-paste operation. But to make it perfect and to match the file names the new project names, I can rename and update the settings (or simply delete the debugger .launch files and have them re-created by the debug probe auto-discovery).

Happy cloning 🙂

13 thoughts on “Tutorial: Rename, Copy or Clone Eclipse Projects with MCUXpresso

  1. A good list that shows all the annoyances of doing what should be an easy copy/paste; that wrong linker filenames issue has bothered me since day 2 with the Kinetis tools – first time I’ve seen a way to resolve it (even if a bit of excessive trouble!)
    Thanks!

    Like

    • I have found that way to deal with the linker script files only by experimenting with the options. The good thing is that the linker script file name is annoying, but not really changing functionality.

      Like

  2. Thanx Erich,

    I could have used that about five months ago. ;^)

    I basically follow what you are doing but I don’t see the Preferences being copied through (MCU Settings, Build Includes and Build Preprocessor options specifically). Is there a way to copy them directly?

    Like

  3. Sometime ago, debugging a project together with its copy using two JLink at the same time on the same pc, weird things happened and I had to change the value of all occurrences of id=”com.crt.advproject.config.exe.debug.1234567890″ in the .cproject file of the cloned project…
    Is there some easier way to do it?
    Thanks Erich!

    Like

    • Hi Michael,
      I have not obeserved any problems with such a parallel debugging, as long I took care to connect to the correct USB (ID). That com.crt.advproject.config.exe is imho the container for the build configuration and its settings, and they are local to the project, I don’t see how this would affect debug operation? From where did you had the information to change that ID?
      Thanks!

      Like

      • Hi Erich, I searched every where by myself and found only that… It seems to me that McuXpresso controls that id when debugging in the same time two identical projects (only the project name was different in my case).

        Like

  4. For my LPCXpresso55S16 I’m trying to rename the couple of connected sample projects: lpcxpresso55s16_hello_world_ns and lpcxpresso55s16_hello_world_s (SDK Import Wizard). I followed this article and succesfully changed name and built lpcxpresso55s16_hello_world_ns. Then, leaving lpcxpresso55s16_hello_world_s unchanged and debugging it, the debug gave error. Each project referes to the other (Project->Properties->Project Referencies).

    Like

    • Not sure how you managed to get the project reference? But you can easily uncheck that reference (you don’t need the reference, right?).
      What kind of debug error have you received?

      Like

      • The crossed referencies from notSecure to Secure and back are
        provided by the base samples. If I take away one or both the result is the same: I can compile the renamed notSecure, but when I debug the Secure one, which will call also notSecure, I get the same error. If I could paste an image it would be better. The error is: Error in final launch sequence:

        Error executing step execute method: stepProgramNS
        Error executing step execute method: stepProgramNS
        java.lang.reflect.InvocationTargetException

        Like

        • I’m away from my board and desk, so cannot try. But I believe this is linked because the final application consists both of a secure and non-secure part?

          Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.