Copy my Project

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:

  1. Select the project folder in the CodeWarrior Projects View
  2. Use CTRL-C (for copy)
  3. Then paste it with CTRL-V

The paste operation shows me a dialog which gives me the opportunity to specify the new project name:

Copy Project Dialog

Copy Project Dialog

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:

Copy of Debug Configurations

Copy of Debug Configurations

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:

Inspecting the Run/Debug Settings

Inspecting the Run/Debug Settings

This shows me that the copy project is still using the wrong target task (not the copy of it):

Launch Configuration using original Target Task

Launch Configuration using original Target Task

To fix this, I remove the wrong entry (step 1) and add the correct one (step 2):

Assigned copy of Target Task

Assigned copy of Target Task

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:

Target Task Copies

Target Task Copies

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:

  1. 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:

    Renaming the copy of the target task

    Renaming the copy of the target task

  2. Open the renamed target task file with the Text Editor:

    Open Target Task File with Text Editor

    Open Target Task File with Text Editor

  3. 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:

    TaskName and TaskProjectName Strings

    TaskName and TaskProjectName Strings

  4. Change the TaskName to the new name in step 1. Us the copy project name for the TaskProjectName:

    Changed strings for TaskName and TaskProjectName

    Changed strings for TaskName and TaskProjectName

  5. The target task in the framework and shown in the Target Task View is wrong: delete it:

    Deleting wrong target task from framework

    Deleting wrong target task from framework

  6. Select the copy project and close it (menu Project > Close Project)
  7. 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 🙂

3 thoughts on “Copy my Project

  1. Pingback: Page not found | MCU on Eclipse

  2. Pingback: Copy my CodeWarrior Project | MCU on Eclipse

  3. Hi,
    Here is how I do it:
    I export the file structure to a fresh directory (making sure that file structure is preserved via the check box)
    I import the project and rename it, to a fresh work area.

    I destroy work-areas at the first opportunity.

    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.