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
(1dd090bd1c/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
pull/14588/head
Jaeden Amero 2021-05-05 16:47:54 +01:00
parent 5d20374bc3
commit a29a5e165a
1 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,14 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
)
endif()
# We'd like to use just "-mcpu=cortex-m55" in common_options, but due to a bug
# in armclang passing options to armasm, we use the following flags as a
# workaround to select M55.
list(APPEND asm_compile_options
-mcpu=cortex-r7
-Wa,--cpu=cortex-m55
)
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE