diff options
author | Stefan Andersson <tfosm@hotmail.com> | 2019-05-06 09:25:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-05-08 16:55:18 (GMT) |
commit | 41780964936b03754a6551c65d4fd938521130b5 (patch) | |
tree | 29a82d47cab8c8f9d203eba9de30ac4c34c2d394 | |
parent | 0f27e7d165c96f2c3ada1695df4f6cfaa44afe51 (diff) | |
download | CMake-41780964936b03754a6551c65d4fd938521130b5.zip CMake-41780964936b03754a6551c65d4fd938521130b5.tar.gz CMake-41780964936b03754a6551c65d4fd938521130b5.tar.bz2 |
IAR: Add architecture support for RL78, RH850 and MSP430
-rw-r--r-- | Help/release/dev/iar-new_architectures.rst | 6 | ||||
-rw-r--r-- | Modules/CMakePlatformId.h.in | 9 | ||||
-rw-r--r-- | Modules/Compiler/IAR-ASM.cmake | 15 | ||||
-rw-r--r-- | Modules/Compiler/IAR-C.cmake | 21 | ||||
-rw-r--r-- | Modules/Compiler/IAR-CXX.cmake | 34 | ||||
-rw-r--r-- | Modules/Compiler/IAR-DetermineCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/IAR-FindBinUtils.cmake | 9 |
7 files changed, 68 insertions, 28 deletions
diff --git a/Help/release/dev/iar-new_architectures.rst b/Help/release/dev/iar-new_architectures.rst new file mode 100644 index 0000000..d661c80 --- /dev/null +++ b/Help/release/dev/iar-new_architectures.rst @@ -0,0 +1,6 @@ +iar-new_architectures +--------------------- + +* Support was added for the IAR compiler architectures Renesas RX, + RL78, RH850 and Texas Instruments MSP430. +* The IAR compilers built for Linux (IAR BuildLx) now work as well. diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index c88094a..8f5747a 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -159,9 +159,18 @@ # elif defined(__ICCRX__) # define ARCHITECTURE_ID "RX" +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + # elif defined(__ICCAVR__) # define ARCHITECTURE_ID "AVR" +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index f9c0ced..71f2ac6 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -12,11 +12,26 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") __compiler_iar_ilink(ASM) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") + set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + __compiler_iar_ilink(ASM) + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) + +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") + set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> --silent <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + __compiler_iar_ilink(ASM) + set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) + elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") __compiler_iar_xlink(ASM) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) +elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") + set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + __compiler_iar_xlink(ASM) + 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.") endif() diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index af5874c..4b02a9a 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -38,20 +38,23 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") __compiler_iar_ilink(C) __compiler_check_default_language_standard(C 1.10 90 2.10 99 4.10 11) +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") + __compiler_iar_ilink(C) + __compiler_check_default_language_standard(C 1.10 90 1.10 99 2.10 11) + +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") + __compiler_iar_ilink(C) + __compiler_check_default_language_standard(C 1.10 90 1.10 99 4.10 11) + elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(C) __compiler_check_default_language_standard(C 7.10 99) set(CMAKE_C_OUTPUT_EXTENSION ".r90") - if(NOT CMAKE_C_LINK_FLAGS) - set(CMAKE_C_LINK_FLAGS "-Fmotorola") - endif() - - # add the target specific include directory: - get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) - get_filename_component(_compilerDir "${_compilerDir}" PATH) - include_directories("${_compilerDir}/inc" ) - include_directories("${_compilerDir}/inc/Atmel" ) +elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") + __compiler_iar_xlink(C) + __compiler_check_default_language_standard(C 1.10 90 5.10 99) + set(CMAKE_C_OUTPUT_EXTENSION ".r43") else() message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index 04ccbe5..22ec118 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -4,12 +4,14 @@ include(Compiler/IAR) include(Compiler/CMakeCommonCompilerMacros) # Common -if(NOT CMAKE_IAR_CXX_FLAG) - if(NOT CMAKE_CXX_COMPILER_VERSION) - message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") - endif() +if(NOT CMAKE_CXX_COMPILER_VERSION) + message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.") +endif() - if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 7) +if(NOT CMAKE_IAR_CXX_FLAG) + # The --c++ flag was introduced in platform version 9 for all architectures except ARM where it was introduced already in version 7 + if(CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 8 OR + (CMAKE_CXX_COMPILER_VERSION_INTERNAL VERSION_GREATER 6 AND "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") ) set(CMAKE_IAR_CXX_FLAG --c++) else() set(CMAKE_IAR_CXX_FLAG --eec++) @@ -45,20 +47,22 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") __compiler_iar_ilink(CXX) __compiler_check_default_language_standard(CXX 2.10 98 4.10 14) +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850") + __compiler_iar_ilink(CXX) + __compiler_check_default_language_standard(CXX 1.10 98 2.10 14) + +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") + __compiler_iar_ilink(CXX) + __compiler_check_default_language_standard(CXX 1.10 98 4.10 14) + elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_xlink(CXX) __compiler_check_default_language_standard(CXX 7.10 98) - set(CMAKE_CXX_OUTPUT_EXTENSION ".r90") - if(NOT CMAKE_CXX_LINK_FLAGS) - set(CMAKE_CXX_LINK_FLAGS "-Fmotorola") - endif() - - # add the target specific include directory: - get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) - get_filename_component(_compilerDir "${_compilerDir}" PATH) - include_directories("${_compilerDir}/inc" ) - include_directories("${_compilerDir}/inc/Atmel" ) +elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") + __compiler_iar_xlink(CXX) + __compiler_check_default_language_standard(CXX 5.10 98) + set(CMAKE_CXX_OUTPUT_EXTENSION ".r43") else() message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." ) diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake index cdfb095..6b09c40 100644 --- a/Modules/Compiler/IAR-DetermineCompiler.cmake +++ b/Modules/Compiler/IAR-DetermineCompiler.cmake @@ -31,7 +31,7 @@ set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000) # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000) # define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__) -# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__)) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__)) # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100)) # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__) diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake index 7fc6b59..3f13dce 100644 --- a/Modules/Compiler/IAR-FindBinUtils.cmake +++ b/Modules/Compiler/IAR-FindBinUtils.cmake @@ -11,7 +11,9 @@ get_filename_component(__iar_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPI set(__iar_hints "${__iar_hint_1}" "${__iar_hint_2}") if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM" OR - "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX") + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RX" OR + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RH850" OR + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "RL78") string(TOLOWER "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" _archid_lower) @@ -41,9 +43,10 @@ set(CMAKE_IAR_OBJMANIP \"${CMAKE_IAR_OBJMANIP}\") set(CMAKE_IAR_LINKER \"${CMAKE_IAR_LINKER}\") ") -elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") +elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR" OR + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430") - # For AVR and AVR32, IAR uses the "xlink" linker and the "xar" archiver: + # Find the "xlink" linker and "xar" archiver: find_program(CMAKE_IAR_LINKER xlink HINTS ${__iar_hints} DOC "The IAR XLINK linker") find_program(CMAKE_IAR_AR xar HINTS ${__iar_hints} |