cmake: Fix arm compiler build failures

Update arm compiler flags which were causing build failures.

Remove `-MMD` flag as it is not recognised by the Arm compiler.

There are no common flags between compiler, assembler and linker. The
compiler expects `-mcpu` whereas assembler and linker expects `--cpu`.

The `COMMON_FLAGS` in `cmake/toolchains/ARM.cmake` are not recognised by
assembler and linker.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
pull/13566/head
Devaraj Ranganna 2020-07-23 11:52:38 +01:00 committed by Hugues Kamba
parent 915d552cde
commit f18622e8d7
2 changed files with 7 additions and 8 deletions

View File

@ -28,7 +28,9 @@ set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} \
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
set(ARM_FLAGS " \
--cpu=Cortex-M4.fp.sp \
-mcpu=cortex-m4 \
-mfpu=fpv4-sp-d16 \
-mfloat-abi=hard \
")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
@ -38,10 +40,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
${ARM_FLAGS} \
")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} \
${ARM_FLAGS} \
--cpu=Cortex-M4 \
")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} \
${ARM_FLAGS} \
--cpu=Cortex-M4 \
")
endif()

View File

@ -16,7 +16,6 @@ set(COMMON_FLAGS " \
-Wno-deprecated-register \
-fdata-sections \
-fno-exceptions \
-MMD \
-fshort-enums \
-fshort-wchar \
")
@ -27,10 +26,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
${COMMON_FLAGS} \
")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} \
${COMMON_FLAGS} \
")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} \
${COMMON_FLAGS} \
--cpreproc \
--cpreproc_opts=--target=arm-arm-none-eabi,-mcpu=cortex-m4,-D,__FPU_PRESENT,-D,MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED \
")
add_definitions(