Kevin Brammer

variable not allocated + variables dont refresh

Discussion created by Kevin Brammer on Apr 24, 2012
Latest reply on May 22, 2012 by RICK BOURGEOIS

Hey Guys,


i am using a MC9S12x and corewarrior 5.9.0.


i got two questions:


first one is: ALL variables that are declared in a function (and not global) get greyed out while debugging "not allocated". I need to attach "volatile" before every single one. Example:


void myfunction(void){ int i = 0; for (i=0;i<10;i++) {          //here is some very very important code reading temperature from a sensor(IIC), to regulate a system, setting i/o ports for the heating etc.        }}

 what happens: i is greyed,"not allocated" the whole loop is skipped totally.  nothing happens. why the f*** is this happening? why do i need to write volatile before EVERY single variable?? this is annoying and make the code slow... another example:


main(){ int i = 3; int k = 0; if (i == 3) {  k = 5; }...}

 the if is totally ignored and not processed at all. i think "optimisation" is a bit over aggressiv isn´t it? i mean... skipping the whole code really makes the code run very very fast! :smileyvery-happy:



next problem: my programm runs smooth (i use volatile before every variable now). but in the debugger my variables aren´t updated although i set the mode to automatic, or periodic. they are only updated in the moment my programm is stopped or restarted (they refresh once at both times) i tried to use the manual refresh button. no function here too. if i set a watchpoint to the variable, the programm stops, as it should and the variable is updated. so i can garuantee my programm passes this point over and over (still reading the temperature via iic). how do i see my variable in realtime? this is really important to test my regulation system... cant click every second to restart the program and see my variables updated.




hope you guys can help me.