10

I am working on STM32l151rct6a by stm, I have stumbled upon these MACRO definitions

__CC_ARM, __ICCARM__, __GNUC__, __TASKING__

Does anyone know what they mean?

saxbophone
  • 779
  • 1
  • 6
  • 22
Ishmeet
  • 1,540
  • 4
  • 17
  • 34

3 Answers3

14

These are different compilers for ARM processors, probably these macros are used to hide compiler-dependent stuff in code that's compilable by several compilers.

fvu
  • 32,488
  • 6
  • 61
  • 79
  • __CC_ARM -->[Description](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0282b/Babbacdb.html) – Abdurahman Jul 11 '13 at 09:59
  • Imagecraft's macros are `__IMAGECRAFT__` and `__ICC_VERSION`. `__ICCARM__` appears to be IAR. – Clifford Jul 11 '13 at 15:51
  • @Clifford thanks for the heads up, I will correct the answer. Regarding `__ICC_VERSION__`, I can't immediately find that one in [the documentation](https://www.imagecraft.com/help/iccarm/wwhelp/wwhimpl/js/html/wwhelp.htm) – fvu Jul 11 '13 at 16:06
  • In the [PDF manual](https://www.imagecraft.com/help/iccv8cortex/ICCCORTEX.pdf) page 56. – Clifford Jul 11 '13 at 19:41
  • @Clifford Okay I see, the online doc I was referring to is quite old whereas the PDF you point to documents version 8. – fvu Jul 11 '13 at 20:10
  • Most browsers no longer support ftp links, so the IAR documentation link above is now effectively broken. Here's an up-to-date https URL: https://wwwfiles.iar.com/arm/webic/doc/ewarm_developmentguide.enu.pdf – AJM May 30 '22 at 15:33
  • 1
    @AJM thanks for keeping the content fresh, edited the answer. – fvu May 31 '22 at 07:49
  • @fvu thanks. If you've got enough rep for a < 6 character edit, the gcc and tasking links now have https versions. – AJM May 31 '22 at 09:27
  • 1
    @AJM done. The RealView link is broken and I don't have the time right now to dig up an updated link, so I marked it broken. – fvu Jun 02 '22 at 09:08
2

They are macros for identifying the compiler being used to build the code.

A list of such macros, and others for identifying architecture and OS etc. can be found at http://sourceforge.net/p/predef/wiki/Home/. It does not however comprehensively cover many compilers from smaller embedded systems vendors (Tasking and Imagecraft for example).

Clifford
  • 88,407
  • 13
  • 85
  • 165
1

These are compiler specific MACROS and defined in compiler code.For example __ICC is for IAR and __GNU is for GNU compilers.There are some code given in BSP part for STM platform which have dependency on compilers.

Dayal rai
  • 6,548
  • 22
  • 29
  • According to http://sourceforge.net/p/predef/wiki/Compilers/ IAR is identified by __IAR_SYSTEMS_ICC__. Another answer here suggests Imagecraft C for _ICC which sounds plausible. – Clifford Jul 11 '13 at 09:45
  • @Clifford Line `#elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */` on [This Link](http://asf.atmel.com/docs/latest/sam.drivers.usart.usart_synchronous_example.sam3u_ek/html/compiler_8h_source.html) and [This link](http://www.lpcware.com/content/forum/usb-library-iccarm-definition) Talks about IAR only. – Dayal rai Jul 11 '13 at 09:49
  • @Dayalrai: Indeed - there is no standard, IAR and Imagecraft may have both used this, the other answer may be incorrect and the Sourceforge wiki may be incomplete or contain errors. Always use such macros with caution. – Clifford Jul 11 '13 at 15:43
  • The other answer was incorrect - Imagecraft use `__IMAGECRAFT__` [says the manual](https://www.imagecraft.com/help/iccv8cortex/ICCCORTEX.pdf). They do have another `__ICC_VERSION` which may cause confusion. – Clifford Jul 11 '13 at 15:47
  • @Clifford Thanks for more clarity and reliable links on this thread. – Dayal rai Jul 11 '13 at 16:30
  • @dayalrai talking about links, how about a link to that BSP code you're referring to? – fvu Jul 11 '13 at 21:54
  • @fvu i am not sure what are you asking for.But may be [this link](https://github.com/kapusy/stm32/blob/master/stm32server/cmsis/core_cm3.c) will throw some light. – Dayal rai Jul 12 '13 at 05:20
  • @dayalrai thanks, great - that source confirms that `__CC_ARM` is actually RealView. – fvu Jul 12 '13 at 09:22