IAR开发STM8,如何加入每次编译的日期时间信息来做为版本信息呢??
网上找打了这个:
--------
IAR USING PRE- AND POST-BUILD ACTIONS
Using pre-build actions for time stamping
If necessary, you can specify pre-build and post-build actions that you want to occur before or after the build.
The Build Actions dialog box—available from the Project menu—lets you specify the actions required.
For more information about the Build Actions dialog box, see Build actions options, page 215.
Using pre-build actions for time stamping
You can use pre-build actions to embed a time stamp for the build in the resulting binary file. Follow these steps:
1 Create a dedicated time stamp file, for example, timestamp.c and add it to your project.
2 In this source file, use the preprocessor macros __TIME__ and __DATE__ to initialize a string variable.
3 Choose Project>Options>Build Actions to open the Build Actions dialog box.
4 In the Pre-build command line text field, specify for example this pre-build action:
cmd /c "del "$OBJ_DIR$\timestamp.o""
在网上找了半天,终于找到了,
http://blog.chinaunix.NET/uid-30127490-id-5062415.html
IAR的宏定义:
const char MenuStr[]={"T1xxxxxxxxxxP-xxE##"__DATE__"#####"}; //定义字符串常量