Search code examples
ccross-compilinggslmcu

How to crosscompile GSL for Arm Cortex M4?


I am using a STM32 MCU with arm cortex m4 and want to use the gsl-2.7.1. However, I already tried for example the command ./configure --prefix=/home/user_name/gsl_arm --target=arm-none-eabi and every other suggestion that I could find on the internet and toolchain-tutorials, but in the best case I got during linking with the build library an error like "could not recognize the symbols". In the worst case, the suggested options for autoconfig were not recognized (for example, to specify the cpu). Does anyone have an idea how I have to crosscompile it?


Solution

  • There is a small mistake in the accepted answer.


    Note that you have to use software floating point, since some libraries are only working with this.

    Software floating pointing is not a strict requirement, and you can indeed compile GSL with a hard floating point Application Binary Interface (ABI) .

    The compiler flags variable CFLAGS has been misspelled as CCFLAGS. Hence the specified compiler flags are ignored. This is problematic as GSL's configure script generates makefiles for nested modules in addition to the main makefile for the entire libary.

    Consequently, modules such as ieee-utils,siman etc within the GSL directory are compiled with the default floating-point ABI flag (softfp).

    Since compiler flags are also passed as parameters to the linker, compilation of the GSL leads to the mismatch as the expectation of a hard fp ABI clashes with the aforementioned modules being compiled for a softfp ABI.


    I was able to compile the GSL with a hard floating point ABI and generate a static library for bare metal firmware development on a BeagleBone Black (ARM Cortex-A8).