Build/Install Guide

Feel free to ask question about how to Build/Install, especially for Linux/Mac users it may not go through that smoothly.
Send email to wn@csie.ntu.edu.tw or come to lab424.

README First

  • Before starting
    • Zigduino is an AVR architecture microcontroller platform, in short, the hardware.
    • Nano-RK is a reservation-based real-time operating system, in short, the OS.
  • How to program on the zigduino with nano-RK as its OS?
    • Build/Install the cross-compiler tool-chain (see below for detail) which include
      • linker, assembler, library, compiler, programmer…
    • Get the source code of nano-RK.
    • Write the program with nano-RK as the os.
    • Compile it with the cross compiler.
    • Upload it with the programmer.
    • The program will start to run itself as the zigduino board is powered.
  • How to communicate between the zigduino and my PC?
    • Connect it w/ pc via usb.
    • It will be recognized as a serial port(tty/COM) device.
    • The functions like printf/scanf/putc/getc… will use this serial port to communicate with others.(Be careful to use those I/O function, it could be very slow on those embedded system.)
    • You can use serial communication program like minicom(under unix-like) or
      teraterm, putty (under MS Windows), HyperTerminal (under MS Windows XP) to communicate with zigduino via serial port.
    • Or you can just write one, see serial programming.

Windows(Cygwin) instructions

  1. Install Cygwin. Note that when installing, you need to at least install the following packages
    (you may install vim at the same time if you need it):
    1. make
    2. subversion
  2. Install WinAVR. (We tested WinAVR-20100110 and it works)
  3. Using subversion to get the source code of nano-RK
    • from our course svn server
      $ svn checkout svn://mvnl.csie.ntu.edu.tw/wn11fall/nano-RK
    • “OR” from official nano-RK svn server
      $ svn checkout svn://nanork.org/srv/svn/repos/nano-RK
  4. Download and install the FTDI USB driver from here (win 7 might not need this driver)
  5. Plug-in your Zigduino board to one of the USB ports on your computer and use the Device Manager (裝置管理員) to find out Zigduino's COM port number (for example, COM10).
  6. Make sure the ROOT_DIR is right in the makefile. ex.
     ROOT_DIR = ../../../ 
  7. Modify the makefile of your program
    PROGRAMMING_PORT = COM10 
  8. Run follow instruction and it will upload the program to zigduino
    make program
  • Guide with screenshots here

Linux instructions

  1. Make sure you have following installed
    • flex
    • bison
    • byacc
    • gcc
    • make
    • gmp
    • mpfr
    • subversion
  2. Ubuntu/Debian can simply run below instruction to install.
     $ sudo aptitude install flex bison byacc gcc make libgmp3-dev libmpfr-dev subversion

    (sure you can use apt-get)

  3. Download those package (Notice the version!!!)
  4. Build/Install? binutils
    • unzip and untar binutils
    • cd into binutils-x.xx
    • run (make install as root)
      $ ./configure --target=avr --program-prefix="avr-" --disable-werror
      $ make    
      $ sudo make install
  5. Build/Install? gcc for avr
    • unzip and untar gcc-core
    • cd into gcc-core-x.x.x
    • run the following (make install as root)
    • cd into the gcc-core directory (avr-gcc below should be a sub-directory inside gcc-core)
      $ mkdir avr-gcc
      $ cd avr-gcc
      $ ../configure --target=avr --program-prefix="avr-" --enable-languages=c --disable-libssp
      $ make
      $ sudo make install
  6. Build/Install? avr-libc
    • make sure /usr/local/bin is in your path
    • type “which avr-gcc” to double check
    • unzip and untar avr-libc
    • cd into avr-libc-x.x.x
    • run the following (make install as root)
      $ ./configure --build=`./config.guess` --host=avr
      $ make
      $ sudo make install
  7. Build/Install? avr-dude
    • unzip and untar avr-dude
    • cd into avrdude-x.x
    • run (make install as root)
      $ ./configure
      $ make
      $ sudo make install
  8. Using subversion to get the source code of nano-RK
    • from our course svn server
      $ svn checkout svn://mvnl.csie.ntu.edu.tw/wn11fall/nano-RK
    • “OR” from official nano-RK svn server
      $ svn checkout svn://nanork.org/srv/svn/repos/nano-RK
  9. Plug-in your Zigduino board to one of the USB ports on your computer and run
    $ dmesg 

    and you will see some message like this

    [] usb 1-1.2.1: new full speed USB device using ehci_hcd and address 9
    [] usb 1-1.2.1: configuration #1 chosen from 1 choice
    [] ftdi_sio 1-1.2.1:1.0: FTDI USB Serial Device converter detected
    [] usb 1-1.2.1: Detected FT232RL
    [] usb 1-1.2.1: Number of endpoints 2
    [] usb 1-1.2.1: Endpoint 1 MaxPacketSize 64
    [] usb 1-1.2.1: Endpoint 2 MaxPacketSize 64
    [] usb 1-1.2.1: Setting MaxPacketSize 64
    [] usb 1-1.2.1: FTDI USB Serial Device converter now attached to ttyUSB0

    find out Zigduino's tty port number (in this example, /dev/ttyUSB0).

  10. Modify the makefile of your program
    PROGRAMMING_PORT = /dev/ttyUSB0 
  11. Make sure the ROOT_DIR is right in the makefile. ex.
     ROOT_DIR = ../../../ 
  12. Run follow instruction and it will upload the program to zigduino
    make program

