Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

call of prvInitialiseTaskLists

Posted 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 prvInitialiseTaskLists

Posted 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 prvInitialiseTaskLists

Posted 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

  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

Posted 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 prvInitialiseTaskLists

Posted by rtel on November 23, 2017

Where? Why?


call of prvInitialiseTaskLists

Posted 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


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS