Skip to content

Commit

Permalink
Wrote a README file to describe how to get started on Mac OS X and Li…
Browse files Browse the repository at this point in the history
…nux.
  • Loading branch information
njh committed Mar 7, 2012
1 parent 69dcb24 commit f614247
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions README.md
@@ -0,0 +1,88 @@
nanode-flash-led
================

This is a basic pure-C program to flash the red LED on the [Nanode]. I have created it a
starting point to help people write pure-C for their [Nanode].



Getting started on Mac OS X
---------------------------

I personally use [Homebrew] on my Mac but unfortunately it doesn't include avr-gcc in the main git repository. However you can use the formulas from [Lars Immisch] directly:

brew install avrdude
brew install https://raw.github.com/larsimmisch/homebrew-alt/master/avr/avr-binutils.rb
brew install https://raw.github.com/larsimmisch/homebrew-alt/master/avr/avr-gcc.rb
brew install https://raw.github.com/larsimmisch/homebrew-alt/master/avr/avr-libc.rb

Alternatively, you could try following these instructions:
http://www.ladyada.net/learn/avr/setup-mac.html

There are lots of other tutorials on Google.

Once you have done that check which serial port your Nanode is using:

ls /dev/tty.*

Then edit the *SERIAL_PORT* definition in the Makefile.

You can then compile the binary:

$ make
avr-gcc -mmcu=atmega328p -DF_CPU=16000000UL -Wall -W -Os -o nanode-flash-led.o -c nanode-flash-led.c
avr-gcc -mmcu=atmega328p -Wl -o nanode-flash-led.elf nanode-flash-led.o
avr-objcopy nanode-flash-led.elf -j .text -j .data -O ihex nanode-flash-led.hex
avr-size nanode-flash-led.elf
text data bss dec hex filename
214 0 0 214 d6 nanode-flash-led.elf

And then upload it to your Nanode:

$ make load
avrdude -q -P /dev/tty.usbserial-A700fbtR -c arduino -b 57600 -p atmega328p -e -U flash:w:nanode-flash-led.hex

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f
avrdude: erasing chip
avrdude: reading input file "nanode-flash-led.hex"
avrdude: input file nanode-flash-led.hex auto detected as Intel Hex
avrdude: writing flash (214 bytes):
avrdude: 214 bytes of flash written
avrdude: verifying flash memory against nanode-flash-led.hex:
avrdude: load data flash data from input file nanode-flash-led.hex:
avrdude: input file nanode-flash-led.hex auto detected as Intel Hex
avrdude: input file nanode-flash-led.hex contains 214 bytes
avrdude: reading on-chip flash data:
avrdude: verifying ...
avrdude: 214 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.



Getting started on Debian
-------------------------

Install the AVR compiler and programmer:

$ apt-get install gcc-avr binutils-avr avr-libc avrdude

Check which port your Nanode serial port is connected to:

$ dmesg | grep ttyUSB
[13813.441251] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0

Then edit the *SERIAL_PORT* definition in the Makefile:

SERIAL_PORT = /dev/ttyUSB0

THen follow the compilation instructions above.


[Homebrew]: http://mxcl.github.com/homebrew/
[Lars Immisch]: http://github.com/larsimmisch
[Nanode]: http://nanode.eu/

0 comments on commit f614247

Please sign in to comment.