fe6dd698c482de3680dada75e2c935ca6df03261
[simavr] / examples / board_simduino / README
1
2 This will emulate an arduino. Right now it loads the bootloader, then wait on it's "serial port"
3 (a UDP socket on port 4321) until someone programs it... eventualy it timesout and run the previous
4 app that was programmed.
5
6 To actualy program it, you need "socat" to make a bridge between avrdude and simavr.
7
8 % socat -d -d PTY UDP:localhost:4321
9         2009/12/24 16:19:26 socat[26974] N PTY is /dev/pts/10
10         2009/12/24 16:19:26 socat[26974] N opening connection to AF=2 127.0.0.1:4321
11         2009/12/24 16:19:26 socat[26974] N successfully connected from local address AF=2 127.0.0.1:48246
12         2009/12/24 16:19:26 socat[26974] N starting data transfer loop with FDs [3,3] and [6,6]
13
14 Once that bridge is setup, launch simduino:
15
16 % ./simduino
17         Starting atmega328 - flashend 7fff ramend 08ff e2end 03ff
18         atmega328 init
19         avr_flash_init init SPM 0057
20         read_ihex_file: ./ATmegaBOOT_168_atmega328.ihex, unsupported check type 03
21         Booloader 7800: 1950
22         uart_udp_init bridge on port 4321
23         UART-0 configured to 0010 = 58823 baud
24
25 What that is done, you have a few seconds to program it:
26
27 % avrdude -p m328p -c arduino -P /dev/pts/10 -U flash:w:atmega328p_dummy_blinky.hex
28
29         avrdude: AVR device initialized and ready to accept instructions
30         
31         Reading | ################################################## | 100% 0.01s
32         
33         avrdude: Device signature = 0x1e950f
34         avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
35                  To disable this feature, specify the -D option.
36         avrdude: erasing chip
37         avrdude: reading input file "atmega328p_dummy_blinky.hex"
38         avrdude: input file atmega328p_dummy_blinky.hex auto detected as Intel Hex
39         avrdude: writing flash (394 bytes):
40         
41         Writing | ################################################## | 100% 0.15s
42         
43         avrdude: 394 bytes of flash written
44         avrdude: verifying flash memory against atmega328p_dummy_blinky.hex:
45         avrdude: load data flash data from input file atmega328p_dummy_blinky.hex:
46         avrdude: input file atmega328p_dummy_blinky.hex auto detected as Intel Hex
47         avrdude: input file atmega328p_dummy_blinky.hex contains 394 bytes
48         avrdude: reading on-chip flash data:
49         
50         Reading | ################################################## | 100% 0.13s
51         
52         avrdude: verifying ...
53         avrdude: 394 bytes of flash verified
54         
55         avrdude: safemode: Fuses OK
56         
57         avrdude done.  Thank you.
58
59 simduino will display that:
60
61         Erasing page 0000 (128)
62         Writing page 0000 (128)
63         Erasing page 0001 (128)
64         Writing page 0001 (128)
65         Erasing page 0002 (128)
66         Writing page 0002 (128)
67         Erasing page 0003 (128)
68         Writing page 0003 (128)
69
70 And then jump to the program that was programmed. The example doesn't do anything useful, it's
71 a placeholder...
72
73 Michel Pollet <buserror@gmail.com>