Hi,
When I use J-link to debug my project,it always enter void NMI_HandlerC(unsigned long *hardfault_args)-__asm("BKPT #0\n");.I think it was cased by insufficient heap size.I check the docoment (Training_08_debugging_v1.0.pdf) and try to use disp_heaplog() and show as below:
*** Memory Logging Results ***
>>> ENV HEAP <<<
Used size in this HEAP : 2044 (current) - 63640 (maximum)
Used size in other HEAPs: 2044 (current) - 1389 (maximum)
> > > DB堆< < <
Used size in this HEAP : 2044 (current) - 63640 (maximum)
Used size in other HEAPs: 2044 (current) - 1389 (maximum)
>>> MSG HEAP <<<
Used size in this HEAP : 2044 (current) - 63640 (maximum)
Used size in other HEAPs: 2044 (current) - 1389 (maximum)
>>> Non-Ret HEAP <<<
Used size in this HEAP : 2044 (current) - 63640 (maximum)
Used size in other HEAPs: 2044 (current) - 1389 (maximum)
but how to analyze this log?and what is size is of for heap?Thanks.
Hi zhongc,
NMI_Handler发生当n the watchdog hits and not when you run out of memory, so for now as far as i can tell your program gets stuck at some point and not updating the watchdog. If the fw had an issue when tried to allocate memory then the fw would stuck in the platform_reset_func() (as long as you have not defined the CFG_PRODUCTION_TEST, you can place a breakpoint there and check if your fw goes through that point), if you have defined it, then the device should just issue a reset. Also in order to use the heap memory log utility you will have to define the CFG_LOG_HEAP_USAGE and also follow the guidelines in the comments above of the #define, since what you have been logging indicates that you have not properly enabled the logging mechanism. Be aware that this mechanism is not fully operational and there is an issue in using this utility when you overflow the the heaps waiting for being fixed on the next SDK release. Regarding the log, the Used size in this heap: current (is the size allocated at the moment) - maximum (the largest value that the heap reached), the Used size in other heaps: is the size of the chunk that the scheduler tried to allocate in that heap but failed and ended up in another heap, current (the size intented for this heap and still is allocated in another heap) - maximum (the maximum size that the scheduler tried to allocate in that heap).
Thanks MT_dialog
Hi MT_dialog,
Thanks for your useful answer.I had fix this issue.This issue isn't cause by the heap,it cause by the spi flash without init.