Howto: STM32 Toolchain
For those, who need a recipe for a stm32 toolchain to compile baseflight (updated instructions made by CrazyLittle)
Arm Toolchain STM32:
Install CodeSourcery ARM G++ Lite toolchain. During the installation, set the PATH variable for all users when prompted.
Follow these instructions to install Eclipse and some Plugins (rest not neccessary)
Get the one for C/C++ (For Windows user: get the win32 version, unless you know, that you have a 64 bit java version on your computer)
Import the project using "Project from SVN" from http://afrodevices.googlecode.com/svn/trunk/baseflight as a "project configured using New Project Wizard"
* ARM Cross Target App / Empty / Sourcery G++ Lite
I went ahead and deleted the "debug" build configuration because I'm not going to be using a JTAG or doing any on-board debug or sim-debugging.
Once the project is checked out from the SVN, here's the project properties that need to be changed in order to setup the environment properly: Do a "Properties" on the linker script "stm32_flash.ld" that's in the main folder. Copy down the full file path to it in the Resource page. You'll need it for the next step. Open up the properties on the main project folder.
C/C++ Build/Settings/Target Processor
C/C++ Build/Settings/ARM Sourcery Windows GCC C Linker / General:
Script File: <absolute-file-path-to>\stm32_flash.ld
Uncheck [_] Do not use standard start files
Check [X] Remove unused sections
C/C++ Build/Settings/ARM Sourcery Windows GCC C Linker / Libraries:
(Yes, just "m" as one line in the libraries list since that's the math library.)
C/C++ Build/Settings/Add to ARM Sourcery Windows GCC C Compiler / Preprocessor - Defined symbols:
ARM Sourcery Windows GCC C Compiler / Directories:
ARM Sourcery Windows GCC C Compiler / Micellaneous:
Under "Other flags" add -fomit-frame-pointer
Part of the SVN checkout includes stuff from other projects that's not relevant to compiling baseflight. Tell Eclipse to ignore the contents of the /support folder:
Right click on Folder "support" Choose Resource Configuration-> Exclude from build
Press CTRL+B to build and compile everything. Look inside the /Release folder to find your finished baseflight.hex file.
Thanks for providing us with this newb guide pm1 & CrazyLittle!
Using your more or less complete guide, I successfully compiled from the trunk with Windows 7. However, here are more details to make this process smoother for real newbs like me:
1) Downloading the CodeSourcery ARM G++ Lite toolchain... follow the link in the above post, and under "Arm Processors", choose the "EABI Release". You will now have to give your e-mail to the Mentor site to get a download link; if someone posted the installer here it would save the trouble. Click the e-mail link, and you'll be taken to a list of downloads. The latest "Sourcery CodeBench Lite" (2013.05-23 for me) is what I used. If you install the wrong flavor of toolchain like I did at first (ie GNU/Linux Release), later on when you go to build you'll get a bunch of errors instead of a hex file.
2) The instructions for installing the Eclipse plugins seem overwhelming. It's actually very easy. Start reading at "To install new components open...", and stop reading at "That’s all.".
3) Setup your workspace folder... I got errors checking out from SVN because my workspace folder was left default from the Eclipse install ("C:\Users\Kevin\workspace"). I am not sure how or why, but what worked for me... when you have Eclipse configured and are ready to checkout from SVN, first go to "File\Switch Workspace\Other...", and create a folder where you're going to keep everything. In my case, I made a folder named "baseflightTrug" inside the Eclipse install folder, which is located in My Documents (I think having the folder inside My Documents is important).
4) So we did all that work configuring the environment and compiled our hex... do we need to do all that over again for the next version of baseflight? Not 100% sure yet, but I think all you have to do is open up the project later on, right click on the main folder, "Replace With\Latest from Repository", and CTRL+B to spit out a hex from the latest source. So once you set everything up, making hex's is quick and easy.
Always use extreme caution when flying untested code!!!
|Category||Thread||Thread Starter||Forum||Replies||Last Post|
|New Product||zeroGravity - An STM32 Flightcontroller based on PIPO32 hardware||Jessestr||Multirotor Talk||40||Jun 25, 2012 09:18 PM|
|Question||Question: Howto cut slot in boom for rudder?||topgun300||Hand Launch||14||May 29, 2012 11:15 AM|