Watching four registers as a uint32_t variable?

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

hi,

 

in the simulator/debugger mode (AStudio 6.1) you can add globally declared variables, is it possible to do the same with a set of registers? E.g. if I'm writing in assembly and using r20-r23 for an unsigned long and I want to watch them as if it were a globally declared variable, i.e. not as four separate byte registers?

 

thanks

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

I suppose there is the "Processor" tab but that just shows you R0..R31 individually.

 

The MS debugger itself supports "modifiers" that allow you define how a watch should be interpreted. That works in C but I don't know if the same thing can be applied when you are using Atmel Asm 2.

 

Off to try an experiment...

 

(BTW the very mention of uint32_t in your thread title makes me wonder "why not just use C and the C debugger?")

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

OK it appears I can do what I was hoping but not quite in the way I had hoped. The main one here is the watch window. I'm simply relying on the fact that R16 also appears in the AVR RAM map at 0x0010:

 

 

But as you can see you can see it in the processor view and also in a "memory" window if you set the address to 0x0000 where R0..R31 appear before everything else.

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

hi,

I tried to write in a watch field r16+r17+r18+19, it does not combine the registers to a unsigned long, rather sums them up to an unsigned int. But then I tried:

(r19*16777216)+(r18*65536)+(r17*256)+r16, and it worked. Now I can watch the registers as an unsigned long.

 

This is especially useful when programming in assembly.

 

It would be even better if there would be a second name field in the watch window so that you could give the grouped registers a normal name. For now you can specify it like this: /*fictional variable name*/, e.g. /*VARIABLE*/(r19*16777216)+(r18*65536)+(r17*256)+r16.

 

(BTW the very mention of uint32_t in your thread title makes me wonder "why not just use C and the C debugger?")

The C debugger? Is the simulator not a C and C++ debugger?

Last Edited: Sat. Mar 28, 2015 - 04:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess I wasted my time preparing that screen dump with the obvious solution? Ho hum. 

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

darn, I forgot that the registers are "mirrored" at the beginning of data IRAM... 

 

clawson wrote:

I guess I wasted my time preparing that screen dump with the obvious solution? Ho hum. 

 

Nope, your solution is shorter and simpler.

 

thanks!