First thanks for a fantastic program of high quality :-)
After hours of surfing and work to get C:B working as an AVR development environment I am nearly succeding.
My system:
A PC running Ubuntu Gutsy
latest C:B in Ubuntu repository : svn 5020
An Atmel AVR JTAG MkII
A self developed AVR board with an AT90CAN128.
gcc version 4.1.2
GNU gdb 6.4
AVaRICE version 2.6, Jul 20 2007 11:53:13
I can generate a project example with a small program and compile it, the program is running a flashing LED.
I can program the processor fuses with the command
avarice -2 -r -B 125Khz -W eehhll -j usb ( ee extended buse byte, hh high fuse byte, ll low fuse byte )
$ avarice -2 -r -B 125Khz -W fd39ce -j usb
I can flash the AVR program made by C:B with the command:
$ avarice -2 -P at90can128 -e -p -f can_io.bin -v -j usb
And I can debug the program, first starting avarice in one terminal and avr-gdb in another:
$ avarice -2 -P at90can128 -B 4Mhz -j usb localhost:4242
AVaRICE version 2.6, Jul 20 2007 11:53:13
JTAG config starting.
Found a device: JTAGICEmkII
Serial number: 00:a0:00:00:06:5d
Reported JTAG device ID: 0x9781
Configured for device ID: 0x9781 at90can128 -- Matched with at90can128
JTAG config complete.
Preparing the target device for On Chip Debugging.
Disabling lock bits:
LockBits -> 0xff
Enabling on-chip debugging:
Extended Fuse byte -> 0xfc
High Fuse byte -> 0x39
Low Fuse byte -> 0xce
Waiting for connection on port 4242.
and in the other terminal:
$ avr-gdb can_io.elf
(gdb) target remote localhost:4242
(gdb) break main
Breakpoint 1 at 0x188: file ../main.cpp, line 12.
(gdb) continue
Continuing.
Breakpoint 1, main () at ../main.cpp:12
12 a = 2;
(gdb) continue
Continuing.
<\ctrl-c> key pressed to interrupt the program, which runs as expected
Program received signal SIGINT, Interrupt.
0x00000104 in delay_us (us=33675) at ../delay.cpp:10
10 for ( count = 0; count < us; count ++ )
(gdb) q
The program is running. Exit anyway? (y or n) y
[1]+ Killed avr-gdb can_io.elf
$
So no issues so far.
In codeblocks I use this setup for the debugger:
target remote localhost:4242
load
break main
continue
and the "Do not run the debugee" is checked.
When I activate the debugger in codeblocks, the avarice terminal responds:
Connection opened by host 127.0.0.1, port 59395.
The debugger tab shows:
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: /home/ekh/develop/conlog/can_io/sw/trunk/can_io/
Adding source dir: /home/ekh/develop/conlog/can_io/sw/trunk/
Adding file: bin/Debug/can_io.elf
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.4
In __vectors () ()
The Debugger (debug) tab shows:
LD_LIBRARY_PATH=.:
Command-line: /usr/bin/avr-gdb -nx -fullname -quiet -args bin/Debug/can_io.elf
Working dir : /home/ekh/develop/conlog/can_io/sw/trunk/can_io/
(gdb)
> set prompt >>>>>>cb_gdb:
Executing: xterm -T 'Program Console' -e sleep 90014
>>>>>>cb_gdb:
> show version
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i486-linux-gnu --target=avr".
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set disassembly-flavor intel
No symbol "disassembly" in current context.
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
>>>>>>cb_gdb:
> target remote localhost:4242
load
break main
continue
Executing: ps x -o tty,pid,command
0x00000000 in __vectors ()
The debugger does not stop at main and show the current location arrow.
After quitting the debugger in codeblocks, the program is no longer present in the AVR.
When terminating a debug session in AVRStudio from atmel, the program is intact for running.
In the manual gdb session the avarice program responded
Connection opened by host 127.0.0.1, port 58839.
In the codeblocks session it responded:
Connection opened by host 127.0.0.1, port 59395
Any ideas to get the debugger work in codeblocks, what am I missing ?
[EDIT] corrected extended fuse byte from 0xFC to 0xFD (no factory test)