cancel
Showing results for 
Search instead for 
Did you mean: 

Compile LAPACK (and BLAS) for STM32L452CEU5 (C++)

tabula_rasa
Associate

Hi,

I'm trying to use Armadillo (http://arma.sourceforge.net/docs.html) with the above mentioned STM32 MCU.

The goal is to use it for the inversion of a dense, symmetric, positive semi-definite Matrix (actually a convariance matrix) with float values (not double). (all other opterations, e.g. matrix additions and multiplications are working fine so far, except inverse)

The problem is, that Armadillo is capable of inverting matrices up to 4x4 without using LAPACK (and BLAS). But my matrices are bigger than 4x4 (worst case approx. 10x10).

Is there a way, to use LAPACK (and BLAS) on this MCU platform in combination with Armadillo ??

Of course I found a lot of information on the net and also tried several things like using Eigen library, solvers for linear equ.systems, CLAPACK, EmbeddedLapack (by DanielMartensson), but with no success (bad performance, compatibility, ...).

Working environment:

Win10 PC, CubeMX, STM32 system workbench, C++ project with MCU G++ Compiler

gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)

GNU C++14 (GNU Tools for Arm Embedded Processors 7-2017-q4-major) version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (arm-none-eabi)

Hope, that there is somebody out there, who can tell me if this is even possible with less to moderate effort.

Thanks in advance.

tabula_rasa

3 REPLIES 3
Ozone
Lead

Well, microcontrollers are not quite made for number crunching, not much experience with the named libraries.

> The goal is to use it for the inversion of a dense, symmetric, positive semi-definite Matrix (actually a convariance matrix) with float values (not double).

Considering the rather pathetic accuracy of single precision, I would check if the code/algorithms are stable. This wouldn't be the first project screwed up for purely numerical reasons.

tabula_rasa
Associate

Hello Ozone(O3), first of all, thanks for taking your time and giving some feedback.

I know, that these MCUs are not that great for such operations, but the STM32L4 is the best I could get - right now (pin compatible - no redesign needed).

There have been some tests concerning stability of the algorithm with float values and it turned out, that this should not be too much of a problem (at least with some additional checks in the right places 😉 )

Isn't there anybody, who has ever tried to use LAPACK libraries with this architecture? Unfortunately, I have no clue if it is even possible to compile these libraries for this MCU.

Ozone
Lead

The amount of answers here speaks volumes ...

Perhaps you widen your scope, and ask in other, even non-vendor specific, ARM Cortex M fora.

I don't know LAPACK, but you can try to download and compile it in a demo project, and check what else it needs.

I expect a bunch of mainly libc function, which do already exist to some extend.

But some concepts stemming from an environment with virtually unlimited resources could be tricky to port.