Skip to content

Commit 6dc85e0

Browse files
committed
Workaround for Cortex-M33 Arm toochain linking
Binaries generated for Cortex-M33 targets (e.g. Musca S1/B1) using the Arm toolchain + CMake is unable to run, unless we instruct the linker to not use floating points. Note: This is a temporary workaround, because * Ideally, the Arm linker should be able to auto detect the architecture support from the input object files, but it's not always the case. We already have a similar workaround for Cortex-M4. * The full option to use should be `--cpu=Cortex-M33.no_dsp.no_fp` but `no_dsp` currently conflicts with CMake's compilation tests (no option to disable DSP in the test objects before linking).
1 parent 866855d commit 6dc85e0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tools/cmake/cores/Cortex-M33-NS.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1212
"-mcpu=cortex-m33+nodsp"
1313
"-mfpu=none"
1414
)
15+
list(APPEND link_options
16+
# Necessary as the linker does not always detect
17+
# the architecture from the objectfiles correctly.
18+
# Also, the complete flag should be "--cpu=Cortex-M33.no_dsp.no_fp"
19+
# but this currently conflicts with CMake's compiler test until fixed
20+
"--cpu=Cortex-M33.no_fp"
21+
)
1522
endif()
1623

1724
function(mbed_set_cpu_core_definitions target)

tools/cmake/cores/Cortex-M33.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1212
"-mcpu=cortex-m33+nodsp"
1313
"-mfpu=none"
1414
)
15+
list(APPEND link_options
16+
# Necessary as the linker does not always detect
17+
# the architecture from the objectfiles correctly.
18+
# Also, the complete flag should be "--cpu=Cortex-M33.no_dsp.no_fp"
19+
# but this currently conflicts with CMake's compiler test until fixed
20+
"--cpu=Cortex-M33.no_fp"
21+
)
1522
endif()
1623

1724
function(mbed_set_cpu_core_definitions target)

0 commit comments

Comments
 (0)