Skip to content
afrab edited this page Jul 25, 2012 · 13 revisions

OpenLab Installation and Environment setup

Cross compilation tools

GCC compiler for ARM

The prefered GCC version to run within HiKoB Openlab can be obtained from launchpad:

GCC is available for linux and widnows. MacOSX users can try the prebuild version available at

OpenOCD

http://openocd.sourceforge.net/ is needed to control and flash openlab hardware. The openocd tools are available on most distribution. Please make sure you are running at least version 0.5 of openocd.

If you need to update you installation setup, openocd source packages are available at http://repo.or.cz/r/openocd.git

Note for Windows users

GCC and OpenOCD configuration notes for windows are available here

Building Openlab firmwares

Configuration

Openlab uses cmake to organize the build process. Compiling Openlab for a platform requires the following steps.

$ mkdir build
$ cd build
$ cmake [git path] -DPLATFORM=agile-fox
-- The C compiler identification is GNU 4.7.1
-- The CXX compiler identification is GNU 4.7.1
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/antoine/hikob/hikob-openlab/openlab/build

Platforms available through the openlab opensource repository are Agile Fox and Dangerous Newt platforms.

Compilation

Once the configuration process is done you can build all examples using the make command.

Examples can be compiled separately by specifying make targets (make test_leds)

Firmwares are available in ELF format in the bin directory.

Download / Flash on target

Every target can be downloaded on targets using a special make target in which the flash_ prefix is added to the firmware name.

make flash_test_leds

This special targets will take care of all the steps to control OpenOCD to flash the firmware on the configured target.

Note: the target needs to be switched on to allow flashing formwares.

Debugging using GDB and remote control protocol

OpenOCD allows to fully control targets using the GDB Serial Remote Control Protocol. Openlab configuration and build scripts provide a special target to remotely control the platforms.

$ make debug
Scanning dependencies of target debug
Open On-Chip Debugger 0.6.0-dev-00497-ga6cf60c-dirty (2012-04-05-15:11)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
[...]
Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG tap: stm32f1x.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0)
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
0* stm32f1x.cpu       cortex_m3  little stm32f1x.cpu       running
Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG tap: stm32f1x.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0)
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08003248 msp: 0x20010000

You can then use another terminal to start GDB, or use your prefered editor such as Eclipse, Emacs to start your debugging sessions

$ arm-none-eabi-gdb bin/test_leds.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.3.1.20120613-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/antoine/hikob/hikob-openlab/openlab/build/bin/test_leds.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
reset () at /home/antoine/hikob/hikob-openlab/openlab/drivers/cortex-m3/boot.c:62
62          while (dst < &_edata)
(gdb)