diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/IAR-ASM.cmake | 84 | ||||
-rw-r--r-- | Modules/Compiler/IAR.cmake | 6 |
2 files changed, 63 insertions, 27 deletions
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index bae0fbd8ca..98f58e7bc6 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,44 +2,74 @@ include(Compiler/IAR) -cmake_policy(PUSH) -cmake_policy(SET CMP0057 NEW) # if IN_LIST - -set(_CMAKE_IAR_ITOOLS "ARM" "RH850" "RL78" "RX" "RISC-V" "STM8") -set(_CMAKE_IAR_XTOOLS "AVR" "MSP430" "V850" "8051") +# Architecture specific +if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("-y" 9) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -set(_CMAKE_IAR_ASM_SILENT "RH850" "RL78" "RX" "RISC-V" "STM8") -if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ASM_SILENT) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2.50.1) set(_CMAKE_IAR_SILENCER_FLAG " --silent") -else() - set(_CMAKE_IAR_SILENCER_FLAG " -S") -endif() + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -string(APPEND CMAKE_ASM_FLAGS_INIT " ") -string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") -string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") -string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") -string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${_CMAKE_IAR_SILENCER_FLAG} <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -if("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_ITOOLS) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" MATCHES "(RISCV|RISC-V)") __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 1) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) -elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" IN_LIST _CMAKE_IAR_XTOOLS) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") + __compiler_iar_xlink(ASM) + __assembler_iar_deps("-y" 8) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") __compiler_iar_xlink(ASM) - # AVR=s90, MSP430=s43, V850=s85, 8051=s51 - set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;s43;s85;s51;asm;msa) + __assembler_iar_deps("-y" 8) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s43;asm;msa) -else() - message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.") +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850") + __compiler_iar_xlink(ASM) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s85;asm;msa) + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051") + __compiler_iar_xlink(ASM) + set(_CMAKE_IAR_SILENCER_FLAG " -S") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa) + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "STM8") + __compiler_iar_ilink(ASM) + __assembler_iar_deps("--dependencies=ns" 2) + set(_CMAKE_IAR_SILENCER_FLAG " --silent") + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S) +else() + message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." ) endif() -unset(_CMAKE_IAR_ITOOLS) -unset(_CMAKE_IAR_XTOOLS) -unset(_CMAKE_IAR_ASM_SILENT) -unset(_CMAKE_IAR_SILENCER_FLAG) +string(APPEND CMAKE_ASM_FLAGS_DEBUG_INIT " -r") +string(APPEND CMAKE_ASM_FLAGS_MINSIZEREL_INIT " -DNDEBUG") +string(APPEND CMAKE_ASM_FLAGS_RELEASE_INIT " -DNDEBUG") +string(APPEND CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT " -r -DNDEBUG") -cmake_policy(POP) +set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${_CMAKE_IAR_SILENCER_FLAG} <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + +unset(_CMAKE_IAR_SILENCER_FLAG) diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index e75df59c6e..0aca2838a7 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -53,3 +53,9 @@ macro(__compiler_iar_xlink lang) set(CMAKE_LIBRARY_PATH_FLAG "-I") endmacro() + +macro(__assembler_iar_deps flag min_version) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL ${min_version}) + set(CMAKE_DEPFILE_FLAGS_ASM "${flag} <DEP_FILE>") + endif() +endmacro() |