Variables Inside ISR are not Visible/Set Outside ISR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Variables Inside ISR are not Visible/Set Outside ISR

1,812 Views
Adam
Contributor III

I am using Codewarrior 7.1.1 for MCF5232

 

I have an ISR, that calls a static method in a C++ Class.  The method is called, does some stuff, sets an unsigned char to TRUE (1) and exits.  The unsigned character have been declared as both a volatile static member variables and tried as a volatile global variable.  Code shows that it is actually set when debugging.  Later code uses this form the class to access the static member or global variables and finds that they are set to FALSE (0).

 

I have looked at the assembly and it seems right.  The code seems right.  Can anyone make any recommendations on what I am missing?

Labels (1)
0 Kudos
Reply
5 Replies

1,084 Views
martinw
Contributor III

is it a cache problem?  try flushing the cache after you write the variable inside the ISR.

 

0 Kudos
Reply

1,084 Views
Adam
Contributor III

I guess it could be.  How do you flush the cache?  And even so, wouldn't volatile remove caching anyway?

 

I should also note, reading the variables I made in a critical sectio.  And the code that reads the variables is called every 5ms every time the highest priority tasks gets marked ready to run again.

0 Kudos
Reply

1,084 Views
martinw
Contributor III

not sure on the coldfire, someone else will have to answer that.

 

have you enabled cacheing?  if so, try disabling it just to see if the problem goes away.

0 Kudos
Reply

1,084 Views
Adam
Contributor III

The problem turned out to be Instruction Scheduling.  I decided to look at CW 6.4 and the problem didn't exist.  So I turned off each of Peephole, Instruction Scheduling and Register Coloring to see what would happen.  instruction scheduling is the culprit.

 

Should I write up a bug report on this.  This is for 7.1.1, this is still a defect in 7.1.2 and the enum defect still exists in 7.1.2.

0 Kudos
Reply

1,084 Views
J2MEJediMaster
Specialist I

Yes, submit a report. Click here to do that. Also, you will want to include your source code so that they can duplicate the problem.

 

---Tom

0 Kudos
Reply