Question

In IAR embedded workbench IDE, I need to force the compilation of a file, every time I build the project (in order to recompile __DATE__ and __TIME__).

So I need to "touch" that file (i.e., delete the corresponding object file).

I went into the project options --> C/C++ Compiler --> Extra Options --> Use command line options.

In there, I entered a shell command for deleting that file, but without luck. I tried several different ways of doing it, including to call a batch file. Examples:

  1. del "$OBJ_DIR$\mng_version.o"

  2. cmd /c "del "$OBJ_DIR$\mng_version.o""

  3. pre_build.bat

None of these worked. Does anybody have any idea how to do this?

Was it helpful?

Solution

I use

Project options -> Build Actions 

and enter a command into the Pre-build command line. This can be a batch file invocation. I have a utility that increments a build number declaration in a version file that is then re-compiled on every build.

This is the same on the MSP-430, ARM and Atmel AVR-32 versions of the IAR toolset.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top