Thread Tools
This thread is privately moderated by Jack Crossfire, who may elect to delete unwanted replies.
Dec 29, 2012, 02:27 AM
Registered User
Jack Crossfire's Avatar
Thread OP
Discussion

Floating point ARM GCC notes


Adrucopter is attractive for all types of vehicles because the arduino framework has all the compilers, libraries, & floating point ready to go. Arducopter contains all the navigation routines any vehicle would need.

It would save a lot of time, but wouldn't be the bleeding edge fastest processing with scalability to video. Navigation routines of any kind require floating point.



Now, it's http://cu.rious.org/make/compiling-t...hain-yourself/ & http://www.kunen.org/uC/gnu_tool.html with more missing pieces to get floating point to work.


The trick is the STM32F4 only supports thumb or thumb2. There are 3 instruction sets on ARM: thumb, thumb2, & ARM. Thumb2 has hardware floating point on this chip.


The following line is needed to enable the floating point hardware:

SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */

It's also a good way to see if your program is really using the hardware floating point.


Fix PATH, MAKE, & make aliases. PATH must not contain the current directory. MAKE must be unset. make must not have a -j option.


Change --prefix to the right directory.



cd binutils*

./configure --target=arm-none-eabi --prefix=/opt/arm/ --enable-thumb --disable-interwork --enable-multilib --disable-nls --disable-libssp --with-fpu=fpv4-sp-d16


make all
make install
cd ..



cd gcc*
mkdir objdir
cd objdir/
Change --prefix, --with-headers to the right directories. Start gcc compilation.

../configure --target=arm-none-eabi --prefix=/opt/arm --enable-thumb --disable-interwork --enable-multilib --enable-languages="c" --with-newlib --with-headers=../../newlib-1.20.0/newlib/libc/include/ --disable-libssp --disable-nls --with-system-zlib --with-fpu=fpv4-sp-d16


make all-gcc
make install-gcc
cd ../..




cd newlib*/
./configure --target=arm-none-eabi --prefix=/opt/arm --enable-thumb --disable-interwork --enable-multilib --disable-libssp --disable-nls --with-fpu=fpv4-sp-d16

make all
make install
cd ..


Finish gcc compilation.


cd gcc*/objdir/
make all
make install
cd ../..




Get the floating point version with:

/opt/arm/bin/arm-none-eabi-gcc -print-multi-lib



There are massive variations between GCC versions. Gcc 4.7.2 succeeded at basic floating point math but failed in the networking driver. Gcc 4.6.2 failed at basic floating point math but succeeded in the networking driver.


There are many variations in compiler flags. Some of the most popular ones are:

-mthumb -mcpu=cortex-m4 -mfpu=fpa

Link with this:

-lm -lgcc



More nuggets of information were on:

http://www.triplespark.net/elec/pdev/arm/stm32.html


Those configure options got closest, but the programs still died when either calling sinf or any floating point operation at all. The problem seems to be the calling convention. Arm has multiple software & hardware calling conventions for floating point. 2 compiler options for different calling conventions are -mfpu=fpa & -mfpu=fpv but there are many combinations of calling conventions & instruction sets.

Only someone intimately involved with gcc development would be familiar enough with the myriad of configuration options to keep a floating point gcc toolchain up to date in a reasonable amount of time. The limiting factor being time, onboard navigation headed towards fixed point software routines or just stock arduino.
Last edited by Jack Crossfire; Dec 30, 2012 at 03:13 AM.
Sign up now
to remove ads between posts


Quick Reply
Message:
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question Tail Servo Arm / Gyro / End-Points Blade Crasher Electric Heli Talk 1 Sep 28, 2012 07:28 AM
Discussion Boosted end points, VS. longer servo arms.. SteveT. 3D Flying 14 Oct 20, 2009 10:40 PM
Poll At what point will Americans arm and organize to take back their nation? Astroguy Life, The Universe, and Politics 354 Feb 01, 2008 06:04 PM
Yak Shocky point of note Skunkerama 3D Flying 19 Dec 29, 2006 01:31 PM
Discussion Swift servo control arm center points Ohio AV8TOR Electric Heli Talk 5 Jul 10, 2006 09:06 AM