This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

HardFault of SystemInit

Hi,

I'm trying to deploy the example program, cifar10, from CMSIS-NN library on NRF52. The issus is I compiled and downloaded it to the board successfully but when I try to debug, it alwasys stays in HardFault_Handler.

I checked the code and found the problem occurs when I referenced a variable "conv2_wt", which is an INT_8 array with length 32*5*5*16=12800. (If I delete this line the program will be OK)

I guess the problem is about the stack size or something like that but I dont konw how to fix it.

Thanks.

Parents Reply Children
  • Hi,

     

    Based on the stack pointer, it looks like your RAM is overflowed. I can see 0x2001xxxx, which is larger than the amount of RAM that the nRF52832 has (it has 64k and 0x10000 is 64k in hex). This should give an error when compiling and linking, since keil should check the RAM boundaries, provided that your project is setup properly.

    In order to fix this, you need to reduce the amount of RAM your firmware uses.

     

    Have you considered using the nRF52840? it has 256k RAM.

     

    Kind regards,

    Håkon

Related