Skip to main content
Lead
January 10, 2019
Question

Can I use GNU Scientific Library with STM32?

  • January 10, 2019
  • 3 replies
  • 2572 views

Hello!

Wonder if I can get compile the GNU Scientific Library for STM32? I need to cross compile GNU Scientific Library for STM32 before I can use it in my library. But how can I do that ?

I'm using TrueSTUDIO on Linux and also F401RE Nucleo. ​

I need a better linear algebra library than the built in CMSIS library.

This topic has been closed for replies.

3 replies

AvaTar
Senior III
January 10, 2019

I never tried - Microcontrollers are the impersonated cost optimization, so I never came upon such a use case. But don't see a reason why it should not work. The source code for GNU projects is usually available.

However, besides of probable dependencies to to other libs (at least clib), I expect an abysmal performance compared to x86 compatibles and Cortex A processors.

DMårtAuthor
Lead
January 10, 2019

I need to cross​ compile GSL for the CPU of F401RE first. But how can I do that ?

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-ComputerSTM32MP257FAK3 custom board with STM64-OS as operating system: https://github.com/DanielMartensson/STM64-Computer
AvaTar
Senior III
January 10, 2019

Microcontroller IDEs like TrueStudio are implicitly cross development tools.

You would need to fetch the GSL source code (your favourite search engine should tell you where), and add it to your F401 project.

Perhaps here: https://www.gnu.org/software/gsl/ and here: http://mirror.inode.at/gnu/gsl/

I would make it a separate library project, but this is a matter of taste.

As said, I'm not sure about dependencies, and sizes. Perhaps you can extract the parts you need, and drop the rest.

S.Ma
Principal
January 10, 2019

Quick look at the GSL manual PDF:

  • long double: forget it, unpractical
  • double: only STM32F467 and higher STM32 will have HW double instructions

All the functions using 32 bit float or 32 bit integers are the embedded non linux friendly calculation world. Even in android world, HW drivers usually refrain to use float (or double) and use actually a Q32 fractional bit structure: 32 bit for integer, and 32 bit fractional (1/2 1/4 1/8 1/16 1/32k) to remain energy and time efficient at "good enough" precision.

AvaTar
Senior III
January 11, 2019

One can sacrifice performance for precision. Even old 8 Bit computer running just BASIC interpreters had floating point numbers and calculations.

But this depends on the project requirements, and probably needs some preinvestigations.