arch/arm: Add LLVM configuration to CMake
Added LLVM-specific configuration variables to ARM architecture CMake files: - LLVM_ARCHTYPE for architecture variant (thumbv6m, thumbv7a, etc) - LLVM_CPUTYPE for CPU target (cortex-m0, cortex-a5, etc) - LLVM_ABITYPE for ABI (eabi/eabihf) These changes enable LLVM/Clang toolchain support while maintaining compatibility with existing GCC configurations. The LLVM variables are set based on the same architecture/CPU/FPU configurations used for GCC flags. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
f2934935d0
commit
6dbdfb3cd5
4 changed files with 65 additions and 0 deletions
|
@ -21,3 +21,8 @@
|
||||||
# ##############################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
add_compile_options(-mcpu=cortex-m0 -mthumb -mfloat-abi=soft)
|
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)
|
||||||
|
|
|
@ -24,12 +24,28 @@ set(PLATFORM_FLAGS)
|
||||||
|
|
||||||
if(CONFIG_ARCH_CORTEXA5)
|
if(CONFIG_ARCH_CORTEXA5)
|
||||||
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a5)
|
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a5)
|
||||||
|
set(LLVM_CPUTYPE cortex-a5)
|
||||||
elseif(CONFIG_ARCH_CORTEXA7)
|
elseif(CONFIG_ARCH_CORTEXA7)
|
||||||
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a7)
|
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a7)
|
||||||
|
set(LLVM_CPUTYPE cortex-a7)
|
||||||
elseif(CONFIG_ARCH_CORTEXA8)
|
elseif(CONFIG_ARCH_CORTEXA8)
|
||||||
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a8)
|
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a8)
|
||||||
|
set(LLVM_CPUTYPE cortex-a8)
|
||||||
elseif(CONFIG_ARCH_CORTEXA9)
|
elseif(CONFIG_ARCH_CORTEXA9)
|
||||||
list(APPEND PLATFORM_FLAGS -mcpu=cortex-a9)
|
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()
|
endif()
|
||||||
|
|
||||||
if(NOT CONFIG_ARM_DPFPU32)
|
if(NOT CONFIG_ARM_DPFPU32)
|
||||||
|
|
|
@ -38,4 +38,23 @@ else() # gcc
|
||||||
set(TOOLCHAIN_ARCH_FILE armv7-m_gcc)
|
set(TOOLCHAIN_ARCH_FILE armv7-m_gcc)
|
||||||
endif()
|
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})
|
include(${TOOLCHAIN_ARCH_FILE})
|
||||||
|
|
|
@ -22,6 +22,31 @@
|
||||||
|
|
||||||
set(PLATFORM_FLAGS)
|
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)
|
if(CONFIG_ARM_DSP)
|
||||||
set(EXTCPUFLAGS +dsp)
|
set(EXTCPUFLAGS +dsp)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue