Closed tcsunhao closed 5 days ago
It looks like assembler files are somewhat the issue. What about this proposal:
define:
only applies to C and C++ source files
define-asm:
only applies to assembly source files (new)
add-path:
only applies to C and C++ source files
add-path-asm:
only applies to assembly source files (new)
As background: the startup assembler files should get replaced over time with C source files, like it is the case already with CMSIS v5.9. See here:
Thank you @ReinhardKeil . Your proposal can meet our needs.
define and add-path scope limited to C / CPP for CMSIS Toolbox 2.0 Specification
In particular the add-path
scope limitation breaks the build of libraries where include paths are needed by assembly files, for example in RTX:
https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/RTOS2/RTX/Source/GCC/irq_armv7m.S#L29
#include "rtx_def.h"
For this reason we are postponing the resolution of this issue.
Given the above example we need to make use of the new file attribute language
in the component description to add an include path specifically for assembler files e.g.:
<file category="include" language="asm" name="CMSIS/RTOS2/RTX/Include" />
This is completed
Macro defines under 'define' is populated into all sub compilers. For example, if we have following 'setup'
If we build with -v, we can get this
You can see that all 'defines' are populated into assemble startup_MK64F12.S which is obviously unnecessary and wrong.
One way to avoid this is to use MiscType because MiscType has sub compiler categories like asm/c/cpp. It is mentioned in https://github.com/Open-CMSIS-Pack/devtools/issues/276. However, sine all toolchains: MDK/IAR/Eclipse based all support such asm/c/cpp sub compiler categories, then we can regard that asm/c/cpp specific defines are commonly and widely used in embedded world. At least for assemble and c, they usually don't share macro defines which means we have to move all macro defines into MiscType, and it makes the common 'define' useless. And to define macros inside MiscType is unconvenient and indirect.
The same issue applis for include path.
Suggestion: support asm/c/cpp specific defines and macros like asm-define c-define cpp-define asm-include c-include cpp-include