3

Is there any possibility in IAR to add additional project variable like $PROJ_DIR$ to specify my project environment?

I like to keep my project portable and adaptable.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
rideyourstyle
  • 39
  • 1
  • 1
  • 8

4 Answers4

7

Of course there are, according to the manuals:

Variable / Description

  • $CONFIG_NAME$ The name of the current build configuration, for example Debug or Release.
  • $CUR_DIR$ Current directory
  • $CUR_LINE$ Current line
  • $DATE$ Today’s date
  • $EW_DIR$ Top directory of IAR Embedded Workbench, for example c:\program files\iar systems\embedded workbench 6.n
  • $EXE_DIR$ Directory for executable output
  • $FILE_BNAME$ Filename without extension
  • $FILE_BPATH$ Full path without extension
  • $FILE_DIR$ Directory of active file, no filename
  • $FILE_FNAME$ Filename of active file without path
  • $FILE_PATH$ Full path of active file (in Editor, Project, or Message window)
  • $LIST_DIR$ Directory for list output
  • $OBJ_DIR$ Directory for object output
  • $PROJ_DIR$ Project directory
  • $PROJ_FNAME$ Project filename without path
  • $PROJ_PATH$ Full path of project file
  • $TARGET_DIR$ Directory of primary output file
  • $TARGET_BNAME$ Filename without path of primary output file and without extension
  • $TARGET_BPATH$ Full path of primary output file without extension
  • $TARGET_FNAME$ Filename without path of primary output file
  • $TARGET_PATH$ Full path of primary output file
  • $TOOLKIT_DIR$ Directory of the active product, for example c:\program files\iar systems\embedded workbench 6.n\arm
  • $USER_NAME$ Your host login name
  • $ENVVAR$ The environment variable ENVVAR. Any name within $_ and _$ will be expanded to that system environment variable.
Vincent Lee
  • 71
  • 1
  • 1
3

If you go to Tools > Configure Custom Argument Variables you can add variables that you can address with $VARIABLE_NAME$. Not sure if that's exactly what you were looking for.

Jesper Evertsson
  • 613
  • 9
  • 28
3

As a caution, if you are using IarBuild.exe to build from the command line, the workspace or global values set from "Configure Custom Arguments Variables" are not included in the project files (.ewp) and thus is not expanded by IarBuild.exe at build time. This is not an issue if you only use the IDE to build.

MountainLogic
  • 308
  • 2
  • 11
  • 1
    The custom variables are stored in a separate file (.custom_argvars). IarBuild (in 7.40 and later) supports a `-varfile` option for injecting the custom variables into the build. – Dave Bacher Sep 25 '20 at 01:12
1

I found a reason for my problem (but it givs another one):
I define a windows "path-variable" like LIB_PATH and put it in the IAR project file with $_LIB_PATH_$.
This works as long until i save the IAR-project. Then IAR sets all paths realive to $PROJ_DIR$ :-(

rideyourstyle
  • 39
  • 1
  • 1
  • 8