Hi,
Our project uses pretty much storage and RAM space, however, it compiles and runs perfectly. I notice that after the application runs for a while, maybe 10 minutes, maybe 1 hour, it just crashes, if I examine the stack trace, it always crashes inside the malloc function, I think that's strange, if malloc fails for some reason, it should return NULL, it should not cause a hardfault. I've setup a test program which will always fail after some time:
static void memtest(int16_t* state)
{
volatile uint16_t siz = rand() & 0xfff; // Make sure the amount is not too much
uint8_t* p = malloc(siz);
static uint8_t n = 0;
if (p == NULL)
{
VT100_printf(" Malloc fail!!!\r\n");
*state = TASKSWAITSIGNAL;
}
else
{
free(p);
if (n == 50)
{
VT100_printf(".");
n = 0;
}
else n++;
}
}
This function is called periodically (500x/sec). It may run for an hour, or for 1 minute. The configured heap size is big enough, see the attached settings screenshot.
Furthermore, the application uses FreeRTOS with LWIP and the ethernet/MQTT stack.
Please also find attached a screenshot of the hardfault, an unaligned address allocation seems to cause the problem...
BR,
Daan