Portable Projects
From DSignT Support Database
Jump to navigationJump to search
Problem
CCS4 projects store absolute paths. Moving a project to a different directory or another computer is not possible.
Solution
This example assumes the following directory structure:
CCS_projects
|
+--- dmodule (D.Module specific headers and linker command files)
|
+--- common (libs, headers, etc)
|
+--- utils
|
+--- myprojects
| |
| +--- current_project (source files)
- create a file macros.ini in the project directory (current_project in the above example). This file must contain an entry SWROOT = ../../
SWROOT now points to the project base directory (CCS_projects in the above example). You can of course select a different name.
- make sure all source files include header files with a relative path, or add the include path in the project settings:
#include "../../dmodule/dm2c6747.h"
or, if the base directory CCS_projects is added to the project include options:
#include <dmodule/dm2c6747.h>
- edit the .project file in the project directory (current_project in the above example) and replace the absolute paths with the SWROOT macro. Replace the <location> tag
<linkedResources>
<link>
<name>dm2c6747.cmd</name>
<type>1</type>
<location>d:/work/ccs_projects/dmodule/dm2c6747.cmd</location>
</link>
</linkedResources>
with
<location>SWROOT/dmodule/dm2c6747.cmd</location>
- Use ${SWROOT} in the Build Properties to add include paths and/or call programs for post-build steps:
Build Properties - Tool Settings - C6000 Compiler - Include Options = ${SWROOT}
${SWROOT}/utils/makehex ${BuildArtifactFileBaseName}