Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrote a README file to describe how to get started on Mac OS X and Li…
…nux.
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ | ||
|