Hi all,
I'm wonder is possible to get project name for preprocessor commands as define (ie. #ifdef...) like compilation date/time by using "__DATE__" & "__TIME__".
Greetings, Lukasz.
That will work only by ...
Why do people say stupid things such as that?
An alternative to the only way might be to do the following:
In the Project->Options->User->Run User Programs Before Build/Rebuild add a command of:
PreProcess.Bat @L
Have a batch file in your project directory (with the name PreProcess.Bat) that contains:
echo #define PROJECT_NAME %1 >MyProjectName.H
Now, just include that header into your code and bam.
You might like to tinker with it, but I think it shows the basic principle.
Thanks Kevin,
It's better solution than nothing ;) By the way, maybe you know when I can find list all preprocesor macros for Keil of course (like "__DATE__") ?
Cheers.
"...where I can find..." of course ;)
I'm not going to be so stupid as to say "the only place to get the information is ..." ;)
Really, a good place to start your search will be the compiler manual. There must surely be a list included.
Don't get me wrong - I always trying to find something alone. I don't like to bother anybody. In this matter I've found only this: www.keil.com/.../c51_pp_predefmacroconst.htm
I just ask maybe you know something more than that.
Your link isn't applicable since it's for C51 and you have specified the ARM architecture.
This link might be more relevant: www.keil.com/.../armcc_pge1397113341080.htm
Yes you have right. This is more valid list for predefined macros for Keil ARM compiler. Thanks for your answer.
Hi Kevin, In the Project->Options->User->Run User Programs Before Build/Rebuild add a command of: PreProcess.Bat "@L"
Could you help tell me why the file "MyProjectName.h" is not created?
[Build Message] Build Project 'bootloader' - Target 'Bootloader Configuration' Before Build - User command #1: E:\2015NewLife\EVT1\Application\Projects\bootloader\src\preprocess.bat "bootloader" E:\2015NewLife\EVT1\Application\Projects\bootloader>echo #define PROJECT_NAME "bootloader" 1>MyProjectName.h compiling main.c... E:\2015NewLife\EVT1\Application\Projects\bootloader\src\main.c(55): error: #5: cannot open source input file "MyProjectName.h": No such file or directory #include "MyProjectName.h" src\main.c: 0 warnings, 1 error ".\output\bootloader.axf" - 1 Error(s), 0 Warning(s). Target not created.
I didn't notice any mention from you for the other step I gave:
Hi Kevin, When I search the file 'MyProjectName.H' in my working HDD, I found it is already created in project folder. Thanks for your help.
Hi Kevin, How do I get the output folder by using Key Sequence for Tool Parameters of Keil/MDK. For example, @L denote Linker output file name without extension. BlackSu
How do I get the output folder by using Key Sequence for Tool Parameters of Keil/MDK
I always find the manual a good place to start:
http://www.keil.com/support/man/docs/uv4/uv4_ut_keysequence.htm
Hi Kevin, I knew this link. But I can't find any key sequences for get output folder. Thanks for your help
I got it. $L