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.
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):
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:
and then paste it:
Give it a new name and optionally specify it where it should be stored:
Now I have a second project in the workspace:
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’:
Step 3: 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:
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:
Then go into the project settings (Project > Properties) and de-select the ‘Manage Linker script’ option and press ‘Apply and Close’:
Then open the same settings, and now re-enable that option again and press ‘Apply and Close’:
Now do a build, and the files will use the new project name:
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):
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:
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):
Make the change, press ‘Apply’ and close the dialog.
Now I have a perfectly cloned project which I can start using (or clone again):
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 🙂