Problem with cross compiler?
Mark Palmerino
mbp@csr-bos.com
Tue Mar 6 11:19:00 GMT 2001
Hi everyone,
I'm back :-(
I sent the following post to a couple of email groups related to the 68332
chip I'm using (e.g., 68332ABB and robominds). I wanted to also send it here
because I think the ultimate problem has to do with the cross-compiler I
built and because I'm hoping the collective wisdom and experience inherent
in this group will give me some insight.
Please note the curious bug-squashing effect of adding a 'printf' to the
program!
Thanks in advance for any help you can provide.
Mark
------------------------- post -------------------------
First, thanks James for the response - I appreciate it.
I have learned a few more things since my last post. I was busy rebuilding
the lcd functionality and created a function called lcd_putchar that just
sends one character to the LCD, as in:
lcd_putchar('a');
This worked fine.
Then I build a lcd_print function which takes a string and, of course, calls
lcd_putchar. Here is an example invocation:
lcd_print("some string");
Once I added this to my program, it bombed just like when I tried to use the
lcd routines that came with the MRM board. Here is the output when it bombs:
Exception: Address Error
Format/Vector=C00C
SSW=00D6 Fault Addr.=00090EB7 Data=00007FEC Cur. PC=00090120 Cnt.
Reg.=0001
PC =00090126 SR =2704=TR:OFF_S_7_..Z.. VBR =00000000
SFC =5=SD DFC =5=SD USP =0000FC00 SSP* =00007FD4
D0 =00000000 D1 =01D8FFFF D2 =00000000 D3 =00000000
D4 =00000000 D5 =00000000 D6 =00000000 D7 =00000000
A0 =00003166 A1 =0000315E A2 =00003162 A3 =00000000
A4 =00000000 A5 =00000000 A6 =00007FF8 A7 =00007FD4
00090126 48780000 PEA.L ($0).W
I had an insight at this point - the change I made to the program was to
reference a string like this: "some string". Maybe there is some problem
with that.
To test that, I did the following four things:
First, I built the string up in the following fashion:
someString[0] = 's';
someString[1] = 'o';
someString[2] = 'm';
...and so on and ended with a NULL - '\0'.
When I called the routine with:
lcd_print(someString);
It worked.
Second, I tried using a strcpy to set someString, as in:
strcpy(someString, "some string");
and then called:
lcd_print(someString);
and it bombed in the same way as above.
Third, I tried putting a printf statement in the program. When I did, the
program worked!
Finally, I took the lcdtest.c file (without a printf) and compiled it under
xgcc using a windows emulator on my Mac and downloaded it to the board. That
*worked*, too.
So, my conclusion is that there is something wrong with the way my
cross-compiler is putting stuff together which is causing the crashes when I
try to use strings unless I also link in code associated with printf.
I don't suppose anyone has come across anything like this before or can look
at the following output and help me determine what I can do to rectify my
cross-compiler?
Exception: Address Error
Format/Vector=C00C
SSW=00D6 Fault Addr.=00090EB7 Data=00007FEC Cur. PC=00090120 Cnt.
Reg.=0001
PC =00090126 SR =2704=TR:OFF_S_7_..Z.. VBR =00000000
SFC =5=SD DFC =5=SD USP =0000FC00 SSP* =00007FD4
D0 =00000000 D1 =01D8FFFF D2 =00000000 D3 =00000000
D4 =00000000 D5 =00000000 D6 =00000000 D7 =00000000
A0 =00003166 A1 =0000315E A2 =00003162 A3 =00000000
A4 =00000000 A5 =00000000 A6 =00007FF8 A7 =00007FD4
00090126 48780000 PEA.L ($0).W
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list