Difference between revisions of "LXR OSX build instructions"

From Sonic Potions Wiki
Jump to: navigation, search
m (Compile the firmware)
 
(5 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
*the Cortex M4 ARM code (main LXR code for DSP, sequencer, USB etc.)
 
*the Cortex M4 ARM code (main LXR code for DSP, sequencer, USB etc.)
  
We need different toolkits to manage compilation of each set of code.
+
We need different toolkits to handle compilation of each set of code.
  
There is also a firmware compiling utility (see <code>tools/FirmwareImageBuilder</code> which generates the final firmware image for the LXR).
+
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.
  
 
== AVR toolchain ==  
 
== AVR toolchain ==  
 
* Download the Atmel AVR 8-bit toolchain for Mac from http://www.obdev.at/products/crosspack/download.html
 
* 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)
+
* 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 /usr/local/CrossPack-AVR
+
* The compiler and libs are installed under <code>/usr/local/CrossPack-AVR</code>
** This will be a symlink to a folder like /usr/local/CrossPack-AVR-20131216
+
** Note: this will be a symlink to a folder like <code>/usr/local/CrossPack-AVR-20131216</code>
  
 
== GNU ARM toolchain ==  
 
== GNU ARM toolchain ==  
 
* Download the GNU bare metal ARM toolchain from https://launchpad.net/gcc-arm-embedded
 
* Download the GNU bare metal ARM toolchain from https://launchpad.net/gcc-arm-embedded
** Get the Mac version (something like <code>gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2</code>)
+
** 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
 
* Extract the compressed tar file to /usr/local
  
Line 32: Line 32:
 
     export AVR_TOOLKIT_ROOT=/usr/local/CrossPack-AVR
 
     export AVR_TOOLKIT_ROOT=/usr/local/CrossPack-AVR
  
* If you like you could add these to your <code>$HOME/.bashrc</code> to avoid setting them every time you start a terminal
+
* You could add these to your <code>$HOME/.bashrc</code> to avoid setting them every time you start a terminal
 
** Note: run <code>source $HOME/.bashrc</code> to avoid restarting your terminal the first time you do this
 
** Note: run <code>source $HOME/.bashrc</code> to avoid restarting your terminal the first time you do this
  
Line 47: Line 47:
 
     # This will create a new directory called "LXR"
 
     # This will create a new directory called "LXR"
 
     git clone https://github.com/rudeog/LXR
 
     git clone https://github.com/rudeog/LXR
 
Makefiles are included in the <code>rudeog</code> & <code>patrickdowling</code> repositories
 
  
 
See https://help.github.com/ and http://git-scm.com/book for further tutorials about how to use Git.
 
See https://help.github.com/ and http://git-scm.com/book for further tutorials about how to use Git.
Line 60: Line 58:
 
* To remove local build files
 
* To remove local build files
 
     make clean
 
     make clean
* The generated firmware will be in <code>firmware image/FIRMWARE.BIN</code>
+
* 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]]
 
* Copy to your SD card, and [[LXR_Owners_Manual#Firmware_update|update the firmware]]
  

Latest revision as of 09: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!