Ocean Mist

15 Nov 2008

Adventures in embedded computing

Posted by astromme

Atmel makes a cheap ($30) usb development board. I’m working on a final project for E5 (more about that later) and in doing so needed a board that I could program. Interestingly, avr, the type of chip that I would be using, has a full gcc port and associated development environment. The board can be found here:

http://www.atmel.com/dyn/products/tools_card.asp?family_id=655&family_name=USB+Controllers&tool_id=3879

After an hour or so of hacking around with eclipse, avr-gcc and various websites (http://www.avrfreaks.net is great!) and tutorials, I now have an eclipse project that crossbuilds. Using avrsimul I can simulate the processor and run code (and gdb!) on my laptop before I even have the board. So far, I’ve succeeded in setting up avrsimul and hooking in gdb with a simple blinking hello-world program. Unfortunately, there is no way for me to tell if the blinking code is actually working, as I lack the hardware. But anyways, here was the joy of the morning:


astromme@Thor:~/Projects/Eclipse/avr-hello/Debug$ avr-gdb
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=x86_64-linux-gnu --target=avr".
(gdb) file avr-hello.elf
Reading symbols from /home/astromme/Projects/Eclipse/avr-hello/Debug/avr-hello.elf...done.
(gdb) target remote localhost:1212
Remote debugging using localhost:1212
0x00000000 in __vectors ()
(gdb) load
Loading section .text, size 0x19c lma 0x0
Start address 0x0, load size 412
Transfer rate: 1648000 bits/sec, 137 bytes/write.
(gdb) break main
Breakpoint 1 at 0xbc: file ../src/blinky.cpp, line 21.
(gdb) continue
Continuing.

Breakpoint 1, main () at ../src/blinky.cpp:21
21 int main(void){
(gdb) cont
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x0000008e in stupid_sleep (time=25) at ../src/blinky.cpp:14
14 for(j=0;j<530;j++){
(gdb)

The simulator showed this:


main.c:415: MESSAGE: Simulating clock frequency of 8000000 Hz
Waiting on port 1212 for gdb client to connect...
Connection opened by host 127.0.0.1, port -28232.
decoder.c:737: MESSAGE: BREAK POINT: PC = 0x0000005e: clock = 29

Now on to actually getting the hardware.

Tags: , , , , ,

Leave a Reply

Message: