Concurrency hardfaults on Cortex M33 (LPC55S69) with GNU Tools for Arm Embedded Processors 9-2019-q4-major

So there are five tasks all of which don’t do much, or even interact with each other…

void hello_task(void *pvParameters)
{
	int cnt = 0;
    for (;;)
    {
    	for (int j =0; j < 50; j++)
    	{
			char buf[100] = {0};

			//xSemaphoreTake(semaphore, portMAX_DELAY);
			snprintf(buf, 100, "%d" , cnt);
			//xSemaphoreGive(semaphore);
			cnt++;
    	}
    	vTaskDelay(1);
    }
}

… but they are making a call into NewLib (which I know you know a lot about, but I have to ask), given this quite from the NXP forum:

I confirm that the EXACT same project work flawlessly on McuXpresso V11.1.1, and crashes immediatly when compiled on McuXpresso V12.0.

can you confirm there are no differences in the implementation of snprintf() between the working and non working projects and that the function is configured to be thread safe?


Next, how does the crash manifest itself? Does it end up in a fault handler? Can you see where the crash occurs?


If the compiler version makes a difference, can you play with the command line a bit to see if there is any particular option that makes a difference. Currently the command line, excluding the include path options, is:

-std=gnu99 -DCPU_LPC55S28JBD100 -DCPU_LPC55S28JBD100_cm33 -DSERIAL_PORT_TYPE_UART=1 -DFSL_RTOS_FREE_RTOS -DSDK_DEBUGCONSOLE=1 -DCR_INTEGER_PRINTF -DPRINTF_FLOAT_ENABLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DDEBUG -D__NEWLIB__ -I"C:\temp\delete\20201021b_failure_lpcxpresso55s28_freertos_generic\lpcxpresso55s28_freertos_generic\board"  -O0 -fno-common -g3 -Wall -mcpu=cortex-m33  -c  -ffunction-sections  -fdata-sections  -ffreestanding  -fno-builtin -fmerge-constants -fmacro-prefix-map="../$(@D)/"=. -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -D__NEWLIB__ -fstack-usage

…so maybe try without the -fstack-usage or without -fmerge-constants, etc.