Hi Kody,
They are there, but I don’t want to clutter the message box. But it is probably better to share the whole picture. This morning at work, the debugger got stuck at
configASSERT( ucMaxSysCallPriority );
; line 367 of port.c.
I use static memory allocation; my task creation is as follows in my_file.c:
/* STATIC */
/* Declare the semaphore(s) */
StaticSemaphore_t xUARTMenuTaskSemaphoreBuffer1, xUARTMenuTaskSemaphoreBuffer2;
SemaphoreHandle_t xUARTMenuTaskSemaphore1, xUARTMenuTaskSemaphore2;
/* Declare the mutexes */
StaticSemaphore_t xUARTMenuTaskMutexBuffer1, xUARTMenuTaskMutexBuffer2;
SemaphoreHandle_t xUARTMenuTaskMutex1, xUARTMenuTaskMutex2;
/* Declare the queue(s) */
StaticQueue_t xUARTMenuTaskQueueBuffer1, xUARTMenuTaskQueueBuffer2;
QueueHandle_t xUARTMenuTaskQueue1, xUARTMenuTaskQueue2;
/* Allocate memory for the queues' storage */
uint8_t ucUARTMenuTaskQueueStorage1[UART_MENU_TASK_QUEUE_LENGTH * UART_MENU_TASK_QUEUE_ITEM_SIZE];
uint8_t ucUARTMenuTaskQueueStorage2[UART_MENU_TASK_QUEUE_LENGTH * UART_MENU_TASK_QUEUE_ITEM_SIZE];
/* Task handle and buffer for static task */
StaticTask_t xUARTMenuTaskBuffer;
StackType_t xUARTMenuTaskStack[UART_MENU_TASK_STACK_SIZE];
/* Task function */
void vUARTMenuTask(void* pvParameters) {
/* The parameter value is expected to be 1 as 1 is passed in the
pvParameters value in the call to xTaskCreateStatic() below. */
configASSERT(((uintptr_t)pvParameters) == 1);
for (;;) {
// Task loop
if (splashScreenDisplayed == pdFALSE) {
displaySplashScreen();
vTaskDelay(pdMS_TO_TICKS(splashScreenDisplayTime * 1000));
displaySplashScreen2();
vTaskDelay(pdMS_TO_TICKS(splashScreenDisplayTime * 1000));
//splashScreenDisplayed = pdTRUE; //Don't set to pdTRUE: infinite loop for testing
}
//printMainMenu();
//printf("Test\n\n");
//vTaskDelay(pdMS_TO_TICKS(10));
}
}
/* Initialization function */
void vInitUARTMenuTask(void) {
console_init();
/* Create the semaphores statically */
xUARTMenuTaskSemaphore1 = xSemaphoreCreateBinaryStatic(&xUARTMenuTaskSemaphoreBuffer1);
xUARTMenuTaskSemaphore2 = xSemaphoreCreateBinaryStatic(&xUARTMenuTaskSemaphoreBuffer2);
if (xUARTMenuTaskSemaphore1 == NULL || xUARTMenuTaskSemaphore2 == NULL) {
//safeFprintf(stderr, "Failed to create the UART menu task semaphores.\n");
return;
}
/* Create the mutexes statically */
xUARTMenuTaskMutex1 = xSemaphoreCreateMutexStatic(&xUARTMenuTaskMutexBuffer1);
xUARTMenuTaskMutex2 = xSemaphoreCreateMutexStatic(&xUARTMenuTaskMutexBuffer2);
if (xUARTMenuTaskMutex1 == NULL || xUARTMenuTaskMutex2 == NULL) {
//safeFprintf(stderr, "Failed to create the UART menu task mutexes.\n");
return;
}
/* Create the queues statically */
xUARTMenuTaskQueue1 = xQueueCreateStatic(UART_MENU_TASK_QUEUE_LENGTH,
UART_MENU_TASK_QUEUE_ITEM_SIZE,
ucUARTMenuTaskQueueStorage1,
&xUARTMenuTaskQueueBuffer1);
xUARTMenuTaskQueue2 = xQueueCreateStatic(UART_MENU_TASK_QUEUE_LENGTH,
UART_MENU_TASK_QUEUE_ITEM_SIZE,
ucUARTMenuTaskQueueStorage2,
&xUARTMenuTaskQueueBuffer2);
if (xUARTMenuTaskQueue1 == NULL || xUARTMenuTaskQueue2 == NULL) {
//safeFprintf(stderr, "Failed to create the UART menu task queues.\n");
return;
}
// Create the task statically
TaskHandle_t xUARTMenuTaskHandle = xTaskCreateStatic(
vUARTMenuTask, // Task function
"TCP Menu Task", // Task name
UART_MENU_TASK_STACK_SIZE, // Stack size
(void*)1, // Task parameter
UART_MENU_TASK_PRIORITY, // Priority
xUARTMenuTaskStack, // Stack buffer
&xUARTMenuTaskBuffer // Task buffer
);
if (xUARTMenuTaskHandle == NULL) {
//safeFprintf(stderr, "Failed to create the UART menu task.\n");
}
else {
//safePrintf("The UART menu task was created successfully.\n");
}
}
Since it has a problem with ucMaxSysCallPriority, I also share the relevant sections of FreeRTOSConfig.h:
/* Interrupt priorities */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used.
* In core_cm7.h: __NVIC_PRIO_BITS = 3U => 8 priority levels */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 3U /* 8 priority levels */
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1U << (configPRIO_BITS)) - 1)
/* (1 << 3) - 1 = 7 */
/*
* ISRs that CAN call FreeRTOS APIs:
* Priority levels must be greater than or equal to configMAX_SYSCALL_INTERRUPT_PRIORITY, which is 2.
* Valid numerical values: 2, 3, 4, 5, 6, 7.
* ISRs that CANNOT call FreeRTOS APIs:
* Numerical values: 0, 1 */
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 2
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
/* Interrupt priorities used by the kernel port layer itself. These are generic
* to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY 7
Sorry for dumping so much code on you, but it is better to share the full picture.