I’m using Subversion to keep track of changes in my eclipse MCU10 projects. That allows me to get back in time without the need to make copies of my project. But sometimes I do need to make a copy of my project: because I want to use a project as a base and then do something different with it. To make a copy of a project is simple, but requires some more steps if I’m using Target Tasks. Here is how I do this…
The steps are for CodeWarrior for MCU10.2. First, I use copy-paste to duplicate the project inside the workspace:
- Select the project folder in the CodeWarrior Projects View
- Use CTRL-C (for copy)
- Then paste it with CTRL-V
The paste operation shows me a dialog which gives me the opportunity to specify the new project name:
This will copy all the files of the project into the specified location (see Dissection of MCU10 Projects).
I check the Debug Configurations using the menu Run > Debug Configurations. Here I can see that it has copied my configurations. I see that it uses the same names. If this is a problem for me, I can change the names in the dialog:
Now I’m ready to go!
But wait, there is one more thing….: Target Tasks!
Project Copy with Target Tasks
If my project is not using target tasks: I’m OK. Otherwise I need to make sure the target tasks are copied properly as well. If my project is using Target Tasks, then I need to tweak things a little bit.
Target Tasks are used to perform flash programming for the ColdFire V2-V4, or to do things like Hardware Diagnostics. Target Tasks are managed in the Target Tasks View:
As I can see in the Target Tasks view, the copy operation has created a copy of my target task. Perfect, at least for now ….
I inspect the debugger launch configuration of the copy project. I select the project folder and use the Properties context menu and use the Edit button:
This shows me that the copy project is still using the wrong target task (not the copy of it):
To fix this, I remove the wrong entry (step 1) and add the correct one (step 2):
There is another thing I need to be aware about target tasks: the Target Tasks View shows me the target tasks which are in the ‘framework‘: The framework is kind of cache within the workspace. Whenever I open a project, CodeWarrior checks if there is a target task file with the extension *.ttf and adds it to the framework. And it removes it when I close or delete a project. Now with my copy project I have two target tasks within the Project_Settings\Debugger, both with the same name on my hard-disk. But with different names in the framework:
The target task framework does not allow a name conflict (two target tasks with the same name). So it has automatically renamed it to a CopyOf name. Not good. Different name for something, but again another name in the project structure.This will create a lot of confusion.
At least there is a trick to fix this. Here are the steps:
- Rename the copy of the target task to a new name. Right click on the file and select ‘Rename’. In the dialog choose a new name:
- Open the renamed target task file with the Text Editor:
- In the editor, find the string for the TaskName and TaskProjectName: Note that the task name is not matching the file name and the project it should belong to:
- Change the TaskName to the new name in step 1. Us the copy project name for the TaskProjectName:
- The target task in the framework and shown in the Target Task View is wrong: delete it:
- Select the copy project and close it (menu Project > Close Project)
- Open the copy project again (menu Project > Open Project)
Now the target task in the framework and the one in the project structure are in sync.
Note: The handling of Target Tasks with the copy operations is less than ideal. Once things get easier in eclipse based CodeWarrior with copy and target tasks, I’ll post an update here. Until then: at least I have a workaround.
Happy Copy Tasking 🙂