Project

General

Profile

CompilingFirmware » History » Revision 16

Revision 15 (peteruithoven, 2013-12-06 19:59) → Revision 16/25 (peteruithoven, 2014-04-08 19:12)

{{>toc}} 

 h1. Compiling from source 

 h2. With gcc4mbed 

 It is possible to compile the software from source and make a binary image that runs on the mbed. 
 # MBED online compiler (at http://mbed.org): You need an account on mbed.org and a Internet connection.  
 # gcc4mbed GCC4MBED offline compiler, using GCC. Download at (https://github.com/adamgreen/gcc4mbed) 
 # with open source MBED from GitHub.  

 h2. With gcc4mbed 

 You can use GCC4MBED on your platform, or use a linux virtual machine to compile the sources. See: 
 http://jeelabs.net/projects/tosca/wiki/ARM_toolchain_setup_GCC4ARM 

 Installation of gcc4mbed on linux: 
 <pre> 
 wget https://github.com/adamgreen/gcc4mbed/zipball/master 
 mv master adamgreen-gcc4mbed.zip 
 unzip adamgreen-gcc4mbed.zip 
 mv adamgreen-gcc4mbed-* gcc4mbed 
 cd gcc4mbed 
 ./linux_install</pre> 
 Check the "Github gcc4mbed page":https://github.com/adamgreen/gcc4mbed when you run into problems.  
 Then download / clone the firmware 
 <pre>git clone https://github.com/LaosLaser/Firmware.git</pre> 
 Place laser folder in gcc4mbed folder 
 Run the following command in that folder 
 <pre>make</pre> 
 And copy the resulting bin file to your MBED or LPC. 

 The compiler (currently) creates two .bin files. (laos.bin and laos-lpc.bin) laos-LPC is (experimental) for the lpcexpresso (not mbed). 

 h2. with open source MBED from GitHub 

 Download the firmware from github: 

 <pre>git clone --recursive https://github.com/LaosLaser/Firmware.git</pre> 

 Optional, maybe not necessary: update mbed libs 

 <pre>cd Firmware/mbed</pre> 

 <pre>git pull origin master</pre> 

 or from elsewhere 

 <pre>git pull https://github.com/pbrier/mbed master</pre> 

 Patch mbed libraries:  

 <pre>cd mbed/ 
 patch -p1 < ../laser/mbed.patch</pre> 

 Download _GCC ARM_ from the following address and place it in a folder 
 _https://launchpad.net/gcc-arm-embedded/+download_ 

 When necessary update the _GCC_ARM_PATH_ path in _Firmware/mbed/workspace_tools/settings.py_ 
 For example: _/Developer/gcc-arm-none-eabi-4_7-2013q3/bin_ (Make sure you specify the _bin_ folder). 

 Now, compile the libraries 

 <pre>python workspace_tools/build.py -m LPC1768 -t GCC_ARM -r -e -u -c</pre> 

 Link LaOSlaser as an mbed example project  
 <pre>cd libraries/tests/net/protocols/</pre> 

 <pre>ln -s ../../../../../laser</pre> 

 Compiling the firmware: 
 <pre>cd ../../../../</pre> 

 <pre>python workspace_tools/make.py -m LPC1768 -t GCC_ARM -n laser</pre> 

 Then you should be able to find your new firmware at:   
 _Firmware/mbed/build/test/LPC1768/GCC_ARM/laser/laser.bin_ 

 Read http://mbed.org/handbook/mbed-tools for more info 

 h1. Debugging 

 You can debug the MBED by means of a USB/serial connection. This is included in the mbed (no USB/serial adapter required). 
 See the [[MBED Serial Debugging]] page for more information. 

 <pre>...</pre>