Fraunhofer-IMS / AIfES_for_Arduino

This is the Arduino® compatible port of the AIfES machine learning framework, developed and maintained by Fraunhofer Institute for Microelectronic Circuits and Systems.
GNU Affero General Public License v3.0
216 stars 45 forks source link

Fix bug in aifes_config.h #13

Closed dnadalini closed 4 months ago

dnadalini commented 2 years ago

Hello,

While trying to compile AIfES on an STM32 Nucleo-64 board (STM32L476RG), I got the following error, after including the library in my project:

Description Resource    Path    Location    Type
expected identifier or '(' before '=' token ailoss_crossentropy_default.c   /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/ailoss   line 28 C/C++ Problem
expected identifier or '(' before '=' token ailoss_crossentropy_default.c   /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/ailoss   line 52 C/C++ Problem
expected identifier or '(' before '=' token aimath_f32_default.c    /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 29 C/C++ Problem
expected identifier or '(' before '=' token aimath_f32_default.c    /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 30 C/C++ Problem
expected identifier or '(' before '=' token aimath_q31_default.c    /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 28 C/C++ Problem
expected identifier or '(' before '=' token aimath_q31_default.c    /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 29 C/C++ Problem
expected identifier or '(' before '=' token aimath_q31_default.c    /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 443    C/C++ Problem
expected identifier or '(' before '=' token aimath_q7_default.c /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 28 C/C++ Problem
expected identifier or '(' before '=' token aimath_q7_default.c /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 29 C/C++ Problem
expected identifier or '(' before '=' token aimath_q7_default.c /AIfES_TestBug/AIfES_for_Arduino/src/basic/default/aimath   line 30 C/C++ Problem
make: *** [AIfES_for_Arduino/src/basic/default/ailoss/subdir.mk:22: AIfES_for_Arduino/src/basic/default/ailoss/ailoss_crossentropy_default.o] Error 1   AIfES_TestBug           C/C++ Problem
make: *** [AIfES_for_Arduino/src/basic/default/aimath/subdir.mk:25: AIfES_for_Arduino/src/basic/default/aimath/aimath_f32_default.o] Error 1    AIfES_TestBug           C/C++ Problem
make: *** [AIfES_for_Arduino/src/basic/default/aimath/subdir.mk:25: AIfES_for_Arduino/src/basic/default/aimath/aimath_q31_default.o] Error 1    AIfES_TestBug           C/C++ Problem
make: *** [AIfES_for_Arduino/src/basic/default/aimath/subdir.mk:25: AIfES_for_Arduino/src/basic/default/aimath/aimath_q7_default.o] Error 1 AIfES_TestBug           C/C++ Problem
make: *** Waiting for unfinished jobs....   AIfES_TestBug           C/C++ Problem

Going back to the sources, I found that this is caused by an incomplete macro inside:

AIfES_for_Arduino/src/aifes_config.h
line 96:  #define AISTRING_STORAGE_WRAPPER(S) 

Replacing line 96 with:

#define AISTRING_STORAGE_WRAPPER(S)     const char S[]

seems to fix the problem (which occurs at line 29, 30 of "src/basic/default/aimath/aimath_f32_default.c").

JustusViga commented 2 years ago

Hi @dnadalini,

thanks for reporting the issue. We will fix the bug with the next release of AIfES. Until then your fix is fine. However, the desired behavior would be that the string S is not created in that case to save memory.

Best regards Justus

LarsWulfert commented 4 months ago

Bug was fixed with the lattest update to AIfES 2.2.0