Pikir dan Rasa

cogito ergo sum

ATMEL AVR, SimulAVR, avr-gdb, DDD [snippets, raw]

leave a comment »

Pada post sebelum ini saya telah mensarikan cara penggunaan Eclipse untuk debugging pada software uC AVR.  Tulisan kali ini hanya berisi catatan perintah-perintah (command) Simulasi untuk mikrokontroller Atmel AVR. Perintah-perintah berikut ini tidak berurutan, hanya merupakan suatu kumpulan.

]>> Perintah-perintah simulavr:

$ simulavr -L

$ simulavr –device atmega8 –gdbserver

$ simulavr -d atmega8 -g

$ simulavr –device atmega16 –gdbserver

$ simulavr -d atmega16 -g

$ simulavr –device atmega16 –gdbserver -P simulavr-disp

$ simulavr -d atmega16 -g  -P simulavr-disp



 

 

]>> Perintah-perintah DDD (program yang akan saya debug=>blinked):

$ ddd –debugger avr-gdb 

(gdb) file /home/sunu/workspace/blinkled/Debug/blinked.elf

(gdb) target remote localhost:1212

(gdb) load

(gdb) break main.c:9

(gdb) step

(gdb) next

(gdb) continue

 

]>> Perintah-perintah gdb (program yang akan saya debug=>blinked):

$ avr-gdb 

$ /usr/local/avr/bin/avr-gdb

(gdb) file /home/sunu/workspace/blinkled/Debug/blinked.elf

(gdb) target remote localhost:1212

(gdb) load

(gdb) break main.c:9

(gdb) step

(gdb) next

(gdb) continue

 

Contoh hasil tampilan debugging dengan avr-gdb di terminal

(untuk blog ini teks sengaja saya beri warna) :


~/workspace/blinkled/Debug$ /usr/local/avr/bin/avr-gdb

GNU gdb (GDB) 7.3

Copyright (C) 2011 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type “show copying”

and “show warranty” for details.

This GDB was configured as “–host=i686-pc-linux-gnu –target=avr”.

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/&gt;.

(gdb) file blinkled.elf

Reading symbols from /home/sunu/workspace/blinkled/Debug/blinkled.elf…done.

(gdb) target remote localhost:1212

Remote debugging using localhost:1212

0x00000000 in __vectors ()

(gdb) load

Loading section .text, size 0x116 lma 0x0

Start address 0x0, load size 278

Transfer rate: 22 KB/sec, 30 bytes/write.

(gdb) break main.c:9

Breakpoint 1 at 0x90: file ../main.c, line 9.

(gdb) continue

Continuing.


Breakpoint 1, main () at ../main.c:9

9 for(int i = 1; i<10;i=i+4){

(gdb) next

10 PORTD = ~i;

(gdb) 

 

catatan tambahan >>

avr-libc:

#include <avr/io.h>

#include <util/delay.h>

#include <util/delay_basic.h>

 

Ref:
http://www.linuxjournal.com/article/7289
http://chromiteblue.com/ 
http://www.nongnu.org/simulavr/
www.gnu.org/s/gdb/ 
http://www.nongnu.org/avr-libc/ 
www.gnu.org/s/ddd/
 

Written by sunupradana

September 23, 2011 at 8:16 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: