Both sides previous revisionPrevious revisionNext revision | Previous revision |
guides:stm32toolchain [2014/08/17 16:56] – jonsowman | guides:stm32toolchain [2016/04/07 20:48] (current) – [Step 5 (libopencm3 Libraries)] mbrejza |
---|
* For use of newlib-nano, best to grab the binary tarball from https://launchpad.net/gcc-arm-embedded. Latest at time of writing is gcc-arm-none-eabi-4_8-2014q2 (-linux or -mac one as appropriate). | * For use of newlib-nano, best to grab the binary tarball from https://launchpad.net/gcc-arm-embedded. Latest at time of writing is gcc-arm-none-eabi-4_8-2014q2 (-linux or -mac one as appropriate). |
* Extract to somewhere like /usr/local and add /usr/local/gcc-arm-none-eabi-4_8-2014q2/bin to PATH, by adding: | * Extract to somewhere like /usr/local and add /usr/local/gcc-arm-none-eabi-4_8-2014q2/bin to PATH, by adding: |
export PATH=/usr/local/gcc-arm-none-eabi-4_8-2014q2/bin:$PATH to your ~/.bashrc (assuming using bash). | ''export PATH=/usr/local/gcc-arm-none-eabi-4_8-2014q2/bin:$PATH'' to your ~/.bashrc (assuming using bash). |
*Then to use the amended PATH: | *Then to use the amended PATH: |
''$ source ~/.bashrc'' | ''$ source ~/.bashrc'' |
| |
* Alternatively (and for when they fix newlib nano in the repos), install from ppa: | * Alternatively (and for when they fix newlib nano in the repos), install from ppa: |
''$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded | ''$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded'' |
| |
$ sudo apt-get update | ''$ sudo apt-get update'' |
| |
$ sudo apt-get install gcc-arm-none-eabi'' | ''$ sudo apt-get install gcc-arm-none-eabi'' |
| |
* Check install is working by running | * Check install is working by running |
==== Step 3 - Fetch and build libopencm3 ==== | ==== Step 3 - Fetch and build libopencm3 ==== |
- ''cd'' into the root of the repo | - ''cd'' into the root of the repo |
- Run $ ''git submodule update --init'' to fetch libopencm3. | - Run ''$ git submodule update --init'' to fetch libopencm3. |
- ''cd' to the libopencm3 directory and run ''make' to build. | - ''cd'' to the libopencm3 directory and run ''$ make'' to build. |
| |
==== Step 4 - Adjust for your device ==== | ==== Step 4 - Adjust for your device ==== |
| |
==== Step 5 (libopencm3 Libraries) ==== | ==== Step 5 (libopencm3 Libraries) ==== |
Firstly add the libopencm3 files to the project directory. This can be fetched from the [[https://github.com/libopencm3/libopencm3 | libopencm3 repository]] and compiled as per above instructions, however it is unlikely for all the tools (make, python and others) to be set up correctly. As a result, a precompiled version is available [[http://users.ecs.soton.ac.uk/mfb2g09/stm32/libopencm3.zip | here]]. Unzip the contents into a separate libopencm3 folder along side your project | Firstly add the libopencm3 files to the project directory. This can be fetched from the [[https://github.com/libopencm3/libopencm3 | libopencm3 repository]] and compiled as per above instructions, or run ''git submodule add https://github.com/libopencm3/libopencm3 .\firmware\libopencm3'' if you want to add it to an existing repository. Since it is unlikely for all the tools (make, python and others) to be set up correctly. As a result, a precompiled version is available [[http://users.ecs.soton.ac.uk/mfb2g09/stm32/libopencm3.zip | here]]. Unzip the contents into a separate libopencm3 folder along side your project |
| |
The final file needed is part of the linker script. Copy [[https://github.com/libopencm3/libopencm3-examples/blob/master/examples/stm32/f4/stm32f4-discovery/stm32f4-discovery.ld|this file (f4)]] or [[https://github.com/libopencm3/libopencm3-examples/blob/master/examples/stm32/f0/stm32f0-discovery/stm32f0-discovery.ld|this file (f0)]] along side your project. Note that this file needs editing depending on how much flash/RAM the target has | The final file needed is part of the linker script. Copy [[https://github.com/libopencm3/libopencm3-examples/blob/master/examples/stm32/f4/stm32f4-discovery/stm32f4-discovery.ld|this file (f4)]] or [[https://github.com/libopencm3/libopencm3-examples/blob/master/examples/stm32/f0/stm32f0-discovery/stm32f0-discovery.ld|this file (f0)]] along side your project. Note that this file needs editing depending on how much flash/RAM the target has |