Code Breaks in memset During Quantized Image Classification inside run_classifier_image_quantized function

Hi Edge Impulse Community,

I’m facing an issue with the Edge Impulse SDK during image classification using quantized models. My code breaks at the following line in the run_classifier_image_quantized function within ei_run_classifier.h: * The project is built using EK-RA6M5 MCU and the E2 Studio IDE.

  • The issue occurs only during runtime, and the debugger halts at this line.


    I am trying to run the stand alone inferencing code on EK-RA6M5 MCU by Renesas. I built the Edge Impulse SDK as static library (libei_inference.a) and linked it with my project application in e2studio.

Has anyone faced a similar issue or have any insights on how to resolve this? Here is the link to my project: inference_testing.zip

Thank you in advance for your help!

Hi @hizzawaseem

you should increase the stack and heap size.

With this setting I was able to run inference:

For the heap, in tflite_learn_xx_compiled.cpp you can check the required memory for the tensor arena, for your model:

constexpr int kTensorArenaSize = 73376;

But this info is displayed in the deployment page too.

regards,
fv

2 Likes

Thank you @ei_francesco :raised_hands:

1 Like

Thankyou @ei_francesco increasing the stack and heap sizes worked. Now I am facing another challenge. I’m trying to link the micro-ROS C library into a C++ project in e2studio. I followed the steps in the micro-ROS Renesas guide.

However, I had to use the GNU ARM Cross C++ Linker instead of the GNU ARM Cross C Linker since the C linker option wasn’t available in my project settings.

Here are the configurations I used, along with the build errors I encountered:


I created a C++ project because I also need to include the Edge Impulse SDK (which is a C++ static library) in the application. However, I am struggling to set up the configurations correctly to make everything work together.

Any advice or guidance would be greatly appreciated!

Thank you!

Hmmmmm, I don’t know that we have too much experience now that you’ve transitioned into micro-ros errors, @hizzawaseem. Perhaps Francesco will have some ideas once he sees this message tomorrow during his daytime, but you may need to ping the Renesas engineers responsible for that GitHub repository for assistance. In any case, let’s see what Francesco thinks once he sees this tomorrow. Thanks!

1 Like

Hi, a quick update. I was able to fix the compilation errors, however I am now getting the linker errors:

|Description|Resource|Path|Location|Type|
|---|---|---|---|---|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `microros_allocate(unsigned int, void*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `microros_deallocate(void*, void*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `microros_reallocate(void*, unsigned int, void*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `microros_zero_allocate(unsigned int, unsigned int, void*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `renesas_e2_transport_close(uxrCustomTransport*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `renesas_e2_transport_open(uxrCustomTransport*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `renesas_e2_transport_read(uxrCustomTransport*, unsigned char*, unsigned int, int, unsigned char*)'|microros_tack_classifier|| |C/C++ Problem|
|/home/localadmin/e2_studio/workspace/microros_tack_classifier/Debug/../src/hal_entry.cpp:48: undefined reference to `renesas_e2_transport_write(uxrCustomTransport*, unsigned char const*, unsigned int, unsigned char*)'|microros_tack_classifier|| |C/C++ Problem|
|make: *** [makefile:124: microros_tack_classifier.elf] Error 1|microros_tack_classifier|| |C/C++ Problem|
|undefined reference to `microros_app()'|hal_entry.cpp|/microros_tack_classifier/src|line 53|C/C++ Problem|

Project Link: Sign in to your account

I compared my C/C++ build settings with the demo projects on Github: GitHub - micro-ROS/micro_ros_renesas_demos: Demo code for Renesas e2 studio
The only difference is that the demo projects use the C linker and my project uses the C++ linker. I want to create a C++ project since I want to to link the static library of C++ SDK with my target application.

Thank you for the feedback! It might be a good idea to loop in the Renesas engineers if needed. I’ll wait to hear @ei_francesco’s thoughts on this tomorrow and see if he has any insights or suggestions.