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.
6 To actualy program it, you need "socat" to make a bridge between avrdude and simavr.
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]
14 Once that bridge is setup, launch simduino:
17 Starting atmega328 - flashend 7fff ramend 08ff e2end 03ff
19 avr_flash_init init SPM 0057
20 read_ihex_file: ./ATmegaBOOT_168_atmega328.ihex, unsupported check type 03
22 uart_udp_init bridge on port 4321
23 UART-0 configured to 0010 = 58823 baud
25 What that is done, you have a few seconds to program it:
27 % avrdude -p m328p -c arduino -P /dev/pts/10 -U flash:w:atmega328p_dummy_blinky.hex
29 avrdude: AVR device initialized and ready to accept instructions
31 Reading | ################################################## | 100% 0.01s
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.
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):
41 Writing | ################################################## | 100% 0.15s
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:
50 Reading | ################################################## | 100% 0.13s
52 avrdude: verifying ...
53 avrdude: 394 bytes of flash verified
55 avrdude: safemode: Fuses OK
57 avrdude done. Thank you.
59 simduino will display that:
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)
70 And then jump to the program that was programmed. The example doesn't do anything useful, it's
73 Michel Pollet <buserror@gmail.com>