Skip to content

Commit a29a5e1

Browse files
committed
cortex-m55: Workaround armasm options bug
We use armclang with `-masm=auto` to auto-select which assembler to use based on the syntax of the file. Cortex-M55 isn't supported by armasm, but we don't yet have GCC-syntax asm files for ARM compiler (https://github.com/ARM-software/CMSIS_5/blob/1dd090bd1c6d196da96241420a40090bf09c0b13/CMSIS/RTOS2/RTX/Source/ARM/irq_armv8mml.s). $ armclang --target=arm-arm-none-eabi -mcpu=cortex-m55 -mfpu=none -masm=auto -c cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.S armclang: error: armasm does not support CPU 'cortex-m55' In the mean time, we can build C and C++ files using the `-mcpu=cortex-m55` option, and for armasm, cancel out that choice of CPU with a known-supported CPU type, Cortex-R7, and provide the legacy assembler-specific option `-Wa,armasm,--cpu=cortex-m55`. After these changes, this works: $ armclang --target=arm-arm-none-eabi -mcpu=cortex-m55 -mcpu=cortex-r7 -Wa,--cpu=cortex-m55 -mfpu=none -masm=auto -c cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.S
1 parent 5d20374 commit a29a5e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/cmake/cores/Cortex-M55.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1717
)
1818
endif()
1919

20+
# We'd like to use just "-mcpu=cortex-m55" in common_options, but due to a bug
21+
# in armclang passing options to armasm, we use the following flags as a
22+
# workaround to select M55.
23+
list(APPEND asm_compile_options
24+
-mcpu=cortex-r7
25+
-Wa,--cpu=cortex-m55
26+
)
27+
2028
function(mbed_set_cpu_core_definitions target)
2129
target_compile_definitions(${target}
2230
INTERFACE

0 commit comments

Comments
 (0)