Чтобы печатать в порядке очереди поступления есть более щадящие
средства чем критическая секция. Я вот так делал:
//printf_guard.h
#ifndef __printf_guard_h__
#define __printf_guard_h__
// Макрос для применения printf() в задачах FreeRTOS
// во избежание перепутывания вывода из разных задач
#include "FreeRTOS.h"
#include "semphr.h"
#define printf(...) do{\
extern SemaphoreHandle_t printf_Mutex;\
xSemaphoreTake(printf_Mutex,portMAX_DELAY);\
printf(__VA_ARGS__);\
xSemaphoreGive(printf_Mutex);\
}while(0)
#endif