Is __CC_ARM not defined in the MDK Eval Version?

I'm working on a simple project and trying to make it work for both STM32CubeIDE and Keil uVision.  Building in uVision, in *my* files __CC_ARM is not defined. If I manually define it on the Target1 Options C Compiler form, then I get a million errors says that it is already defined in *other* files. Other files meaning supplied things like

stm32f10x.h(483): warning: In file included from...

I can see that in "core_cm3.h" it is already defined (magically).

Ideas??

I noticed someone doing this:

#if defined(__CC_ARM) || defined(__ARMCC_VERSION)

Parents
  • Hi,

    I'm still confused gang.I'm still getting what looks to me like GCC and not Keil? My objective is to be able to conditionally compile slightly different code for each, as needed. So,

    I created a new project from scratch using C:\Keil_v5_MDK\UV4\UV4.exe  (File Version 5.34.0.0)

    I see, under default Target1 -> Options

    Arm Compiler: Use default compiler version 6

    The Compiler control string is:

    -xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m3 -c
    -fno-rtti -funsigned-char -fshort-enums -fshort-wchar
    -D__EVAL -gdwarf-3 -O1 -ffunction-sections -Weverything -Wno-packed -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality 
    -I./RTE/Device/STM32F103C8
    -I./RTE/_Target_1
    -IC:/Users/GB/AppData/Local/Arm/Packs/ARM/CMSIS/5.8.0/CMSIS/Core/Include
    -IC:/Users/GB/AppData/Local/Arm/Packs/Keil/STM32F1xx_DFP/2.3.0/Device/Include
    -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_
    -o ./Objects/*.o -MD

    The About box says:

    IDE-Version:
    µVision V5.34.0.0
    Copyright (C) 2021 ARM Ltd and ARM Germany GmbH. All rights reserved.
    
    License Information:
    Grant B
    LIC=----
    
    Tool Version Numbers:
    Toolchain:        MDK-Lite  Version: 5.34.0.0
    Toolchain Path:    C:\Keil_v5_MDK\ARM\ARMCLANG\Bin
    C Compiler:         ArmClang.exe        V6.16
    Assembler:          Armasm.exe        V6.16
    Linker/Locator:     ArmLink.exe        V6.16
    Library Manager:    ArmAr.exe        V6.16
    Hex Converter:      FromElf.exe        V6.16
    CPU DLL:               SARMCM3.DLL          V5.34.0.0
    Dialog DLL:         TCM.DLL              V1.48.0.0
    Target DLL:             UL2CM3.DLL           V1.163.9.0
    Dialog DLL:         TCM.DLL              V1.48.0.0
    
    

    The Build log:

    
    µVision Build Log
    
    Tool Versions:
    
    IDE-Version: µVision V5.34.0.0
    Copyright (C) 2021 ARM Ltd and ARM Germany GmbH. All rights reserved.
    License Information: Grant B, , LIC=----
     
    Tool Versions:
    Toolchain:       MDK-Lite  Version: 5.34.0.0
    Toolchain Path:  C:\Keil_v5_MDK\ARM\ARMCLANG\Bin
    C Compiler:      ArmClang.exe V6.16
    Assembler:       Armasm.exe V6.16
    Linker/Locator:  ArmLink.exe V6.16
    Library Manager: ArmAr.exe V6.16
    Hex Converter:   FromElf.exe V6.16
    CPU DLL:         SARMCM3.DLL V5.34.0.0
    Dialog DLL:      DCM.DLL V1.17.3.0
    Target DLL:      UL2CM3.DLL V1.163.9.0
    Dialog DLL:      TCM.DLL V1.48.0.0
     
    Project:
    
    D:\Grant4\STM32\STM32_Keil_v5_MDK\Dog\Dog.uvprojx
    Project File Date:  07/19/2021
    
    Output:
    
    *** Using Compiler 'V6.16', folder: 'C:\Keil_v5_MDK\ARM\ARMCLANG\Bin'
    Rebuild target 'Target 1'
    compiling main.c...
    assembling startup_stm32f10x_md.s...
    RTE/Device/STM32F103C8/system_stm32f10x.c(167): warning: no previous extern declaration for non-static variable 'AHBPrescTable' [-Wmissing-variable-declarations]
    __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
                ^
    RTE/Device/STM32F103C8/system_stm32f10x.c(167): note: declare 'static' if the variable is not intended to be used outside of this translation unit
    __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
        ^
    1 warning generated.
    compiling system_stm32f10x.c...
    linking...
    Program Size: Code=664 RO-data=252 RW-data=0 ZI-data=1632  
    ".\Objects\Dog.axf" - 0 Error(s), 1 Warning(s).
    
    Software Packages used:
    
    
    Package Vendor: ARM
                    http://www.keil.com/pack/ARM.CMSIS.5.8.0.pack
                    ARM.CMSIS.5.8.0
                    CMSIS (Common Microcontroller Software Interface Standard)
       * Component: CORE Version: 5.5.0
    
    Package Vendor: Keil
                    http://www.keil.com/pack/Keil.STM32F1xx_DFP.2.3.0.pack
                    Keil.STM32F1xx_DFP.2.3.0
                    STMicroelectronics STM32F1 Series Device Support, Drivers and Examples
       * Component: Startup Version: 1.0.0
    
    Collection of Component include folders:
    
      .\RTE\Device\STM32F103C8
      .\RTE\_Target_1
      C:\Users\GBeattie\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\Core\Include
      C:\Users\GBeattie\AppData\Local\Arm\Packs\Keil\STM32F1xx_DFP\2.3.0\Device\Include
    
    Collection of Component Files used:
    
    
       * Component: ARM::CMSIS:CORE:5.5.0
    
       * Component: Keil::Device:Startup:1.0.0
          Source file:   Device\Source\ARM\STM32F1xx_OPT.s
          Source file:   Device\Source\system_stm32f10x.c
          Source file:   Device\Source\ARM\startup_stm32f10x_md.s
          Include file:  RTE_Driver\Config\RTE_Device.h
    Build Time Elapsed:  00:00:00
    
    

    My screen shows (I expected GCC not to be defined for a Keil compiler):

    Suggestions on how I can conditionally compile for Keil versus GCC?

Reply
  • Hi,

    I'm still confused gang.I'm still getting what looks to me like GCC and not Keil? My objective is to be able to conditionally compile slightly different code for each, as needed. So,

    I created a new project from scratch using C:\Keil_v5_MDK\UV4\UV4.exe  (File Version 5.34.0.0)

    I see, under default Target1 -> Options

    Arm Compiler: Use default compiler version 6

    The Compiler control string is:

    -xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m3 -c
    -fno-rtti -funsigned-char -fshort-enums -fshort-wchar
    -D__EVAL -gdwarf-3 -O1 -ffunction-sections -Weverything -Wno-packed -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality 
    -I./RTE/Device/STM32F103C8
    -I./RTE/_Target_1
    -IC:/Users/GB/AppData/Local/Arm/Packs/ARM/CMSIS/5.8.0/CMSIS/Core/Include
    -IC:/Users/GB/AppData/Local/Arm/Packs/Keil/STM32F1xx_DFP/2.3.0/Device/Include
    -D__UVISION_VERSION="534" -D_RTE_ -DSTM32F10X_MD -D_RTE_
    -o ./Objects/*.o -MD

    The About box says:

    IDE-Version:
    µVision V5.34.0.0
    Copyright (C) 2021 ARM Ltd and ARM Germany GmbH. All rights reserved.
    
    License Information:
    Grant B
    LIC=----
    
    Tool Version Numbers:
    Toolchain:        MDK-Lite  Version: 5.34.0.0
    Toolchain Path:    C:\Keil_v5_MDK\ARM\ARMCLANG\Bin
    C Compiler:         ArmClang.exe        V6.16
    Assembler:          Armasm.exe        V6.16
    Linker/Locator:     ArmLink.exe        V6.16
    Library Manager:    ArmAr.exe        V6.16
    Hex Converter:      FromElf.exe        V6.16
    CPU DLL:               SARMCM3.DLL          V5.34.0.0
    Dialog DLL:         TCM.DLL              V1.48.0.0
    Target DLL:             UL2CM3.DLL           V1.163.9.0
    Dialog DLL:         TCM.DLL              V1.48.0.0
    
    

    The Build log:

    
    µVision Build Log
    
    Tool Versions:
    
    IDE-Version: µVision V5.34.0.0
    Copyright (C) 2021 ARM Ltd and ARM Germany GmbH. All rights reserved.
    License Information: Grant B, , LIC=----
     
    Tool Versions:
    Toolchain:       MDK-Lite  Version: 5.34.0.0
    Toolchain Path:  C:\Keil_v5_MDK\ARM\ARMCLANG\Bin
    C Compiler:      ArmClang.exe V6.16
    Assembler:       Armasm.exe V6.16
    Linker/Locator:  ArmLink.exe V6.16
    Library Manager: ArmAr.exe V6.16
    Hex Converter:   FromElf.exe V6.16
    CPU DLL:         SARMCM3.DLL V5.34.0.0
    Dialog DLL:      DCM.DLL V1.17.3.0
    Target DLL:      UL2CM3.DLL V1.163.9.0
    Dialog DLL:      TCM.DLL V1.48.0.0
     
    Project:
    
    D:\Grant4\STM32\STM32_Keil_v5_MDK\Dog\Dog.uvprojx
    Project File Date:  07/19/2021
    
    Output:
    
    *** Using Compiler 'V6.16', folder: 'C:\Keil_v5_MDK\ARM\ARMCLANG\Bin'
    Rebuild target 'Target 1'
    compiling main.c...
    assembling startup_stm32f10x_md.s...
    RTE/Device/STM32F103C8/system_stm32f10x.c(167): warning: no previous extern declaration for non-static variable 'AHBPrescTable' [-Wmissing-variable-declarations]
    __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
                ^
    RTE/Device/STM32F103C8/system_stm32f10x.c(167): note: declare 'static' if the variable is not intended to be used outside of this translation unit
    __I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
        ^
    1 warning generated.
    compiling system_stm32f10x.c...
    linking...
    Program Size: Code=664 RO-data=252 RW-data=0 ZI-data=1632  
    ".\Objects\Dog.axf" - 0 Error(s), 1 Warning(s).
    
    Software Packages used:
    
    
    Package Vendor: ARM
                    http://www.keil.com/pack/ARM.CMSIS.5.8.0.pack
                    ARM.CMSIS.5.8.0
                    CMSIS (Common Microcontroller Software Interface Standard)
       * Component: CORE Version: 5.5.0
    
    Package Vendor: Keil
                    http://www.keil.com/pack/Keil.STM32F1xx_DFP.2.3.0.pack
                    Keil.STM32F1xx_DFP.2.3.0
                    STMicroelectronics STM32F1 Series Device Support, Drivers and Examples
       * Component: Startup Version: 1.0.0
    
    Collection of Component include folders:
    
      .\RTE\Device\STM32F103C8
      .\RTE\_Target_1
      C:\Users\GBeattie\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\Core\Include
      C:\Users\GBeattie\AppData\Local\Arm\Packs\Keil\STM32F1xx_DFP\2.3.0\Device\Include
    
    Collection of Component Files used:
    
    
       * Component: ARM::CMSIS:CORE:5.5.0
    
       * Component: Keil::Device:Startup:1.0.0
          Source file:   Device\Source\ARM\STM32F1xx_OPT.s
          Source file:   Device\Source\system_stm32f10x.c
          Source file:   Device\Source\ARM\startup_stm32f10x_md.s
          Include file:  RTE_Driver\Config\RTE_Device.h
    Build Time Elapsed:  00:00:00
    
    

    My screen shows (I expected GCC not to be defined for a Keil compiler):

    Suggestions on how I can conditionally compile for Keil versus GCC?

Children