Mac instructions

####################################
# Step 1 - Install the "Fink" the full world of Unix Open Source software to Mac OSX.
#
# Reference website:
# http://www.finkproject.org/index.php?phpLang=en
#
# Download Fink 0.31.0 for OSX 10.6 Snow Leopard and 10.7 Lion
# http://www.finkproject.org/download/srcdist.php
#
# Open the "terminal window" and enter the following command:
####################################
cd Desktop/mvnlab
tar -zxvf fink-0.31.0.tar.gz
cd fink-0.31.0
./bootstrap
# Leave everything as Default
# The compile time is about 15 mins
# After complete the installion, run this command to setup you fink environment
/sw/bin/pathsetup.sh
# reopen the terminal window
# execute selfupdate and index command
fink selfupdate-rsync
fink index -f
###################################
# Step 2 - Install Xcode
#
# Reference website:
# http://developer.apple.com/xcode/
#
# You will be ask for register an Apple account to download and install Xcode with .dmg file.
###################################
# install Xcode with double clicks
###################################
# Step 3 - Check the pre-install softwares
# You will need the following pre-install softwares:
# flex and bison
###################################
# Check the software is installed or not
# open terminal window and using "which" to check
which flex
which bison
# if these softwares are not installed, run the following command to install them from fink
sudo apt-get update
sudo apt-get install flex
sudo apt-get install bison
###################################
# Step 4 - Install gmp and mpfr
# Reference website:
# http://web.me.com/chibaf/math/mp/mpfr/install.html
#
# gmp download
# http://gmplib.org/
#
# mpfr download
# http://www.mpfr.org/mpfr-current/#download
###################################
# install gmp
# the make procedure will take very long time, be patient.
tar zxvf gmp-5.0.2.tar.gz
cd gmp-5.0.2
./configure
make && make check
sudo make install
# install mpfr
tar zxvf mpfr-3.0.1.tar.gz
cd mpfr-3.0.1
# download patchfiles
# http://www.mpfr.org/mpfr-current/allpatches
# save allpatches in the same directory
patch -N -Z -p1 < allpatches
./configure
make && make check
sudo make install
###################################
# Step 5 - Install wget & save Makefile
###################################
# update fink list
fink list
# install wget and its dependencies softwares
fink -b install wget
# save this file as Makefile
# http://140.112.91.208/INSTALL/nano-rk.mac (powered by math120908)
###################################
# Step 6 - Install binutils
###################################
make binutils
###################################
# Step 7 - Install avrgcc
###################################
make avrgcc
###################################
# Step 8 - Install avrlibc
###################################
make avrlibc
###################################
# Step 9 - Install avrdude
###################################
make avrdude
###################################
# Step 10 - Install FTDI USB Driver
#
# Download:
# http://www.nanork.org/attachment/wiki/Downloads/FTDIUSBSerialDriver_10_4_10_5_10_6.mpkg.zip?format=raw
###################################
# Save on Desktop
# Double clicks to install
###################################
# Step 11 - Get nano-rk with zigduino support
###################################
svn checkout svn://mvnl.csie.ntu.edu.tw/wn11fall/nano-RK
# or svn checkout svn://nanork.org/srv/svn/repos/nano-RK
# after checkout, you will see zigduino platform in
# nano-RK/include/platform/zigsuino
 
wn_11fall_zigduino_nanork.txt · Last modified: 2011/10/06 18:42 by hikaru4 · [Old revisions]
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki