Difference between revisions of "RoboVero"

From Gumstix User Wiki
Jump to: navigation, search
(Created page with "Getting started with Gumstix RoboVero")
 
Line 1: Line 1:
 
Getting started with Gumstix RoboVero
 
Getting started with Gumstix RoboVero
 +
 +
== Prerequisites ==
 +
 +
You'll need to install git to retrieve some of the software for the toolchain.
 +
 +
$ sudo apt-get install gawk bison flex automake libtool libncurses5-dev zlib1g-dev libusb-dev eclipse eclipse-cdt unzip
 +
 +
Create a new folder in your home directory.
 +
 +
$ mkdir ${HOME}/cortex-m3
 +
 +
 +
== Toolchain ==
 +
 +
=== crosstool-NG ===
 +
 +
A cross compiler builds executable code for a platform other than the one on which the compiler runs. In our case, the toolchain (compiler, linker, debugger, etc.) will typically run on i386 or i686 and generate binaries for ARMv7-M. crosstool-NG is an application for building cross toolchains.
 +
 +
==== ARM Angstrom ====
 +
 +
Building the RoboVero toolchain for Overo takes hours and requires installing a number of non-standard packages. The easiest way to get started is to download the archive containing a pre-built toolchain and extract it to your home folder. NOTE: This hasn't been tested with a clean build and may require additional packages.
 +
 +
cd
 +
wget http://cumulus.gumstix.org/sources/robovero/x-tools.tar.gz
 +
tar -xzf x-tools.tar.gz
 +
 +
Your toolchain should appear in ${HOME}/x-tools. Now we need to modify the PATH environment variable.
 +
 +
==== Other ====
 +
 +
Go to http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool to determine the current version of crosstool-NG
 +
 +
$ cd ${HOME}/cortex-m3
 +
$ wget http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-X.X.X.tar.bz2
 +
 +
Extract the archive
 +
 +
$ tar xjf crosstool-ng-X.X.X.tar.bz2
 +
$ cd ${HOME}/cortex-m3/crosstool-ng-X.X.X
 +
 +
Install crosstool-ng
 +
 +
$ ./configure
 +
$ make
 +
$ make install
 +
 +
Make a new directory for the baremetal configuration file.
 +
 +
$ mkdir ${HOME}/cortex-m3/arm-eabi
 +
$ cd ${HOME}/cortex-m3/arm-eabi
 +
$ cp ${HOME}/cortex-m3/crosstool-ng-1.9.1/samples/arm-bare_newlib_cortex_m3_nommu-eabi/crosstool.config .config
 +
 +
Add gdb to the configuration and build the toolchain. The build will take around 30 minutes depending on your machine.
 +
 +
$ ct-ng menuconfig
 +
Debug facilities  ---
 +
  [*] gdb  ---
 +
  [*]  Cross-gdb
 +
 +
$ ct-ng build
 +
 +
==== Exporting PATH ====
 +
 +
If the build succeeds your new toolchain will appear in ~/x-tools. Add to the PATH environment variable (where the system looks for binaries) by appending an export command to .bashrc. Open a new terminal and echo path to verify that the change has taken effect.
 +
 +
$ nano ${HOME}/.bashrc
 +
export PATH="${HOME}/x-tools/arm-bare_newlib_cortex_m3_nommu-eabi/bin:$PATH"
 +
 +
[new terminal]
 +
$ echo $PATH
 +
 +
=== LPC1700CMSIS ===
 +
 +
LPC1700CMSIS is a collection of source code and libraries to simplify writing firmware for the M3.
 +
 +
$ cd ${HOME}/cortex-m3
 +
$ mkdir LPC1700CMSIS
 +
$ cd LPC1700CMSIS
 +
$ wget
 +
http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip
 +
$ unzip lpc17xx.cmsis.driver.library.zip
 +
 +
=== Test ===
 +
 +
Time to find out whether we can compile a project. Let's try to build the LPC1700CMSIS Driver Library.
 +
 +
$ cd ${HOME}/cortex-m3/LPC1700CMSIS/makesection
 +
$ nano makeconfig
 +
 +
PROJ_ROOT        =${HOME}/cortex-m3/LPC1700CMSIS
 +
CMCORE_TYPE      =CM3
 +
DEVICE            =LPC17xx
 +
MANUFACTURE      =NXP
 +
TOOL              =gnu
 +
DEBUG_MODE        =1
 +
GNU_INSTALL_ROOT  =${HOME}/x-tools/arm-bare_newlib_cortex_m3_nommu-eabi
 +
GNU_VERSION      =4.4.1
 +
 +
$ cd makerule/common
 +
$ nano make.rules.environment
 +
 +
[remove path and .exe extension from tools - you might also need to change some backslashes]
 +
 +
$ cd ../LPC17xx
 +
$ nano makefile.LPC17xx.gnu
 +
 +
TOOLCHAIN =arm-bare_newlib_cortex_m3_nommu-eabi
 +
 +
$ ${HOME}/cortex-m3/LPC1700CMSIS
 +
$ make VERBOSE=yes
 +
 +
Take a look at the compiler messages to verify that arm-bare_newlib_cortex_m3_nommu-eabi-gcc and arm-bare_newlib_cortex_m3_nommu-eabi-ld are being invoked. If so, and you get no build errors, the toolchain is working. You can also try building one of the images in the Examples folder.
 +
 +
== Debug Tools ==
 +
 +
=== FT2232 ===
 +
 +
FT2232 is a serial protocol converter that provides JTAG connectivity to the Robovero and console port access to the Overo COM. We need to install the driver for JTAG to work.
 +
 +
==== Ubuntu ====
 +
 +
sudo apt-get install libftdi
 +
 +
==== ARM Angstrom ====
 +
 +
opkg install libftdi
 +
 +
==== Other ====
 +
 +
Go to http://www.intra2net.com/en/developer/libftdi/download.php to find the current libftdi release
 +
 +
$ cd ${HOME}/cortex-m3
 +
$ wget http://www.intra2net.com/en/developer/libftdi/download/libftdi-X.X.tar.gz
 +
$ tar xf libftdi-X.X.tar.gz
 +
$ cd libftdi-X.XX/
 +
$ ./configure
 +
$ make
 +
$ sudo make install
 +
$ sudo ldconfig
 +
 +
=== OpenOCD ===
 +
 +
Open On-Circuit Debugger (OpenOCD) provides debugging, in-system programming and boundary-scan testing for the Robovero. It connects the debug host (your development machine) to the target (cortex) through an adapter (FT2232). OpenOCD allows you to debug code running on the target with GDB.
 +
 +
==== Ubuntu ====
 +
 +
sudo apt-get install openocd
 +
 +
NOTE: Experimental. Should the version of OpenOCD available for your system not work, follow the instructions below to compile with the necessary flags.
 +
 +
==== ARM Angstrom ====
 +
 +
# wget http://cumulus.gumstix.org/sources/robovero/openocd_0.4-r0.6_armv7a.ipk
 +
# opkg install openocd_0.4-r0.6_armv7a.ipk
 +
# wget http://cumulus.gumstix.org/sources/lpc1769.cfg
 +
# cp lpc1769.cfg /usr/share/openocd/scripts/target
 +
 +
==== Other ====
 +
 +
$ cd ${HOME}/cortex-m3
 +
$ wget http://download.berlios.de/openocd/openocd-X.X.X.tar.bz2
 +
$ tar xjf openocd-X.X.X.tar.bz2
 +
$ cd openocd-X.X.X/
 +
$ ./configure --enable-ft2232_libftdi
 +
$ make
 +
$ sudo make install
 +
$ wget http://cumulus.gumstix.org/sources/lpc1769.cfg
 +
$ sudo cp lpc1769.cfg /usr/local/share/openocd/scripts/target
 +
 +
=== Test ===
 +
 +
Plug in your device. And run OpenOCD to connect.
 +
 +
$ sudo openocd -f interface/openocd-usb.cfg -f target/lpc1769.cfg
 +
Open On-Chip Debugger 0.4.0 (2011-01-06-19:17)
 +
Licensed under GNU GPL v2
 +
For bug reports, read
 +
    http://openocd.berlios.de/doc/doxygen/bugs.html
 +
500 kHz
 +
Info : clock speed 500 kHz
 +
Info : JTAG tap: lpc1768.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
 +
Info : lpc1768.cpu: hardware has 6 breakpoints, 4 watchpoints
 +
 +
Open another terminal. We will flash using GDB.
 +
 +
$ wget http://cumulus.gumstix.org/sources/robovero/gdbconfig
 +
$ x-tools/arm-bare_newlib_cortex_m3_nommu-eabi/bin/arm-bare_newlib_cortex_m3_nommu-eabi-gdb -x gdbconfig robovero/firmware/firmware
 +
 +
(gdb) load
 +
(gdb) continue
 +
 +
If your LED starts to flash then your debug tools are working. You can press the RoboVero reset and the firmware will run without GDB.

Revision as of 09:14, 22 June 2011

Getting started with Gumstix RoboVero

Prerequisites

You'll need to install git to retrieve some of the software for the toolchain.

$ sudo apt-get install gawk bison flex automake libtool libncurses5-dev zlib1g-dev libusb-dev eclipse eclipse-cdt unzip

Create a new folder in your home directory.

$ mkdir ${HOME}/cortex-m3


Toolchain

crosstool-NG

A cross compiler builds executable code for a platform other than the one on which the compiler runs. In our case, the toolchain (compiler, linker, debugger, etc.) will typically run on i386 or i686 and generate binaries for ARMv7-M. crosstool-NG is an application for building cross toolchains.

ARM Angstrom

Building the RoboVero toolchain for Overo takes hours and requires installing a number of non-standard packages. The easiest way to get started is to download the archive containing a pre-built toolchain and extract it to your home folder. NOTE: This hasn't been tested with a clean build and may require additional packages.

cd
wget http://cumulus.gumstix.org/sources/robovero/x-tools.tar.gz
tar -xzf x-tools.tar.gz

Your toolchain should appear in ${HOME}/x-tools. Now we need to modify the PATH environment variable.

Other

Go to http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool to determine the current version of crosstool-NG

$ cd ${HOME}/cortex-m3
$ wget http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-X.X.X.tar.bz2

Extract the archive

$ tar xjf crosstool-ng-X.X.X.tar.bz2
$ cd ${HOME}/cortex-m3/crosstool-ng-X.X.X

Install crosstool-ng

$ ./configure
$ make
$ make install

Make a new directory for the baremetal configuration file.

$ mkdir ${HOME}/cortex-m3/arm-eabi
$ cd ${HOME}/cortex-m3/arm-eabi
$ cp ${HOME}/cortex-m3/crosstool-ng-1.9.1/samples/arm-bare_newlib_cortex_m3_nommu-eabi/crosstool.config .config

Add gdb to the configuration and build the toolchain. The build will take around 30 minutes depending on your machine.

$ ct-ng menuconfig
Debug facilities  ---
 [*] gdb  ---
  [*]   Cross-gdb
$ ct-ng build

Exporting PATH

If the build succeeds your new toolchain will appear in ~/x-tools. Add to the PATH environment variable (where the system looks for binaries) by appending an export command to .bashrc. Open a new terminal and echo path to verify that the change has taken effect.

$ nano ${HOME}/.bashrc
export PATH="${HOME}/x-tools/arm-bare_newlib_cortex_m3_nommu-eabi/bin:$PATH"
[new terminal]
$ echo $PATH

LPC1700CMSIS

LPC1700CMSIS is a collection of source code and libraries to simplify writing firmware for the M3.

$ cd ${HOME}/cortex-m3
$ mkdir LPC1700CMSIS
$ cd LPC1700CMSIS
$ wget

http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip

$ unzip lpc17xx.cmsis.driver.library.zip

Test

Time to find out whether we can compile a project. Let's try to build the LPC1700CMSIS Driver Library.

$ cd ${HOME}/cortex-m3/LPC1700CMSIS/makesection
$ nano makeconfig
PROJ_ROOT         =${HOME}/cortex-m3/LPC1700CMSIS
CMCORE_TYPE       =CM3
DEVICE            =LPC17xx
MANUFACTURE       =NXP
TOOL              =gnu
DEBUG_MODE        =1
GNU_INSTALL_ROOT  =${HOME}/x-tools/arm-bare_newlib_cortex_m3_nommu-eabi
GNU_VERSION       =4.4.1
$ cd makerule/common
$ nano make.rules.environment

[remove path and .exe extension from tools - you might also need to change some backslashes]

$ cd ../LPC17xx
$ nano makefile.LPC17xx.gnu
TOOLCHAIN =arm-bare_newlib_cortex_m3_nommu-eabi
$ ${HOME}/cortex-m3/LPC1700CMSIS
$ make VERBOSE=yes

Take a look at the compiler messages to verify that arm-bare_newlib_cortex_m3_nommu-eabi-gcc and arm-bare_newlib_cortex_m3_nommu-eabi-ld are being invoked. If so, and you get no build errors, the toolchain is working. You can also try building one of the images in the Examples folder.

Debug Tools

FT2232

FT2232 is a serial protocol converter that provides JTAG connectivity to the Robovero and console port access to the Overo COM. We need to install the driver for JTAG to work.

Ubuntu

sudo apt-get install libftdi

ARM Angstrom

opkg install libftdi

Other

Go to http://www.intra2net.com/en/developer/libftdi/download.php to find the current libftdi release

$ cd ${HOME}/cortex-m3
$ wget http://www.intra2net.com/en/developer/libftdi/download/libftdi-X.X.tar.gz
$ tar xf libftdi-X.X.tar.gz
$ cd libftdi-X.XX/
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

OpenOCD

Open On-Circuit Debugger (OpenOCD) provides debugging, in-system programming and boundary-scan testing for the Robovero. It connects the debug host (your development machine) to the target (cortex) through an adapter (FT2232). OpenOCD allows you to debug code running on the target with GDB.

Ubuntu

sudo apt-get install openocd

NOTE: Experimental. Should the version of OpenOCD available for your system not work, follow the instructions below to compile with the necessary flags.

ARM Angstrom

# wget http://cumulus.gumstix.org/sources/robovero/openocd_0.4-r0.6_armv7a.ipk
# opkg install openocd_0.4-r0.6_armv7a.ipk
# wget http://cumulus.gumstix.org/sources/lpc1769.cfg
# cp lpc1769.cfg /usr/share/openocd/scripts/target

Other

$ cd ${HOME}/cortex-m3
$ wget http://download.berlios.de/openocd/openocd-X.X.X.tar.bz2
$ tar xjf openocd-X.X.X.tar.bz2
$ cd openocd-X.X.X/
$ ./configure --enable-ft2232_libftdi
$ make
$ sudo make install
$ wget http://cumulus.gumstix.org/sources/lpc1769.cfg
$ sudo cp lpc1769.cfg /usr/local/share/openocd/scripts/target

Test

Plug in your device. And run OpenOCD to connect.

$ sudo openocd -f interface/openocd-usb.cfg -f target/lpc1769.cfg
Open On-Chip Debugger 0.4.0 (2011-01-06-19:17)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.berlios.de/doc/doxygen/bugs.html
500 kHz
Info : clock speed 500 kHz
Info : JTAG tap: lpc1768.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : lpc1768.cpu: hardware has 6 breakpoints, 4 watchpoints

Open another terminal. We will flash using GDB.

$ wget http://cumulus.gumstix.org/sources/robovero/gdbconfig
$ x-tools/arm-bare_newlib_cortex_m3_nommu-eabi/bin/arm-bare_newlib_cortex_m3_nommu-eabi-gdb -x gdbconfig robovero/firmware/firmware
(gdb) load
(gdb) continue

If your LED starts to flash then your debug tools are working. You can press the RoboVero reset and the firmware will run without GDB.