Project

General

Profile

CompilingFirmware » History » Version 24

peteruithoven, 2014-04-13 22:12

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 22 peteruithoven
# With open source MBED from GitHub (recommended method). 
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 21 peteruithoven
Download the firmware from github (mbed-gcc branch):
36 4 jaap
37 20 peteruithoven
<pre>git clone --recursive https://github.com/LaosLaser/Firmware.git -b mbed-gcc</pre>
38 4 jaap
39 24 peteruithoven
Optional, maybe not necessary: update mbed libs. For patch compatibility we update from the /pbrier/mbed repository. See "issue 96":http://redmine.laoslaser.org/issues/96
40 4 jaap
41 22 peteruithoven
<pre>cd Firmware/mbed
42
git pull https://github.com/pbrier/mbed master</pre>
43 4 jaap
44 11 peteruithoven
Patch mbed libraries: 
45 1 peteruithoven
46 13 jaap
<pre>cd mbed/
47 14 peteruithoven
patch -p1 < ../laser/mbed.patch</pre>
48 11 peteruithoven
49 7 peteruithoven
Download _GCC ARM_ from the following address and place it in a folder
50
_https://launchpad.net/gcc-arm-embedded/+download_
51
52 17 peteruithoven
Copy _Firmware/mbed/workspace_tools/settings.py_ to _Firmware/mbed/workspace_tools/private_settings.py_. 
53
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).
54 7 peteruithoven
55 4 jaap
Now, compile the libraries
56
57 1 peteruithoven
<pre>python workspace_tools/build.py -m LPC1768 -t GCC_ARM -r -e -u -c</pre>
58
59 9 peteruithoven
Link LaOSlaser as an mbed example project 
60 11 peteruithoven
<pre>cd libraries/tests/net/protocols/</pre>
61 1 peteruithoven
62 11 peteruithoven
<pre>ln -s ../../../../../laser</pre>
63
64 9 peteruithoven
Compiling the firmware:
65 11 peteruithoven
<pre>cd ../../../../</pre>
66
67
<pre>python workspace_tools/make.py -m LPC1768 -t GCC_ARM -n laser</pre>
68 9 peteruithoven
69 15 peteruithoven
Then you should be able to find your new firmware at:  
70
_Firmware/mbed/build/test/LPC1768/GCC_ARM/laser/laser.bin_
71
72 4 jaap
Read http://mbed.org/handbook/mbed-tools for more info
73 6 peter
74
h1. Debugging
75
76
You can debug the MBED by means of a USB/serial connection. This is included in the mbed (no USB/serial adapter required).
77
See the [[MBED Serial Debugging]] page for more information.
78 4 jaap
79 1 peteruithoven
<pre>...</pre>