FreeRTOS Support Archive
The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2017 Threads] call of prvInitialiseTaskListsPosted by tymokhin on November 18, 2017 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("**********************************\r\n");
//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 prvInitialiseTaskListsPosted by rtel on November 21, 2017 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 prvInitialiseTaskListsPosted by tymokhin on November 23, 2017 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
- I init system clock and start it at 216MHz
- route standard file to ITM for output debug info
- before starting scheduler use printf to ITM some debug information
- 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 prvInitialiseTaskListsPosted by sergossv on November 23, 2017 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 prvInitialiseTaskListsPosted by rtel on November 23, 2017
call of prvInitialiseTaskListsPosted by tymokhin on November 24, 2017 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:
TRACEPRINTF(...) osSuspendAllTasks(), fprintf(stderr, __VAARGS__), 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|