CW 10.6 Import/Copy to workspace Example Project(s) Issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW 10.6 Import/Copy to workspace Example Project(s) Issue

1,876 Views
gregs5451
Contributor III

Starting development with a FRDM-KE02Z40M brd.  I have installed CW 10.6 and am attempting to learn it.  I simply want to be able to Import and Copy some of the example projects to my designated workspace.  When I do this, ALL of the project source(src) files become warnings and essentially are not found.  However, if I just Import (without copy), then the source files are OK.  I am importing examples from the Freescale/CW installed directories.  When I look into the Project Settings Linked Resources, the ones that are marked as Invalid Location(src files), the "Resolved Location" is a non-existent src folder that is located 3 folders above my designated project workspace folder.  Why is it doing this and how do I fix it?

Labels (1)
Tags (1)
7 Replies

901 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello greg:

That behavior is expected. Those source files are linked to the project. The linked files can be identified by the little arrow in the icon and also the linked folders have a small white square.

Linked_files.png

This means that those files and folders are somewhere else instead of the project's folder, but their location is known by the project.

When you only import the example project to your workspace, then you are leaving the project in its original location in the file system and the links are still valid.

However when you "copy" the project to the workspace, only the project folder is copied and not the linked files/folders. This effectively breaks the links.

If you want to "copy" the projects, then to fix the links you have some options:

1) Create your own folders structure and copy the missing files from the example's folder. Then in CodeWarrior remove the problematic files and drag-drop your own copied files. I think this is the best option, as you now have full control of the project and can easily export it to a different computer.

2) Edit the "Linked Resources" locations. They need to point to the folders in CW installation (...\CW MCU v10.6\MCU\CodeWarrior_Examples\Kinetis_Examples\KE\src).

3) Recreate the same folder structure copying the files of the examples, so that your copied project can "see" them at the same levels than the original project.

I hope this helps.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

901 Views
gregs5451
Contributor III

Thanks Jorge.  I earlier contemplated doing a copy/hack solution, but I didn't want to do this every time.  I can't believe this is the way one is supposed to manage these simple types of things with this tool.

You mentioned Exporting.  Will this essentially do what I want?  I looked at it earlier but was overwhelmed with the "export destination" options.

Gregg

0 Kudos

901 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hi greg:

Hacking is not the common way. You asked about the CW example projects that come with the installation and since those projects have linked files then you have to do those tricks I mentioned above. The developers arranged those folders and linked the projects that way to have a defined order.

The next tutorials by our colleague Erich Styger will bring you some light about project management and files in CodeWarrior/Eclipse:

Link to Files and Folders in Eclipse | MCU on Eclipse

How to Add Existing Files to Eclipse Projects | MCU on Eclipse

Exporting and Importing Projects in Eclipse | MCU on Eclipse

Copy my CodeWarrior Project | MCU on Eclipse


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

901 Views
gregs5451
Contributor III

I tried your #1 suggestion.  I copied the entire src folder from the examples directory.  I then went into CW with the copied Project open, deleted its src folder, and tried to drag and drop the copied folder into it.  It does not drop into it.  I also tried Erich Stygers Copy/Clone method.  I get the same result as before. No source files get copied over into the new directory and all the src links are broken.

0 Kudos

901 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Sorry Gregg, my first suggestion was not accurate, the procedure is more complex. I will summarize the steps here (you did the first 2 steps correctly):

:smileyinfo: Again all this complexity is to copy one of the installed example projects with linked files. You would not have to struggle with other projects.

1) In CW delete the src folder with the broken links.

2) Copy the entire src folder from the examples directory to the copied "project folder". The project folder is the one that has the .project and .cproject files inside.

3) The src folder has source files for ALL the example projects, so many of the files are not relevant for the specific project you imported. This will cause build errors, so you have to delete such files from the src folder. Easiest way to do this is to import the original example project in a different workspace and check which files are used by the project (you can open a second instance of CW IDE).

4) Once you deleted unnecessary files, right click on the copied project in CW and select "Refresh". The src folder should now appear, as in the next image:

Refresh_CW.png


5) Go to [Project -> Properties -> C/C++ Build -> Settings ARM Ltd Windows GCC C Compiler -> Directories] and fix all the paths related to the src folder (e.g. instead of "${ProjDirPath}/../../../../src/common" you should have "${ProjDirPath}/src/common").

Search_paths.png

Then the project should build with no errors.

As demonstration I copied the GPIO_demo project following this procedure and then zipped it. You can find it attached.

Regarding Erich's "copy" method, I guess that tutorial does not consider projects with linked files.

I hope this helps.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

901 Views
gregs5451
Contributor III

Jorge, I found a simple satisfactory way to copy the projects and build without error.  Similar to what you suggested, instead of copying the src folder from the example projects into my unique project copy, I placed it where by default (according to the pre-defined linkages) it was expecting to see it.  It's "resolved" location.  As long as I Import/Copy to the same common workspace, the projects can now find all the copied sources.

0 Kudos

901 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Good to know Gregg :smileyhappy:.

Actually that is my third suggestion above. Just notice that if you want to export those "new" projects, you will face the same obstacle again. In case you want the projects to be independent, you have to follow the procedure I mentioned.

Regards!

Jorge Gonzalez

0 Kudos