Project

General

Profile

CompilingFirmware » History » Version 20

peteruithoven, 2014-04-08 19:30

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