I am trying to use predefined symbols such as __OPTIMISE_LEVEL, __TARGET_ARCH_ARM, __TARGET_ARCH_THUMB on the evaluation version of the MDK and I find that they are not defined. I tried to list all the defined symbols using the command line switch --list_macros but that is not recognised.
Have I missed something or is this the normal behaviour of the evaluation compiler?
Hi John,
I'm Paul Black, Product Manager for the Arm Compiler. I think the answer here very much depends on which compiler you're using: MDK ships with both Arm Compiler 5 and Arm Compiler 6.
Arm Compiler 5 supported, for example, the __OPTIMISE_LEVEL macro. This would resolve to an integer relating to the optimization level being used (1 for -O1 etc). For Compiler 6 there's a small change in behaviour, and there are now 2 macros: __OPTIMIZE__ is defined if any optimization level other than -O0 is specified, and __OPTIMIZE_SIZE__ is defined if the size-optimizing options -Os or -Oz are used. The change in operation here partly reflects user feedback, partly reflects the wider range of optimization options available in AC6, and partly aligns more closely with a number of other widely-used compilers such as GCC. The change in functionality enables more widely portable code to be written, by reducing the number of compiler-specific macros.
For similar reasons, __TARGET_ARCH_ARM is replaced by __ARM_ARCH, and __TARGET_ARCH_THUMB by __thumb__. The downside of course, is that there's a change in operation between AC5 and AC6, so not all code will migrate between the two with zero effort. We hope that by adopting more widely used constructs to promote more widely portable code, we got the balance about right.
Regards,
Paul.
Thank you for the explanation. I have looked again at the list of books and have now noticed that there are two sets - for v5 and for v6. Perhaps it would be better to present these in separate lists.
John C.
Many thanks for the feedback, it's always good to hear what's causing friction and what could be clearer! For right now, all the documentation specific to the latest AC6 release is here: https://developer.arm.com/products/software-development-tools/compilers/arm-compiler/documentation
The documentation includes a migration guide, which should be useful as a reference if you encounter any other differences between AC5 and AC6. Although, having said that I just took a look and I can't see that the guide mentions the specific macros you've encountered here, so many thanks for bringing these to my attention!