EmbeddedRelated.com
Forums

Templates in IAR

Started by p_murayama May 8, 2012
Hello!

I would like to know if there is a way of making my own templates
in IAR. I have quite a tree of code accumulated in my version tool
for many years. When starting a project, it always takes time
to configure all the paths. And in the case of (for instance) a data
logger, it's always the same set of paths, all similar.
Therefore I would be happy if I could create for a logger template
that already include all the paths and to which all the files have
already been included.
An alternative would be to generate the project files myself.
It looks like xml and should be manageable but I don't want to
reinvent the wheel.
So to come back to my question: is there a simple way to create my
own templates in IAR?
By the way, the same question about CCS could also help me.

Thanks!

Pascal

Beginning Microcontrollers with the MSP430

It's quite easy. For a C template named 'ps' you need to create in \430\config\template\project\c\

- a folder 'ps' with your project files. Just rename the project file to 'templproj.ewp'
- a file 'ps.projtempl' containing :

<?xml version="1.0" encoding="iso-8859-1"?>


some text
ps


Hello!

Thanks a lot! I'm going to try that right now.

Pascal

--- In m..., "distantship101" wrote:
> It's quite easy. For a C template named 'ps' you need to create in \430\config\template\project\c\
>
> - a folder 'ps' with your project files. Just rename the project file to 'templproj.ewp'
> - a file 'ps.projtempl' containing :
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> some text
> ps
>

Hello!

I've tried and basically it works. Thanks a lot.
There are still 2 issues:
1. In my template file, I have set FET debugger instead of simulator. When I
move the project file to the templproj.ewp in the template folder, destroy
everything in the original directory and try to recreate a project from the template,
then it is set back to "simulator". So this setting is held in the project file, I suppose,
but apparently it is reset when creating a new project. By the way, any other method
that defaults to FET debugger would be fine.
Any idea?

2. As the position of my project in my version control tree is not necessarily
at a constant depth, I cannot set project paths like this:
$PROJ_DIR$\..\..\Common
$PROJ_DIR$\..\..\USB etc...
because the number of \.. segments varies.
So I would like to define a $VC_ROOT$ (for version control root) variable.
Where can it be defined to be known by the project (like $PROJ_DIR$?
I have tried a few locations, I have also tried with system variables, but I had
no luck...

Thanks,

Pascal

--- In m..., "distantship101" wrote:
> It's quite easy. For a C template named 'ps' you need to create in \430\config\template\project\c\
>
> - a folder 'ps' with your project files. Just rename the project file to 'templproj.ewp'
> - a file 'ps.projtempl' containing :
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> some text
> ps
>

> 1. In my template file, I have set FET debugger instead of simulator. When I
> move the project file to the templproj.ewp in the template folder, destroy
> everything in the original directory and try to recreate a project from the template,
> then it is set back to "simulator". So this setting is held in the project file, I suppose,
> but apparently it is reset when creating a new project. By the way, any other method
> that defaults to FET debugger would be fine.
> Any idea?

The debugger config is in the .ewd file with the same name as the .ewp file, so you need to rename it to 'tmplproj.ewd' in your template in order for it to have the correct name in the end.