I am working on an embedded device, and there is some code that was originally compiled using the IAR compiler.
I am trying to recompile said code using the GCC compiler.
There is a particular statement: typedef __IO
, which simply doesn't get compiled ("Unrecognized symbol error").
Could anyone suggest how I could get this statement to compile properly?
If it is not recognised it will be because an appropriate system header containing the definition has not been included.
It will be defined in the chip support header file provided with the toolchain. It is type qualifier, or rather a macro (#define
) that will expand to a type qualifier. It is used for example as follows:
__IO uint8_t CSSR;
Here uint8_t
is the type, so __IO cannot in fact be a typedef
because it is not used where a type is valid. The __IO macro expands to whatever the particular compiler requires to ensure correct I/O access and addressing. In the typical case where I/O is memory mapped, it will simply expand to volatile
since all I/O should be declared volatile to ensure explicit accesses are not optimised out.
If you want to be sure, download a demo version of the IAR tools and take a look in the header files at how it is defined for your particular architecture. Otherwise you might just use #define __IO volatile
_IO meaning volatile as per in C language...which will not optimize the code and in which value stated for the variable using _IO will be unpredictable or will be changing without knowledge of compiler and user
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With