I am having trouble debugging a piece of code that used to work. I using
avr-gcc (GCC) 3.4.1 with AVR Studio 4.10.356 as my debugging tool
dwarf-2. I have the following code which is not working. The listing
shows Room1 as it should but in AVR Sutdio it does not show up correctly
and hence my switch code fails. What actually shows in the Room1 array
varies greatly. Something it looks like all 0s sometimes it looks like
wide characters ie a letter followed by a 0. what am I doing wrong. I
know I had this code working fine a couple of weeks ago before my
Hbridge problems. I had single stepped through all of it and then
pointer was working fine.
volatile const uint8_t * TargetPointer;
#define TARGET_FLFLB 25
#define TARGET_LFLB 24
#define ACTION_STRAIGHT 70
#define ACTION_TURNRIGHT 65
#define ACTION_STOP 68
const uint8_t Room1[] ={
ACTION_STRAIGHT,
TARGET_FLFLB,
ACTION_TURNRIGHT,
TARGET_LFLB,
ACTION_STOP,
};
uint8_t TempPointer;
TargetPointer = &Room1[0];
TempPointer = *TargetPointer;
switch (TempPointer)
do code based on action
--listing
17 .Ltext0:
18 .global Room1
19 .data
22 Room1:
23 0000 46 .byte 70
24 0001 19 .byte 25
25 0002 41 .byte 65
26 0003 18 .byte 24
27 0004 4A .byte 68Message
Having trouble debugging a piece of code.
2005-02-07 by wbounce
Attachments
- No local attachments were found for this message.