alichan
Junior Member
Offline
Posts: 94
Thank You
-Given: 28
-Receive: 88
|
|
« on: February 28, 2019, 05:44:47 17:44 » |
|
Hello.
Surely when debugging with Proteus you have noticed the message "Format (-1) not valid for type (0x00000000)" in CPU variables or watch windows. I looked in the documentation, general search on Internet but couldn't find anything.
Do you know why or the reasons this message appears with some variables ?
It happens mostly with anidated structs (C language), deferencing some pointers, bitfields, etc. but not with all of them. I cannot find the reason of such message, what pattern it follows since in some cases you can see variables correctly and not in others, or any documentation about it, and doesn't help to debug since you cannot see the variable contents (and I have enough with the apparent Proteus limitation to show 32-bit variables).
As workaround after some tries, I found that if you create a (global) pointer of same type of the variable you want to see, then assign the variable address to the pointer, even if the pointer is not used (use volatile to avoid the optimizer removing it), Proteus will show the correct variable contents in any variable of the same type, even not referenced. Creepy...
Example (forget syntactic correction in example, it's not relevant here):
struct ex1 { ... }
struct EX2 { struct ex1 test; int test2; } ex2;
If you expand ex2 while debugging, it will show "Format (-1) ...". Now if you
volatile struct EX2 test * debug_test = & ex2;
It will show correctly ex2 contents (but chances are not ex1, and you have to do the same with the inner struct).
I'm insterested on any experience you had with this... Cheers mates.
|