majianjia / nnom

A higher-level Neural Network library for microcontrollers.
Apache License 2.0
909 stars 245 forks source link

Hard Fault error #130

Closed Antimoon51 closed 3 years ago

Antimoon51 commented 3 years ago

Hi,

I am trying to build an application using NNoM 0.4.2 and CMSIS 5.7.0 on the STM32F723E-Disco Board. I use the Keil µVision IDE V5.33.

I am encountering a hard fault error during debugging. As far as I can tell the hard fault is called from the conv2d_build funktion in the file nnom_conv2d.c.

I have already tried using different networks in an empty project (despite CMSIS and NNoM).

majianjia commented 3 years ago

Hi @Antimoon51 Might be there is not enough stack. You will need to set it to as much as possible. Or change it to static buffer and again set it to large size first then reduce it according to the log printed out.

Antimoon51 commented 3 years ago

So I ave increased the stack size to the maximum (0x30000 in Bytes) , but I still get the same outcome. According to the static call graph I'm using 384 Bytes of stack +unknown for untraceable function pointers, but still I think I should have enough stack. grafik

You also suggested to change to static buffer. I'm assuming you meant that I try using NNOM_USING_STATIC_MEMORY, however I worked with the 0.4.2 release that seems to not support this option. I will try this, but I will have to rebuild everything first.

Antimoon51 commented 3 years ago

I think I worked this out. It wasn't as much about the stack-, but about the heap size. In my case I could leave the stack size at the initial value, but increased the heap size by a lot and in the end by what the log printed after compiling the network. I'm going to close this issue as the initial problem has been solved.

majianjia commented 3 years ago

@Antimoon51 Sorry, it was my fault. I was confused between heap and stack....