summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/IAR-ASM.cmake
blob: 5f1dac07bf55e6bdddf9f69dcb593771171bdd0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# This file is processed when the IAR Assembler is used

include(Compiler/IAR)

# 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)

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")
  set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa;S)

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)

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)

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}" 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)
  __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")

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()

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")

set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${_CMAKE_IAR_SILENCER_FLAG} <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")

unset(_CMAKE_IAR_SILENCER_FLAG)