call of prvInitialiseTaskLists

Hi. this is my first post. I try to use FreeRTOS with Oryx-Embedded Cyclone TCP. In this library present function like TRACEINFO. I try to use them on start of main() sub and got a Hard Fault Interrupt. When I start to investigate code, I found that in macro TRACEINFO used vTaskSuspendAll() and xTaskResumeAll(). If beteen calling of this function appear a system tick interrupt, the handler try to switch to next ready task, but before adding first task don’t call prvInitialiseTaskLists(), so the pxDelayedTaskList is NULL, but handler try to use this NULL as pointer to correct struct and this call a Hard Fault Interrupt. So maybe should to add an init fuction for check list in handler? or some another decision of this problem. simple example of code: int main() {
vTaskSuspendAll();
printf("**********************************rn");
//during executing printf apear system tick interrupt and appear a Hard fault interrupt
xTaskResumeAll();

xTaskCreate("",vTask0,NULL, configMINIMAL_STACK_SIZE, configMAX_PRIORITIES);    
vTaskStartScheduler();
} Best regards, Tymokhin Oleksandr

call of prvInitialiseTaskLists

Sorry for the delay in replying – somehow missed this one. However, in this case it sounds like you are reporting a problem in somebody elses code, rather than ours, if indeed there is a problem at all. It just sounds like you are performing an operation before the scheduler has started that is intended to be used after the scheduler has started as it is using the FreeRTOS API.

call of prvInitialiseTaskLists

Yes. this problem is occure before scheduler is started, or when its started before any tasks was added. Its of course not normal sitation, but in some cases can be expected. For example in case when tasks added by condition from main(), or using exernal libraries with for example with trace definition. And it come to Hard Fault. May be useful to check pxCurrentTCB to NULL. Its just a proposition. May be I don’t anderstand in FreeRTOS architecture. In my case I have next problem. I use Nucleo-144 with stm32f767 chip
  1. I init system clock and start it at 216MHz
  2. route standard file to ITM for output debug info
  3. before starting scheduler use printf to ITM some debug information
  4. printf to long and systick event raise during printf before executing vTaskStartScheduler(), but pxCurrentTCB in this moment is null and pxReadyTasksLists[ pxCurrentTCB->uxPriority ] raise hard fault (line 2615 in tasks.c FreeRTOS v9.0.0)
May be it’s correct behavior. I don’t now. Best regards, Tymokhin Oleksandr

call of prvInitialiseTaskLists

Oryx-Embedded Cyclone TCP use in macro TRACEINFO NOT vTaskSuspendAll() and xTaskResumeAll(). In this macro, this function is actually used void osSuspendAllTasks(void) { //Make sure the operating system is running if(xTaskGetSchedulerState() != taskSCHEDULERNOTSTARTED) { //Suspend all tasks vTaskSuspendAll(); } } You should use this function.

call of prvInitialiseTaskLists

Where? Why?

call of prvInitialiseTaskLists

Hi, Yes, I Use TRACEINFO. And the problem in next. May be it’s not for thisd topic. I use not clear FreeRTOS. I Use cmsis_os2 lib. TRACEINFO is: TRACE_PRINTF(…) osSuspendAllTasks(), fprintf(stderr, VA_ARGS), osResumeAllTasks() So, when call osSuspendAllTasks() – it call osKernelLock() int32t osKernelLock (void) { int32t lock; if (ISIRQ()) { lock = (int32t)osErrorISR; } else { switch (xTaskGetSchedulerState()) { case taskSCHEDULER_SUSPENDED: lock = 1; break;
  case taskSCHEDULER_RUNNING:
    vTaskSuspendAll();
    lock = 0;
    break;

  case taskSCHEDULER_NOT_STARTED:
  default:
    lock = (int32_t)osError;
    break;
}
} return (lock); } The scheduler is not running and in this case xTaskGetSchedulerState() return taskSCHEDULERNOTSTARTED and in this case vTaskSuspendAll() is not calling and systick interrupt is raise. So appear situation from above message. Best regards, Oleksandr