diff --git a/arch/arm/CMakeLists.txt b/arch/arm/CMakeLists.txt index 2ddf782a41b1c9..cf70553507ebab 100644 --- a/arch/arm/CMakeLists.txt +++ b/arch/arm/CMakeLists.txt @@ -1,7 +1,11 @@ # SPDX-License-Identifier: Apache-2.0 if(CONFIG_ARM64) - include(aarch64.cmake) + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf64-littleaarch64) + + add_subdirectory(core/aarch64) else() - include(aarch32.cmake) + set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-littlearm) + + add_subdirectory(core/aarch32) endif() diff --git a/arch/arm/aarch32.cmake b/arch/arm/aarch32.cmake deleted file mode 100644 index 847120be89d22f..00000000000000 --- a/arch/arm/aarch32.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -set(ARCH_FOR_cortex-m0 armv6s-m ) -set(ARCH_FOR_cortex-m0plus armv6s-m ) -set(ARCH_FOR_cortex-m3 armv7-m ) -set(ARCH_FOR_cortex-m4 armv7e-m ) -set(ARCH_FOR_cortex-m23 armv8-m.base ) -set(ARCH_FOR_cortex-m33 armv8-m.main+dsp) -set(ARCH_FOR_cortex-m33+nodsp armv8-m.main ) -set(ARCH_FOR_cortex-r4 armv7-r ) -set(ARCH_FOR_cortex-r5 armv7-r+idiv ) - -if(ARCH_FOR_${GCC_M_CPU}) - set(ARCH_FLAG -march=${ARCH_FOR_${GCC_M_CPU}}) -endif() - -zephyr_compile_options( - -mabi=aapcs - ${ARCH_FLAG} - ) - -zephyr_ld_options( - -mabi=aapcs - ${ARCH_FLAG} - ) - -set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH}) # BFD format - -add_subdirectory(core/aarch32) diff --git a/arch/arm/aarch64.cmake b/arch/arm/aarch64.cmake deleted file mode 100644 index 25f967eb36c1ba..00000000000000 --- a/arch/arm/aarch64.cmake +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf64-littleaarch64) # BFD format - -add_subdirectory(core/aarch64) diff --git a/cmake/compiler/gcc/target_arm.cmake b/cmake/compiler/gcc/target_arm.cmake index 5aa5dbb10c61d5..c4fd8645ab1c36 100644 --- a/cmake/compiler/gcc/target_arm.cmake +++ b/cmake/compiler/gcc/target_arm.cmake @@ -15,6 +15,23 @@ else() list(APPEND TOOLCHAIN_LD_FLAGS -mthumb) endif() + set(ARCH_FOR_cortex-m0 armv6s-m ) + set(ARCH_FOR_cortex-m0plus armv6s-m ) + set(ARCH_FOR_cortex-m3 armv7-m ) + set(ARCH_FOR_cortex-m4 armv7e-m ) + set(ARCH_FOR_cortex-m23 armv8-m.base ) + set(ARCH_FOR_cortex-m33 armv8-m.main+dsp) + set(ARCH_FOR_cortex-m33+nodsp armv8-m.main ) + set(ARCH_FOR_cortex-r4 armv7-r ) + set(ARCH_FOR_cortex-r5 armv7-r+idiv ) + + if(ARCH_FOR_${GCC_M_CPU}) + set(ARCH_FLAG -march=${ARCH_FOR_${GCC_M_CPU}}) + endif() + + list(APPEND TOOLCHAIN_C_FLAGS -mabi=aapcs ${ARCH_FLAG}) + list(APPEND TOOLCHAIN_LD_FLAGS -mabi=aapcs ${ARCH_FLAG}) + # Defines a mapping from GCC_M_CPU to FPU if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)