Bugs in simulator ??? or just me.

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm single stepping through a section of code because it did not do what I expected.

 

I wrote some code to save SREG before disabling interrupts. However, the SREG value did not transfer to my backup register as expected.

 

So I started single stepping through the Disassembly code at the point where SREG contents should be getting transferred to my backup register.

 

The particular disassembly line is:

 

                         SREG_TEMP_STORE = SREG;

000000D8    IN R6,0x3F        In from I/O location 

 

When I single step this line, R6 goes from 0x00 to 0x02, yet SREG shows a value of 0x82 (before and after that line was executed).

 

Likewise my SREG_TEMP_STORE variable gets the value 0x02, and not the SREG value 0x82 that I was expecting.

 

But it gets more strange. Although SREG has the value 0x82 next to it, which is 0b10000010, the SREG bits (in the I/O box) are showing 10000001, which is 0x81 

 

SREG bits in the I/O box disagree with the SREG bits in the Processor Status box, which shows 10000010, which correctly matches the shown 0x82

 

So, assuming 0x82 is the SREG correct value, it appears the simulator is not reading the "I" bit in SREG, when it exectues that disassembly line.

 

Is there something I just don't get or does this look like a bug in the simulator.

 

Keith.

 

 

Attachment(s): 

Last Edited: Sat. Apr 6, 2019 - 09:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Artandsparks wrote:
Is there something I just don't get
An option in the debugger settings. It says something along the lines of "mask interrupts while single stepping", and apparently you have that "on" (which is the default, I think).

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks so much Stefan.

 

I'm so happy the problem was me and not Atmel Studio.

 

That setting was enabled so I turned it off and the code ran as expected.

 

Mind you I'll have to watch out in the future for that discrepancy between the I/O box and the Processor Status box, with the SREG bits showing differently. I'm guessing the Processor Status box is the more "updated" one.

 

Keith