This page suggests some steps for getting started with Tollos using
the mbed development board.
This tutorial first checks that the Tollos sample application works
on your mbed board, and then steps through the processes for connecting
it to a terminal. Finally, it shows how to modify and recompile
the application. Please see the sample application page for an
annotated description of the code.
It is assumed for this tutorial that you are using a computer on
which the operating system is Windows (XP, Vista, or 7), as this
is the more complicated option. The steps for (say) a Linux host
are very similar.
Check the sample application
- Download the Tollos package from the download page
- Unzip the package in the location of your choice, preserving its
directory structure. This should create a directory called tollos,
within which there should be at least these four directories:
sample – the sample application
tollos – the Tollos core library
mbed – the library for mbed (board-dependent
code and link script)
lpc17xx – the library for the LPC1768
(the microcontroller used on the mbed board).
the sample directory there should be a file called sample.bin.
This is the compiled binary code for the sample application. Copy
this to the mbed board:
mbed board (front)
- Attach the mbed card to your computer with the USB cable (the
blue LED between the USB socket and the reset button should come
- The mbed card should shortly become visible to your operating
system as a removable storage device (like a USB memory key), called
- Drag and drop, or copy and paste, the sample.bin file to the
MBED disk (the blue LED should flicker while the copy takes place).
- Press the reset button (in the middle of the mbed board) to start
the sample application running. The rightmost of the four LEDs at
the bottom of the board (LED4) should then blink once, followed by
the leftmost which should then blink continuously (on or off once
a second). If the LEDs do not blink, try following the above steps
again, and also see the mbed website (‘Downloading a program’) for some troubleshooting suggestions.
Using a terminal with mbed
The sample application uses the Tollos debug functions to communicate
with a terminal emulator on the PC: the
debugf function (a small version of the
C function printf) is used to write character strings to the
terminal, and the debugGetc function
lets it receive characters that you type on the terminal.
For this to work, you need:
- terminal emulator software for the PC
- (on Windows) the USB serial port driver for the mbed board.
In brief (for more detail see the ‘SerialPC’ and
‘Windows serial configuration’ pages on the mbed website), the steps are:
- Install the serial port driver:
- Download the mbed serial driver installer.
- Plug in the mbed board and close any Windows Explorer windows.
- Run the driver installer (this will probably take a minute or
two, and may ask for confirmations and authorization for the install
- Install a terminal emulator. TeraTerm is recommended because it
is easier to use than most;
Putty is one
of several other possibilities.
- Download the TeraTerm installer file (e.g., teraterm-4.67.exe).
- Run the installer to install TeraTerm (you can skip the LogMeTT
and TTLEditor installs).
- Start the TeraTerm emulator
- choose File → New Connection (this window may pop up automatically)
and then select ‘Serial’
- available ports will then be listed; select the mbed port, which
should be listed by name
- then click OK.
- Next choose Setup → Serial port
- against ‘Baud rate:’ select 115200
- then click OK.
- (You might want to save these settings so they will be used next
time: choose Setup → Save Setup...)
At this point the terminal is ready to use; if you now press reset
on the mbed board a short message should appear on the terminal (similar
to the first content line in the image below). If it is readable
the terminal is set up correctly. ‘Garbage’ characters appearing
probably mean that the baud rate is set incorrectly. If you see
nothing at all then check the steps above, and also see the mbed
‘Terminals’ page for more details
Assuming the terminal is working, the sample application will be
watching out for certain characters which you can type in. These
- 1 – invert the state of LED1 (on ↔ off)
- 2, 3, or 4 – similarly invert LED2, LED3, or LED4
- ? – prints some system information values to the terminal.
In addition, the TeraTerm break signal (Alt-b) should reset the mbed
board, just as though the reset button had been pressed. Here’s
how the TeraTerm window might look after a reset and the character
? being typed:
Modify the application
To modify the sample application you need
- A text editor (such as Windows Notepad)
- A cross compiler (a compiler that runs on a PC and lets you compile
programs for the ARM processor on the mbed board).
Tollos is compiled with the free CodeSourcery G++ Lite cross compiler for ARM EABI, and this tutorial
assumes you are using that, although there are other options. If
you are using a different compiler you may need to recompile all
the Tollos libraries as well as the sample application.
The steps are:
- Download and install CodeSourcery G++ Lite (for most Windows installations, use the EABI
download suggested and select the IA32 Windows Installer).
Accepting all the defaults (including setting the PATH) is recommended
(at the sixth step you might also want icons to be added to the start
menu, etc., but that is not essential).
- Make a change to the sample application (sample.c in the subdirectory
sample in your tollos directory) with your text editor (see
the annotated version for a description of the
– add the line:
at the start of the init() function
– change the LED that is blinked in the init() function
then save the file.
- Open a command window prompt (usually in the Accessories folder
in Start programs) and change directory to the tollos\sample
directory (use the CD command).
- Type in and enter the command:
This should result in the following lines being displayed:
sample.c Compiled OK
sample.bin created OK, size 5492 bytes
Press any key to continue . . .
(the size might be different than shown here).
If this fails, you should see some error message that describes the
problem (for example, if the compiler cannot be found it is likely
that the PATH was not set during installation). Please also see
the FAQ page for common problems.
- At this point, the sample application has been compiled and a new
binary file (sample.bin) has been created:
– press any key (to complete the churn command)
– copy sample.bin to the mbed board as described above (or
by using the copy command)
– press the mbed reset button (or Alt-b in TeraTerm) to see the
results of your changes.
You can now continue to modify the sample, or you can write your
own. The churn command can be used to compile different programs
by specifying the name of the .c file (including the .c)
as the first parameter word. You can also use it from Windows Explorer
by dragging the application .c file and dropping it onto the
churn icon; in this case a window will be opened automatically
to display the compilation results etc.
The churn command is a plain-text file (churn.bat) which
includes the names of the libraries, etc., that are used to build
the application – you can view or edit this with Notepad. Other
examples of code and churn.bat scripts can be found in the other
All of the steps above have been tested on a small solid-state netbook
(Asus Eee PC 900) running Windows XP and also on a larger machine
running Windows 7. If you come across any errors in this page, or
suggestions for improvements, please let me know.