3

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?

5
  • 1
    Why do you believe it should be supported on a bare-metal (I presume) Cortex-M4?
    – Eugene Sh.
    Jan 27, 2022 at 22:28
  • Which model stm32? See: st.com/en/microcontrollers-microprocessors/… you probably need FPU support which is optional on an M4. Jan 27, 2022 at 23:27
  • @EugeneSh.: It is not? In this tutorial somebody builds the gcc toolchain with arm-none-eabi, so I thought it would be for GSL the same way.
    – bilaljo
    Jan 28, 2022 at 6:50
  • @CraigEstey I am using an STM32L432KC, but it is not my final choice. Just for testing if the compiling of gsl etc. works.
    – bilaljo
    Jan 28, 2022 at 6:51
  • Sorry I missed to put a link to the referenced tutorial: linkedin.com/pulse/…
    – bilaljo
    Jan 28, 2022 at 8:56

3 Answers 3

2

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).

1
  • 2
    Not having sufficient reputation to comment, is not an excuse to use the answer section as the comment section. You seem to know what you're talking about, but you should edit your answer so that it is an answer so it doesn't get removed. Dec 20, 2022 at 14:41
1

I am glad to say that I was able to cross compile the GSL for Arm Cortex-M4. If you call autoconf with the following options:

COREFLAGS="-mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=soft"
./configure --prefix=/home/$(whoami)/gsl_arm CC=arm-none-eabi-gcc \
CXX=arm-none-eabi-gcc LD=arm-none-eabi-gcc AR=arm-none-eabi-ar \
OBJCOPY=arm-none-eabi-objcopy CCFLAGS="$COREFLAGS" CXXFLAGS="$COREFLAGS" \
LDFLAGS="--specs=nano.specs --specs=nosys.specs $COREFLAGS"  \
--host=x86_64-unknown-linux-gnu

The host is the host for my case, and make differ. Note that you have to use software floating point, since some libraries are only working with this.

1
1

I also cross compiled gsl for Arm Cortex-M4 and I had to add the RANLIB flag with the corresponding path as well, building on Darwin. That's because otherwise the compiler will use the native xcode ranlib program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.