Reputation: 571
Solved.
I was trying to control the value of a variable in IAR Embedded Workbench (working with STM32F303xC microcontroller). I declared the variables in the library.h files as:
extern int my_variable1;
extern float another_variable //... etc
Then in library.c
int my_variable1 = 15;
float another_variable = 328.47;
In main.c
my_variable1 = 38;
another_variable = pow(10,2) + another_variable/8
But in watch, live watch and quick watch it rises the error : (column 1) Unknown or ambiguous symbol.
I wrote several programs with this IDE and the declaration of static variables worked and it allowed me to see the variable's value using the watches. In other programs i declared the variable as
int my_variable1;
In the main file, outside the main function and it worked too.
How can i solve this error?
As far as we go, it seems the the real question is:
There is a way to show in IAR Embedded Workbench the value of variables shared between .c-s?
Upvotes: 0
Views: 6559
Reputation: 571
The IDE Embedded Workbench, as form of optimization, doesn't allocate the variables that are declared but not used. So those variables cannot be showed in the watches.
Upvotes: 3
Reputation: 16223
The problem is that you declare the variable static.
This means you will have a discrete copies of those variable for each file that #include
the hedaer file.
I guess that static watch work as far as you are breaking execution inside a specific function files. It will show you the local scoped copy of variable.
Upvotes: 1