Project

General

Profile

CompilingFirmware » History » Version 10

peteruithoven, 2013-12-03 21:05

1 5 jaap
{{>toc}}
2
3 2 peteruithoven
h1. Compiling from source
4 3 peteruithoven
5 4 jaap
h2. With gcc4mbed
6
7 1 peteruithoven
It is possible to compile the software from source and make a binary image that runs on the mbed.
8
# MBED online compiler (at http://mbed.org): You need an account on mbed.org and a Internet connection. 
9
# GCC4MBED offline compiler, using GCC. Download at (https://github.com/adamgreen/gcc4mbed)
10
11
You can use GCC4MBED on your platform, or use a linux virtual machine to compile the sources. See:
12
http://jeelabs.net/projects/tosca/wiki/ARM_toolchain_setup_GCC4ARM
13
14
Installation of gcc4mbed on linux:
15
<pre>
16
wget https://github.com/adamgreen/gcc4mbed/zipball/master
17
mv master adamgreen-gcc4mbed.zip
18
unzip adamgreen-gcc4mbed.zip
19
mv adamgreen-gcc4mbed-* gcc4mbed
20
cd gcc4mbed
21
./linux_install</pre>
22
Check the "Github gcc4mbed page":https://github.com/adamgreen/gcc4mbed when you run into problems. 
23
Then download / clone the firmware
24
<pre>git clone https://github.com/LaosLaser/Firmware.git</pre>
25
Place laser folder in gcc4mbed folder
26
Run the following command in that folder
27
<pre>make</pre>
28
And copy the resulting bin file to your MBED or LPC.
29
30
The compiler (currently) creates two .bin files. (laos.bin and laos-lpc.bin) laos-LPC is (experimental) for the lpcexpresso (not mbed).
31 4 jaap
32
h2. with open source MBED from GitHub
33
34
Download the firmware from github:
35
36
<pre>git clone --recursive https://github.com/LaosLaser/Firmware.git</pre>
37
38
Optional, maybe not necessary: update mbed libs
39
40
<pre>cd Firmware/mbed</pre>
41
42
<pre>git pull origin master</pre>
43
44
or from elsewhere
45
46
<pre>git pull https://github.com/pbrier/mbed master</pre>
47
48 9 peteruithoven
Patch mbed libraries: cd mbed/ patch -p1 < laser/mbed.patch
49
50 7 peteruithoven
Download _GCC ARM_ from the following address and place it in a folder
51
_https://launchpad.net/gcc-arm-embedded/+download_
52
53 8 peteruithoven
When necessary update the _GCC_ARM_PATH_ path in _Firmware/mbed/workspace_tools/settings.py_
54
For example: _/Developer/gcc-arm-none-eabi-4_7-2013q3/bin_ (Make sure you specify the _bin_ folder).
55 7 peteruithoven
56 4 jaap
Now, compile the libraries
57
58
<pre>python workspace_tools/build.py -m LPC1768 -t GCC_ARM -r -e -u -c</pre>
59 1 peteruithoven
60 9 peteruithoven
Link LaOSlaser as an mbed example project 
61
<pre>cd Firmware/mbed/libraries/tests/net/protocols/ ln -s ../../../../../laser</pre>
62
63
Compiling the firmware:
64 10 peteruithoven
<pre>cd Firmware/mbed
65
python workspace_tools/make.py -m LPC1768 -t GCC_ARM -n laser</pre>
66 9 peteruithoven
67
Read http://mbed.org/handbook/mbed-tools for more info
68 4 jaap
69 6 peter
h1. Debugging
70
71
You can debug the MBED by means of a USB/serial connection. This is included in the mbed (no USB/serial adapter required).
72
See the [[MBED Serial Debugging]] page for more information.
73
74 4 jaap
<pre>...</pre>