Using ARM coretx-M chip setGetting random INVPC hard fault exception error, while running iperf tool for measuring n/w throughput.Hard fault reg: 0x40000000
xPSR: 0x01000000
PRIMASK: 0x00000001
CONTROL: 0x00000000
Please help to find the possible root cause.
Yes, potentially the stack space reserved is too small, and during the execution of the interrupt handler, the EXC_RETURN was pushed to the stack, corrupted by data processing operations, and then POP back from the stack and used for exception return. In many development toolchain you can reported the stack usage of code. You need to add the stack space needed by exception handlers and stack frame to get a good estimation of total required stack space.
If you are using Keil Microcontroller Development Kit (MDK) the stack size is usually defined in the startup code. If you are using an RTOS, the RTOS would also have stack size definitions for each thread and you need to look into the documentation from the RTOS vendor to see how to control the thread's stack sizes.
regards,
Joseph