Hi everyone!
I am using project pannel "C/C++ Preprocessor" to #define global parameters of my project, and compile different code depending on them. It works fine in C files, but the problem is when I am using this parameter in an ASM source file, where I always get the error Unknown identifier.
I leave you an example:
/*In preprocessor pannel*/
#define MY_OPTION 1
/*In the *.s file*/
.extern MY_OPTION
#if MY_OPTION==1
//Some code
#else
//Some other code
How can I include this parameter to the asm file so when I compile the project, the compiler recognizes it?
Thanks in advance,
Rubén
Solved! Go to Solution.
RValls,
You may use "Prefix file" option: "Alt+F7" -> "EPPC Assembler" -> "Prefix file" edit box.
If you create separate file for each target and add macro definitions into the files you can pass
these defs. into you asm file based on selected target.
Stanish
Hello RValls,
You can try to create separate .h file and include this file in your .asm files. e.g:
/* mydefs.h */
#define MY_OPTION 1
/* asm file */
#include "mydefs.h"
#if MY_OPTION==1
//Some code
....
#endif
Hi again, and thanks for the fast reply.
That works fine, but I'm still having a problem: I am using different targets to use one code or other code, or one processor or other, etc... and I want to mantein this easy way of changing from one to other, so the solution of using an options.h file is not usefull, because if I change this file from MY_OPTION 1 to MY_OPTION 0, it will also be changed in the other targets.
Any other solution?
Thanks,
Rubén
RValls,
You may use "Prefix file" option: "Alt+F7" -> "EPPC Assembler" -> "Prefix file" edit box.
If you create separate file for each target and add macro definitions into the files you can pass
these defs. into you asm file based on selected target.
Stanish
Thank you very much! That was exactly what I need, now it goes fine just by changing the target!
I have marked the post as Solved.
Thanks again, stanish
Rubén