This can happen when anonymous union or anonymous struct is used in IAR environment.
In the IAR compiler, member variables of anonymous union or anonymous struct can be accessed and used like global variables.
Due to this, an error occurs in which certain variables cannot be found when analyzing in Controller Tester.
Member variables of anonymous union and anonymous struct must be added as global variables in order to save the meaning of the special syntax of IAR.

How to add a global variable is as follows.

  • ‘Preferences’ > ‘Toolchain’ > ‘edit’ After selecting the toolchain > ‘Predefined declaration’ > Add variable declaration to ‘Built-in declaration’

Example of using IAR anonymous union

__no_init volatile
union
{
 unsigned char IOPORT;
 struct
 {
 unsigned char way: 1;
 unsigned char out: 1;
 };
} @ 0x1000;
/* The variables are used here. */
void Test(void)
{
 IOPORT = 0; // Use union member variables like global variables
 way = 1; // Use struct member variables like global variables
 out = 1; // Use struct member variables like global variables
}

Global variable added to the toolchain

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.