cancel
Showing results for 
Search instead for 
Did you mean: 

__CC_ARM and __ARMCC_VERSION regarding __attribute__

DS.4
Senior II

In the example projects there is no dedicated __ARMCC_VERSION (ARM compiler V6).

file: stm32_wpan_common.h, in the BleHeartRateRTOS example

#if defined ( __CC_ARM )
  #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050U)  //We never get here! jumping to gcc
    #define PACKED__ __attribute__((packed))
    #define PACKED_STRUCT struct PACKED__
  #else
    #define PACKED__(TYPE) __packed TYPE
    #define PACKED_STRUCT PACKED__(struct)
  #endif
#elif defined   ( __GNUC__ )
  #define PACKED__ __attribute__((packed))
  #define PACKED_STRUCT struct PACKED__
#elif defined (__ICCARM__)
  #define PACKED_STRUCT __packed struct
#else
  #define PACKED_STRUCT __packed struct
#endif

Best case, it is hiding under __CC_ARM (ARM compiler V4/5), sometimes like in the PLACE_IN_SECTION it is not even under a define.

There are differences between compilers regarding the __attribute__ keyword as specified in :

https://www.keil.com/support/man/docs/armclang_mig/armclang_mig_chr1398848377314.htm

issue:

1. The code is forcing me to use gcc (__GNUC__) when I have __ARMCC_VERSION (ARM compiler V6).

2.How do I translate it to the __ARMCC_VERSION (ARM compiler V6) ?

3.PLACE_IN_SECTION does not work in __ARMCC_VERSION (ARM compiler V6) , gives different final addresses to variables.

PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static TL_CmdPacket_t BleCmdBuffer;

Why is that?

0 REPLIES 0