Difference between revisions of "LXR OSX build instructions"

From Sonic Potions Wiki
Jump to: navigation, search
(Compile)
m (Compile the firmware)
 
(9 intermediate revisions by 3 users not shown)
Line 3: Line 3:
  
 
== General steps ==  
 
== General steps ==  
The LXR code is divided into two mains code parts that we will compile "separately" using two different tools
 
*the AVR Atmel CODE (LCD, front panel control, USB, SD card)
 
*the ARM CODE (main LXR code for the voices / sounds)
 
  
- We need "specific compilers and librairies" for each CODE. We need to change the PATH in your .bash_profile, we need MAKEFILES to build the firmware, and, finally, we will compile the code :)
+
The LXR code is divided into two main parts
  
Let's do it!
+
*the AVR Atmel code (display and front-panel control)
 +
*the Cortex M4 ARM code (main LXR code for DSP, sequencer, USB etc.)
  
== AVR COMPILER & LIBS ==
+
We need different toolkits to handle compilation of each set of code.
* Download of Atmel AVR 8-bit toolchain from http://www.obdev.at/products/crosspack/download.html
 
* You will get a .dmg file that you should extract and install (CrossPack-AVR-20131216.dmg is the most recent as of 2015/05/02)
 
* The compiler and libs are installed under /usr/local/CrossPack-AVR-20131216/
 
* Note that you will also find a folder like /usr/local/CrossPack-AVR/ (this folder is an alias to the previous folder - symlink).
 
  
== GNU ARM COMPILER AND LIBS ==
+
There is also a firmware utility (see <code>tools/FirmwareImageBuilder</code>); this generates the final firmware image for the LXR and requires regular <code>g++</code> to compile. It combines the AVR and the ARM code into a single image that can be uploaded from the SD-Card.
* Download of GNU bare metal ARM toolchain from https://launchpad.net/gcc-arm-embedded (v4.8)
 
* Take the MAC version (something like : gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2 )
 
* Extract the compressed/tar file.
 
* Copy the extracted folder under /usr/local/
 
* Nothing else to do !
 
  
== Change your PATH ==  
+
== AVR toolchain ==  
* We need to add a specific PATH for both compilers (and libs) for the MAC. Here is mine...
+
* Download the Atmel AVR 8-bit toolchain for Mac from http://www.obdev.at/products/crosspack/download.html
 +
* You will get a <code>.dmg</code> file that you should extract and install (<code>CrossPack-AVR-20131216.dmg</code> is the most recent as of 2014/05/02)
 +
* The compiler and libs are installed under <code>/usr/local/CrossPack-AVR</code>
 +
** Note: this will be a symlink to a folder like <code>/usr/local/CrossPack-AVR-20131216</code>
  
    export PATH=$PATH:/usr/local/CrossPack-AVR-20131216/bin:/usr/local/CrossPack-AVR-20131216/:/usr/include:/usr/local/CrossPack-AVR-20131216/avr/include:/usr/local/gcc-arm-none-eabi-4_8-2014q1/bin
+
== GNU ARM toolchain ==
    export ARM_TOOLKIT_ROOT=/usr/local/gcc-arm-none-eabi-4_8-2014q1
+
* Download the GNU bare metal ARM toolchain from https://launchpad.net/gcc-arm-embedded
    export AVR_TOOLKIT_ROOT=/usr/local/CrossPack-AVR-20131216
+
** Note: get the Mac version (something like <code>gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2</code>)
 +
* Extract the compressed tar file to /usr/local
  
* in a terminal window, execute "source ./.bash_profile" to update the PATH to your system.
+
    cd /usr/local && tar -jxf /path/to/gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2
