SEARCH
TOOLBOX
LANGUAGES
modified on 1 June 2015 at 14:00 ••• 78,643 views

Bambino-210 Manual/Offline Toolchains

From Manuals

Jump to: navigation, search

Contents

Offline Toolchains

The online compiler covered in the previous chapter is the fastest way to start programming mbed applications. There is no software to install and the toolchain is actively managed for you. Yet some projects require full debugging capabilities, custom library builds, group source code control and other options not currently available on the online compiler. This chapter covers how to use offline toolchains to build both your application as well as the mbed library.

The Micromint Bambino implements the mbed HDK on-board using an additional microcontroller (NXP LPC11U35) with the mbed CMSIS-DAP firmware. Offline compilers can use the mbed HDK for debugging by configuring their toolchain debug options to CMSIS-DAP. To use external JTAG probes an alternate firmware is required as described in Appendix B.

Keil MDK

Keil MDK is a popular toolchain for development of ARM applications in C or C++. The free MDK-Lite allows you to build applications up to 32KB. Larger binaries require a commercial license. Many mbed examples include Makefiles for Keil MDK, including the mbed Book Examples for the Micromint Bambino. This section explains how to build the blinky mbed book example using Keil.

Select "Project", "Open Project..." and change to the mbed-book-02-06\PE_02-01_SimpleLED directory. Select the project file PE_02-01_SimpleLED.uvproj. Your IDE should look similar to the one below:

To use the on-board debugger please use the configuration listed in Appendix C. To build a binary from the IDE just press F7 or click on the compile toolbar button. To download the binary and start a debug session press Ctrl-F5 or click on the debug button. Your debug environment should look as follows:

Press F5 or clock the run button and the yellow LED (LED1) should start blinking. Press the stop button and place a breakpoint on the first line of the while loop by clicking to the left side of the line. Then press F5 to see the LED blink once. You can examine registers and perform other debugging options.

Developers creating new device drivers or changing mbed library features may find it convenient to include the library sources in their project files. The blinky_src project is a simple example to get started. The project can include your application source code as well as full mbed library sources.

GCC-ARM

GCC-ARM is a freely available GNU toolchain for ARM Cortex microcontrollers. It is actively maintained, regression tested and includes binaries for Windows, Linux and Mac. Many mbed examples include Makefiles for GCC-ARM, including the mbed Book Examples for the Micromint Bambino. This section explains how to build the blinky mbed book example using GCC-ARM.

After installing GCC-ARM verify that the ARM 'gcc' compiler and 'make' can be found on your PATH.

C:\Users\mbed>arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER= ...
Target: arm-none-eabi
Configured with: /home/build/work/GCC-4-8-build/src/gcc/configure ...
Thread model: single
gcc version 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358]
  (GNU Tools for ARM Embedded Processors)

C:\Users\mbed>make -v
GNU Make 3.82.90
Built for i686-pc-mingw32
Copyright (C) 1988-2012 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.

Note that GCC-ARM does not include 'make'. Developers using Windows can get binaries for 'make' and other utilities from unxutils or other projects.

Change to the project directory, build the binary and copy it to the mbed removable drive.

C:\Users\mbed>cd mbed-book-02-06\PE_02-01_SimpleLED

C:\Users\mbed\mbed-book-02-06\PE_02-01_SimpleLED>make
arm-none-eabi-g++ ... main.cpp
arm-none-eabi-gcc ... -lc -lgcc -lnosys
arm-none-eabi-objcopy -O binary PE_02-01_SimpleLED.elf PE_02-01_SimpleLED.bin

C:\Users\mbed\mbed-book-02-06\PE_02-01_SimpleLED>copy PE_02-01_SimpleLED.bin E:

The yellow LED (LED1) should start blinking. If your previous program left the board in an unknown state, press the RESET button to load the program you just copied.

GCC-ARM includes a GDB debugger binary for ARM (arm-none-eabi-gdb) which can be used with the on-board mbed CMSIS-DAP debugger via pyOCD or OpenOCD (0.8.0 or above).

Rebuilding mbed Libraries

The source code for the mbed library is open source and can be downloaded from the mbed mainline repository or the Micromint repository. To recompile it please follow these steps:

1. Install a compatible ARM toolchain. The mbed port for LPC4330 targets currently supports the Keil MDK, GCC ARM and GCC LPCXpresso toolchains. The Keil MDK is the main ARM toolchain at Micromint.

2. Install Python 2.7. The mbed build scripts are written in Python.

3. Install the mbed Library Sources. This includes full source code for all supported multiple microcontrollers and boards.

4. Edit workspace_tools/private_settings.py to reflect your toolchain directories.

from os.path import join

# ARM
armcc = "keil"
ARM_PATH = "C:/Keil/ARM"
ARM_BIN = join(ARM_PATH, "ARMCC", "bin")
ARM_INC = join(ARM_PATH, "ARMCC", "include")
ARM_LIB = join(ARM_PATH, "ARMCC", "lib")

# GCC ARM
GCC_ARM_PATH = "C:/Program Files (x86)/GNU Tools ARM Embedded/4.8 2014q2/bin"

# GCC CodeRed
GCC_CR_PATH = "C:/nxp/LPCXpresso_7.5.0_254/lpcxpresso/tools/bin"

5. Compile the base mbed libraries. These are typical commands to change to the source directory, setup compiler environment and build the bootloader. Note that the Python directory in the PATH may be different in your development system.

cd mbed-master
SET PATH=C:\Windows\system32;C:\Windows;C:\Python27
python workspace_tools/build.py -v -r -m LPC4330_M4 -t ARM > build.log
python workspace_tools/build.py -v -r -m LPC4330_M4 -t GCC_ARM >> build.log

If your build is successful, the mbed libraries and headers for the LPC4330 will be available in the ..\build directory. If not, check the build.log file. For more documentation on these procedures please visit the mbed tools site.


NEXT: Hardware

PREVIOUS: Getting Started