User Tools

Site Tools


linux_mios32_toolchain_core

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
linux_mios32_toolchain_core [2010/11/30 20:23]
philetaylor created
linux_mios32_toolchain_core [2024/04/05 15:29]
phatline [Setup MIOS32 Environment]
Line 1: Line 1:
-====== ​CORE32 ​Toolchain Setup ====== +====== ​Core Toolchain Setup ====== 
-     How to set up the toolchain ​for coding ​MIOS32 ​apps with Linux+    for MIOS32 ​application development on Linux
  
-You must ensure ​that you have the basic developer tools (make etc) installed. The procedure for this varies depending on your distribution. ​For Ubuntu/​Debian ​the command ​"sudo aptitude ​install build-essential subversion wget" ​should install the necessary tools+ \\ 
 +====== Preparation ====== 
 +This document assumes ​that you have a relatively modern x86 based linux distribution. ​While it may work other distributions,​ it has only been tested on x86 Ubuntu ​10.10. Many of the commands, especially ​"​aptitude" ​are only available on Debian derived distributions like Ubuntu.
  
 +====== Linux Utilities ======
  
-==== Download the MIOS32 repository ​====+===== subversion =====
  
-Create a directory ​to download the toolchain ​to ( ~/midibox is my personal favourite). and download the repository:+You will need to install subversion ​to download the svn repository\\ 
 +  * sudo aptitude install subversion
  
-1. mkdir ~/midibox +===== wget ===== 
-2. chdir ~/midibox +Wget is a useful tool for downloading files from the Internet and can be downloaded with:\\ 
-3. svn checkout svn://​svnmios.midibox.org/​mios32+  * sudo aptitude install wget
  
 +====== Required Stuff ======
 +===== Download the MIOS32 repository =====
 +Create a directory to download the toolchain to ( ~/midibox is my personal favourite). and download the repository:
 +  * mkdir ~/midibox
 +  * cd ~/midibox
 +  * svn checkout svnmios.midibox.org/​mios32
  
-==== Install the STM32 toolchain ==== +  ​(If that doesn'​t work try:
- +  * svn checkout svn://svnmios.midibox.org/mios32/
-The MIDIbox community have created a modified GNU Compiler Collection, ready for use with the ARM Cortex M3 platform. The toolchain contains all of the tools required to build MIOS32 applications including GCC and NEWLIB.  +
- +
-The Toolchain has currently been compiled for Windows ​(2000+), Mac OS X (Leopard or newer) and Linux x86 (built on Ubuntu 10.10). +
- +
-The download directory for the toolchain is ftp://ftp.lansystems.co.uk/​pub/​midibox +
- +
-Download the latest "​linux86"​ file and extract into your favorite directory, If you extract into /usr/local the toolchain will create /​usr/​local/​mios32_toolchain and various sub-directories containing the toolchain files. +
- +
-1chdir /usr/local +
-2. sudo wget ftp://​ftp.lansystems.co.uk/​pub/​midibox/​mios32_toolchain_linux86_xxxxxxxx.tgz +
-2. sudo tar zxvf mios32_toolchain_linux86_xxxxxxxx.tgz+
  
-replace xxxxxxx with the date of the latest linux toolchain in ftp://ftp.lansystems.co.uk/pub/midibox+===== Linux build utilities ===== 
 +Terminal commands for installing basic build tools like "​make"​:\\ 
 +*** Debian/Ubuntu/Mint:** //sudo aptitude install build-essential//​\\ 
 +*** Arch Linux/​Manjaro:​** //sudo pacman -S base-devel//\\
  
-You now need to set the path variable for the toolchain bin directory ​(/usr/local/mios32_toolchain/bin), see the next section about this+===== GNU Multiple Precision Library ===== 
 +Terminal Commands:​\\ 
 +*** Debian/​Ubuntu/​Mint:​**//​ sudo aptitude install libgmp3-dev// ​(or //lib32gmp3-dev//   for AMD64Version)\\ 
 +*** Arch Linux/​Manjaro:​** //sudo pacman -S gmp//\\
  
-==== Environment ​variables ​====+===== MIOS32 Toolchain ===== 
 +The MIDIbox community have created a modified GNU Compiler Collection, ready for use with the ARM Cortex M3 platform. The toolchain contains all of the tools required to build MIOS32 applications including GCC and NEWLIB.\\ 
 +\\ 
 +The Toolchain has currently been compiled for Windows (2000+), Mac OS X (Leopard or newer) and Linux x86 (built on Ubuntu 10.10).\\ 
 +\\ 
 +The download directory for the toolchain is http://​www.midibox.org/​mios32_toolchain\\ 
 +\\ 
 +Download the latest "​linux"​ file and extract into your favorite directory, If you extract into /usr/local the toolchain will create /​usr/​local/​mios32_toolchain and various sub-directories containing the toolchain files.\\ 
 +  * cd /​usr/​local 
 +  * sudo wget http://​www.midibox.org/​mios32_toolchain/​gcc-arm-none-eabi-xxxxxx.tar.bz2 
 +  * sudo tar zxvf gcc-arm-none-eabi-xxxxxx.tar.bz2 
 +\\ 
 +replace xxxxxxx with the date of the latest linux toolchain in http://​www.midibox.org/​mios32_toolchain\\ 
 +\\ 
 +You now need to set the path variable for the toolchain bin directory (/​usr/​local/​mios32_toolchain/​bin) this is covered in the next section\\ 
 +\\ 
 +====== Environment ​Variables ​====== 
 +If you are using the default bash shell then setting up path variables in the shell is quite easy, in a terminal window just type:\\ 
 +  * export VARIABLE_NAME=something 
 +and if you want to check to what the variable has been assigned, type:\\ 
 +  * echo $VARIABLE_NAME 
 +this will print what's inside the variable. For example, type:\\ 
 +  *export MIOS32_PATH=~/​svn/​mios32/​trunk 
 +to set up the mios32 folder path, then type\\ 
 +  *echo $MIOS32_PATH
  
 +===== Adding to the path =====
  
-Setting up path variables in the shell is quite easy: in a terminal window just type\\  +To temporarily add the mios32_toolchain bin directory ​to the path, type:\\ 
-''​export VARIABLE_NAME=something''​\\  +  ​* ​export ​PATH=$PATH:/usr/local/mios32_toolchain/​bin
-and if you want to check to what the variable has been assigned, type:\\  +
-''​echo $VARIABLE_NAME''​\\  +
-this will print what's inside the variable.\\  +
-For example, type\\  +
-''​export ​MIOS32_PATH=~/svn/mios32/trunk''​\\  +
-to set up the mios32 folder path, then type\\  +
-''​echo $MIOS32_PATH''​\\  +
-to check that the path variable has been assigned.+
  
-In our case, we need to set up the path variable ​for the STM32 toolchain: +to check that the path variable ​has been assigned type:\\ 
-type in the terminal\\  +  * echo $PATH 
-''​export PATH=$PATH:/​usr/​local/​mios32_toolchain/​bin''​\\ ​ +You should see the toolchain directory at the end of the path
-and then we need to set up variables for mios32 itself:\\  +
-''​export MIOS32_PATH=~/​midibox/​mios32/​trunk\\  +
-export MIOS32_BIN_PATH=$MIOS32_PATH/​bin\\  +
-export MIOS32_GCC_PREFIX=arm-none-eabi\\  +
-export MIOS32_FAMILY=STM32F10x\\  +
-export MIOS32_PROCESSOR=STM32F103RE\\  +
-export MIOS32_BOARD=MBHP_CORE_STM32\\  +
-export MIOS32_LCD=clcd''​\\ ​+
  
-Here I considered that you have put all the files downloaded from the svn server in the directory "​~/​midibox/​mios32/​trunk"​ but up to you to put them elsewhere if you want and change the "​MIOS32_PATH"​ variable accordingly.+===== Setup MIOS32 Environment =====
  
-Now everything is set up to compile properly your projects. Test if everything is OKopen a terminal window, type\\  +The following commands will setup the build environment for MIOS32you must change ​MIOS32_PATH to be wherever you installed ​the svn repository:\\
-''​cd $MIOS32_PATH/​apps/​tutorials/​001_forwarding_midi''​\\  +
-to go to the "​forwarding_midi"​ tutorial folder and type\\  +
-''​make -s''​\\  +
-you should have a return looking like this:\\  +
-''​-------------------------------------------------------------------------------\\  +
-Application successfully built for:\\  +
-Processor: STM32F103RE\\  +
-Family: ​   STM32F10x\\  +
-Board: ​    ​MBHP_CORE_STM32\\  +
-LCD:       ​clcd\\  +
--------------------------------------------------------------------------------''​\\  +
-and with the finder, go to this tutorial folder, you should have now a .hex file uploadable to your core32 with "​MIOSStudio beta 9".+
  
-The annoying point there is that the variables you set up in the shell just disappear when you shut down or log off your computer. That means you have to set them up again when you power on your computer againThere'​s a way to avoid this annoying stuff:\\  +  * export MIOS32_PATH=~/​midibox/​mios32/​trunk\\ 
-The shell will always read particular files before starting up. If you put these variables there they will always be set up. I didn't really understood if the proper file was    "~/.bash_profile"​ "~/.bash_login"​ "~/.profile"​ or "/etc/profile"​ to do that, it looks like they all do the job.\\  +  * export MIOS32_BIN_PATH=$MIOS32_PATH/​bin\\ 
-Moreover, all these files are hidden from the finderso the best way to edit them is to open a terminal window and edit them with the "pico" ​editor.\\  +  * export MIOS32_GCC_PREFIX=arm-none-eabi\\ 
-If you don't understand what's going on, here's what I did:+  * export MIOS32_FAMILY=STM32F10x\\ 
 +  * export MIOS32_PROCESSOR=STM32F103RE\\ 
 +  * export MIOS32_BOARD=MBHP_CORE_STM32\\ 
 +  * export MIOS32_LCD=universal\\ 
 +\\ 
 +\\  
 +You can add these lines to your ~/.profile file to ensure ​that they are always ​setthe editor pico (or nano) is a fairly simple text editor but you may have your favourite.\\ 
 +\\ 
 +__ 
 +**If you know what you are Doing in Linux-you can do this systemwide:​**__\\ 
 +open your filebrowser with sudo rights, for example type in terminal:​\\ 
 +*** Linux Mint:​** ​//sudo nemo// \\ 
 +*** Linux Arch:** //sudo thunar//\\ 
 +the filebrowser now opens with root rightsnavigate to the folder "​etc" ​open the file "environment" ​>>>​ **/​etc/​environment**\\ 
 +Depending ​on the path where your toolchain is situatedthe Example Content off this file is:\\
  
-in a terminal window, type:\\  +//​PATH="/​home/​autark/​midibox/​gcc-arm-none-eabi/​bin"​\\
-''​pico ~/.profile''​\\  +
-then copy and paste these lines inside the pico editor:\\ +
  
-''​export PATH=$PATH:/usr/local/mios32_toolchain/bin\\  +MIOS32_PATH=/home/autark/midibox/mios32\\ 
-export MIOS32_PATH=~/​midibox/​mios32/​trunk\\  +MIOS32_BIN_PATH=/​home/​autark/​midibox/​mios32/​bin\\ 
-export MIOS32_BIN_PATH=$MIOS32_PATH/​bin\\  +MIOS32_BOARD=MBHP_CORE_STM32F4\\ 
-export ​MIOS32_GCC_PREFIX=arm-none-eabi\\  +MIOS32_FAMILY=STM32F4xx\\ 
-export MIOS32_FAMILY=STM32F10x\\  +MIOS32_GCC_PREFIX=arm-none-eabi\\ 
-export ​MIOS32_PROCESSOR=STM32F103RE\\  +MIOS32_PROCESSOR=STM32F407VG\\ 
-export MIOS32_BOARD=MBHP_CORE_STM32\\  +MIOS32_LCD=universal//\\
-export ​MIOS32_LCD=clcd\\ +
-echo MIOS32 variables initialized.''​\\ +
  
-do "ctrl-O" ​to save the file\\  +if you cant log after reboot, then mostly you messed up your "PATH" ​variable, in this case, boot with Linuxbootstick,​ and remove ​the PATH line...\\
-do "ctrl-X" to exit\\ +
  
-Once you open a new terminal, ​the variables will be set automaticallyand you should see the "MIOS32 variables initialized" ​message.\\ +**you can also add more folders to the PATHthey are separeted with a ":"for example:**\\ 
-It isn't required to log off or shut down your computer to test this.\\  +* PATH="/home/autark/midibox/gcc-arm-none-eabi/bin:/home/autark/program"​\\ 
-Open a terminal window and check if the variables are all set up by typing:\\  +here we also have folder named "​program",​ when you put in there "Mios Studio",​ then you can write in Terminal "Mios Studio"​ and mios studio will open\\
-''​echo $MIOS32_PATH'' ​for example.\\  +
-If you don't see the messages (and MIOS32 variables don't exist), that's probably because a .bash_login or .bash_profile already exists (edit only an already existing file - of none exists, use .profile).\\  +
-Useful info about bash and initialisation files here:\\  +
-[[http://johnnywey.wordpress.com/2008/04/​17/​fixing-bash-profile-in-os-x/|http://johnnywey.wordpress.com/2008/​04/​17/​fixing-bash-profile-in-os-x/​]]\\  +
-and here:\\  +
-[[http://​macdevcenter.com/​pub/​a/​mac/​2004/​02/​24/​bash.html|http://​macdevcenter.com/​pub/​a/​mac/​2004/​02/​24/​bash.html]]\\ +
  
  
 +===== Building your first application =====
 +Once you have completed the above steps, you should be able to build your first application.
 +  * cd $MIOS32_PATH/​apps/​tutorials/​001_forwarding_midi
 +  * make
 +if this works great! If not, either you made a mistake (or I did!!)
linux_mios32_toolchain_core.txt · Last modified: 2024/05/23 19:46 by phatline