* for the moment, don't try to understand what are ARM_TOOLKIT / AVR_TOLLKIT variables, we will explain why we need this later.
 
  
== Grab the LXR Code ==  
+
== Set environment variables ==
We advice you to grab the code either from :
+
* We need to set a couple of environment variables for both compiler sets.
  
     Julian repository on GITHUB (https://github.com/SonicPotions/LXR)
+
     export ARM_TOOLKIT_ROOT=/usr/local/gcc-arm-none-eabi-4_8-2014q1
    PLD repository (https://github.com/patrickdowling/LXR)
+
     export AVR_TOOLKIT_ROOT=/usr/local/CrossPack-AVR
    rudeog repository (https://github.com/rudeog/LXR) -> extra features compared to Julian code.
 
     rstephane repository (https://github.com/rstephane/LXR) -> equivalent to Julian CODE.
 
 
 
- of course once downloaded, you should extract the code and copy it to any folder you like.
 
On our side we copied it under: /Users/music/Documents/workspace/LXR/
 
 
 
== MACOS specific makefiles ==
 
We advice you to grab the makefiles either from :
 
  
    PLD repository (https://github.com/patrickdowling/LXR)
+
* You could add these to your <code>$HOME/.bashrc</code> to avoid setting them every time you start a terminal
    rstephane (@egnouf) repository (https://github.com/rstephane/LXR)
+
** Note: run <code>source $HOME/.bashrc</code> to avoid restarting your terminal the first time you do this
    RUDEOG repository https://github.com/patrickdowling/LXR
 
  
- You will find on the root path of both repository a file called MAKEFILE. You will also need the other makefiles:
+
== LXR source code ==
 +
A number of different repositories are available:
  
     https://github.com/patrickdowling/LXR/blob/makefiles/Makefile
+
     Julian's repository (original SonicPotions): https://github.com/SonicPotions/LXR
     https://github.com/patrickdowling/LXR/blob/makefiles/front/AVR/Makefile
+
     rudeog's repository: https://github.com/rudeog/LXR -> extra features compared to Julian's repo.
     https://github.com/patrickdowling/LXR/blob/makefiles/mainboard/firmware/DrumSynth_FPU/Makefile
+
     pld's repository: https://github.com/patrickdowling/LXR
     https://github.com/patrickdowling/LXR/blob/makefiles/tools/FirmwareImageBuilder/Makefile
+
     rstephane repository (https://github.com/rstephane/LXR -> equivalent to Julian's repo.
  
* Once downloaded, copy them at the root PATH of the code (1) and in subfolders (2,3,4) you dowloaded in STEP 4.
+
For example, from Terminal
* '''If you have taken the whole LXR code from @PLD or rstephane or @RUDEOG you don't need to download once more the Makefiles, they are provided within !'''
 
  
Now, let's go back to the .bash_profile file:
+
    # This will create a new directory called "LXR"
 
+
     git clone https://github.com/rudeog/LXR
     export PATH=$PATH:/usr/local/CrossPack-AVR-20131216/bin:/usr/local/CrossPack-AVR-20131216/:/usr/include:/usr/local/CrossPack-AVR-20131216/avr/include:/usr/local/gcc-arm-none-eabi-4_8-2014q1/bin
 
    export ARM_TOOLKIT_ROOT=/usr/local/gcc-arm-none-eabi-4_8-2014q1
 
    export AVR_TOOLKIT_ROOT=/usr/local/CrossPack-AVR-20131216
 
  
* You can notice the two variables '''ARM_TOOLKIT_ROOT''' and '''AVR_TOOLKIT_ROOT'''.
+
See https://help.github.com/ and http://git-scm.com/book for further tutorials about how to use Git.
* They are used by the MAKEFILE that has created @PLD (and also used by rstephane).
 
* Change their values appropriately, according to your system path, where you installed the libs... etc.
 
  
== Compile ==  
+
== Compile the firmware ==  
  
* You just have to launch the command "make firmware" from a MAC terminal window (under your LXR code root path i.e /Users/music/Documents/workspace/LXR/)
+
* Open a terminal window, and change directory to where you cloned the repository
). To clean the code you can execute "make clean".
+
    cd /Users/music/Documents/workspace/LXR/
* You will get a FIRMWARE.BIN image (in fact, we compiled two programs and the makefile combine both to one single file !), copy this file on your SD CARD and follow instruction to upload your new firmware.
+
* To build the firmware
 +
    make firmware
 +
* To remove local build files
 +
    make clean
 +
* The generated firmware will be in <code>'firmware image/FIRMWARE.BIN'</code>
 +
* Copy to your SD card, and [[LXR_Owners_Manual#Firmware_update|update the firmware]]
  
If you have downloaded rstephane code, similar to @Julian and @PLD, you will noticed that when you power on the machine, it displays "LXR-Drums-V" instead of "LXR Drums V". If so, you have successfully loaded (and compiled) LXR CODE!!!!
+
If you have downloaded rstephane code, similar to @Julian and @PLD, you will notice that when you power on the machine, it displays "LXR-Drums-V" instead of "LXR Drums V". If so, you have successfully loaded (and compiled) the LXR firmware!!!!
  
 
Well done and happy hacking!
 
Well done and happy hacking!

Latest revision as of 10:33, 10 May 2014

Tested on 10.8.x and 10.9.2; likely needs Xcode installed also (https://developer.apple.com/xcode/downloads/)

General steps

The LXR code is divided into two main parts

  • the AVR Atmel code (display and front-panel control)
  • the Cortex M4 ARM code (main LXR code for DSP, sequencer, USB etc.)

We need different toolkits to handle compilation of each set of code.

There is also a firmware utility (see tools/FirmwareImageBuilder); this generates the final firmware image for the LXR and requires regular g++ to compile. It combines the AVR and the ARM code into a single image that can be uploaded from the SD-Card.

AVR toolchain

  • Download the Atmel AVR 8-bit toolchain for Mac from http://www.obdev.at/products/crosspack/download.html
  • You will get a .dmg file that you should extract and install (CrossPack-AVR-20131216.dmg is the most recent as of 2014/05/02)
  • The compiler and libs are installed under /usr/local/CrossPack-AVR
    • Note: this will be a symlink to a folder like /usr/local/CrossPack-AVR-20131216

GNU ARM toolchain

  • Download the GNU bare metal ARM toolchain from https://launchpad.net/gcc-arm-embedded
    • Note: get the Mac version (something like gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2)
  • Extract the compressed tar file to /usr/local
   cd /usr/local && tar -jxf /path/to/gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2

Set environment variables

  • We need to set a couple of environment variables for both compiler sets.
   export ARM_TOOLKIT_ROOT=/usr/local/gcc-arm-none-eabi-4_8-2014q1
   export AVR_TOOLKIT_ROOT=/usr/local/CrossPack-AVR
  • You could add these to your $HOME/.bashrc to avoid setting them every time you start a terminal
    • Note: run source $HOME/.bashrc to avoid restarting your terminal the first time you do this

LXR source code

A number of different repositories are available:

   Julian's repository (original SonicPotions): https://github.com/SonicPotions/LXR
   rudeog's repository: https://github.com/rudeog/LXR -> extra features compared to Julian's repo.
   pld's repository: https://github.com/patrickdowling/LXR
   rstephane repository (https://github.com/rstephane/LXR -> equivalent to Julian's repo.

For example, from Terminal

   # This will create a new directory called "LXR"
   git clone https://github.com/rudeog/LXR

See https://help.github.com/ and http://git-scm.com/book for further tutorials about how to use Git.

Compile the firmware

  • Open a terminal window, and change directory to where you cloned the repository
   cd /Users/music/Documents/workspace/LXR/
  • To build the firmware
   make firmware
  • To remove local build files
   make clean
  • The generated firmware will be in 'firmware image/FIRMWARE.BIN'
  • Copy to your SD card, and update the firmware

If you have downloaded rstephane code, similar to @Julian and @PLD, you will notice that when you power on the machine, it displays "LXR-Drums-V" instead of "LXR Drums V". If so, you have successfully loaded (and compiled) the LXR firmware!!!!

Well done and happy hacking!