diff --git a/arch/arm/src/cmake/armv6-m.cmake b/arch/arm/src/cmake/armv6-m.cmake index 32596ab689..5d52da216d 100644 --- a/arch/arm/src/cmake/armv6-m.cmake +++ b/arch/arm/src/cmake/armv6-m.cmake @@ -21,3 +21,8 @@ # ############################################################################## add_compile_options(-mcpu=cortex-m0 -mthumb -mfloat-abi=soft) + +# LLVM Configuration +set(LLVM_ARCHTYPE thumbv6m) +set(LLVM_ABITYPE eabi) +set(LLVM_CPUTYPE cortex-m0) diff --git a/arch/arm/src/cmake/armv7-a.cmake b/arch/arm/src/cmake/armv7-a.cmake index a061cdffe8..ddd02c324b 100644 --- a/arch/arm/src/cmake/armv7-a.cmake +++ b/arch/arm/src/cmake/armv7-a.cmake @@ -24,12 +24,28 @@ set(PLATFORM_FLAGS) if(CONFIG_ARCH_CORTEXA5) list(APPEND PLATFORM_FLAGS -mcpu=cortex-a5) + set(LLVM_CPUTYPE cortex-a5) elseif(CONFIG_ARCH_CORTEXA7) list(APPEND PLATFORM_FLAGS -mcpu=cortex-a7) + set(LLVM_CPUTYPE cortex-a7) elseif(CONFIG_ARCH_CORTEXA8) list(APPEND PLATFORM_FLAGS -mcpu=cortex-a8) + set(LLVM_CPUTYPE cortex-a8) elseif(CONFIG_ARCH_CORTEXA9) list(APPEND PLATFORM_FLAGS -mcpu=cortex-a9) + set(LLVM_CPUTYPE cortex-a9) +endif() + +if(CONFIG_ARM_THUMB) + set(LLVM_ARCHTYPE thumbv7a) +else() + set(LLVM_ARCHTYPE armv7-a) +endif() + +if(CONFIG_ARCH_FPU) + set(LLVM_ABITYPE eabihf) +else() + set(LLVM_ABITYPE eabi) endif() if(NOT CONFIG_ARM_DPFPU32) diff --git a/arch/arm/src/cmake/armv7-m.cmake b/arch/arm/src/cmake/armv7-m.cmake index 73ef08d18c..1f6d121e78 100644 --- a/arch/arm/src/cmake/armv7-m.cmake +++ b/arch/arm/src/cmake/armv7-m.cmake @@ -38,4 +38,23 @@ else() # gcc set(TOOLCHAIN_ARCH_FILE armv7-m_gcc) endif() +# LLVM Configuration +if(CONFIG_ARCH_CORTEXM3) + set(LLVM_ARCHTYPE thumbv7m) + set(LLVM_CPUTYPE cortex-m3) +else() + set(LLVM_ARCHTYPE thumbv7em) + if(CONFIG_ARCH_CORTEXM4) + set(LLVM_CPUTYPE cortex-m4) + elseif(CONFIG_ARCH_CORTEXM7) + set(LLVM_CPUTYPE cortex-m7) + endif() +endif() + +if(CONFIG_ARCH_FPU) + set(LLVM_ABITYPE eabihf) +else() + set(LLVM_ABITYPE eabi) +endif() + include(${TOOLCHAIN_ARCH_FILE}) diff --git a/arch/arm/src/cmake/armv8-m.cmake b/arch/arm/src/cmake/armv8-m.cmake index fef71a4984..71a8747e56 100644 --- a/arch/arm/src/cmake/armv8-m.cmake +++ b/arch/arm/src/cmake/armv8-m.cmake @@ -22,6 +22,31 @@ set(PLATFORM_FLAGS) +# LLVM Configuration +if(CONFIG_ARCH_CORTEXM23) + set(LLVM_ARCHTYPE thumbv8m.base) + set(LLVM_CPUTYPE cortex-m23) +elseif(CONFIG_ARCH_CORTEXM33) + set(LLVM_ARCHTYPE thumbv8m.main) + set(LLVM_CPUTYPE cortex-m33) +elseif(CONFIG_ARCH_CORTEXM35P) + set(LLVM_ARCHTYPE thumbv8m.main) + set(LLVM_CPUTYPE cortex-m35p) +elseif(CONFIG_ARCH_CORTEXM55) + set(LLVM_ARCHTYPE thumbv8.1m.main) + set(LLVM_CPUTYPE cortex-m55) +elseif(CONFIG_ARCH_CORTEXM85) + set(LLVM_ARCHTYPE thumbv8.1m.main) + set(LLVM_CPUTYPE cortex-m85) +endif() + +# Set ABI type based on FPU configuration +if(CONFIG_ARCH_FPU) + set(LLVM_ABITYPE eabihf) +else() + set(LLVM_ABITYPE eabi) +endif() + if(CONFIG_ARM_DSP) set(EXTCPUFLAGS +dsp) endif()