Eigen library with Zephyr on 52832 mem_manage_fault

Hello, 

I am trying to use Eigen matrix library in a project on the nrf52832. 

I was able to compile a very simple example however I get a mem_manage_fault while debugging. 

There should definitely be enough memory to invert a 5 by 5 matrix and I am struggling to figure out what the issue is. 

Since the matrix size is defined at compile time Eigen should not even be using malloc anywhere.

If anyone has an idea why the mem_manage_fault occurs or how I should debug it please let me know. 

 

Code:

#define EIGEN_MALLOC_ALREADY_ALIGNED 1
#define EIGEN_NO_MALLOC
#define EIGEN_RUNTIME_NO_MALLOC 1
#define EIGEN_INTERNAL_DEBUGGING
#define EIGEN_DONT_VECTORIZE
#define EIGEN_UNROLLING_LIMIT 0
#include <Eigen/Dense>

Eigen::Matrix<float, 5, 5> mat;
Eigen::Matrix<float, 5, 5> mat_i;
void main(void)
{
    mat.setIdentity();     <----------NO PROBLEM HERE
    mat_i = mat.inverse(); <----------MEM_MANAGED_FAULT
}

Config:

CONFIG_GPIO=y
CONFIG_MINIMAL_LIBC=n
CONFIG_CPLUSPLUS=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_STD_CPP17=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=n
CONFIG_EXCEPTIONS=y
CONFIG_FPU=y
CONFIG_FP_HARDABI=y
CONFIG_FP_SOFTABI=n
CONFIG_BUILD_WITH_TFM=n
CONFIG_RESET_ON_FATAL_ERROR=n

Related