diff options
Diffstat (limited to 'Modules/Compiler/IAR-ASM.cmake')
-rw-r--r-- | Modules/Compiler/IAR-ASM.cmake | 88 |
1 files changed, 61 insertions, 27 deletions
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index bae0fbd..5f1dac0 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,44 +2,78 @@ 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.30) + 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) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r90") + +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) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r43") -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) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r85") + +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) + set(CMAKE_ASM_OUTPUT_EXTENSION ".r51") + +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) |