Hello,
can I print the macros like __MODEL__? Would it be possible to do this in an batch file in Options / User?
Thanks in advance
I'm not sure what macros you are referring to.
The Arm Compiler for Embedded has a number of pre-defined macros (though not __MODEL__):
https://developer.arm.com/documentation/101754/0621/armclang-Reference/Other-Compiler-specific-Features/Predefined-macros
These can be accessed in code, for example:
int compiler_version() { return __ARMCOMPILER_VERSION; }
a) OP is asking how to dump predefined macros from the command line.
b) This question is tagged with "Keil C166 Dev Tools".
I did not notice the tag. Moving to Keil specific forum.
Isn't this the Keil forum?
>can I print the macros like __MODEL__?
I don't know where you want to print this macro. You can use this macro in your source code the same way as Ronan already showed you in this small function. According to our manual, __MODEL__ represents a number from 0 to 7 depending on the memory model you have selected for your project. C166 manuals are not available online, but you can see the values in the file C:\Keil_v5\C166\hlp\c166.chm chapter 'Preprocessor - Macros - Predefined Macros'.
>Would it be possible to do this in an batch file in Options / User?
As mentioned above, you can use this macro in your C source file. It is not a so-called 'Key sequence' :
developer.arm.com/.../Key-Sequence-for-Tool-Parameters
Thank you for your reply.
I would like to display all macros to see which ones are being used.
I'm not aware of any way to list all predefined macros that are used in a project. I checked the .lst and .map files, but they don't list these symbols.
The number of predefined macros is quite limited. You could use grep (or find in files) over your complete project to find if and where such macros are used.
I couldn't find the marco in my files either.
How do I know which macros are set?
How do the compiler decide which macros to set?
Gabriele__ said:How do I know which macros are set?
I don't fully understand your question. As I mentioned before, our C166 lists all predefined macros.
"C166 manuals are not available online, but you can see the values in the file C:\Keil_v5\C166\hlp\c166.chm chapter 'Preprocessor - Macros - Predefined Macros'."
Here is a screen capture of that manual page:
Gabriele__ said:How do the compiler decide which macros to set?
The compiler sets all these macros with a specific value or sting.
Thank you.
I'm trying to rephrase my question to make it clearer hopefully:
How do I get the values for the predefined macros from the C166 list that the compiler has set?
Could I readout the specific value or string?