how can I get the TCB imformation from the task handle?

~~~ TaskHandle_t task1,task2,task3; void main_blinky( void ) {
    srand(time(NULL));
    xTaskCreate( SPEEDTEST, "Task 1", 100, NULL, 3, (TaskHandle_t*)&task1 );
    xTaskCreate( ROOM, "Task 2", 100, NULL, 2, (TaskHandle_t*)&task2 );
    xTaskCreate( Power, "Task 3", 100, NULL, 1, (TaskHandle_t*)&task3 );
    vTaskStartScheduler();

    CheckNextRun();
for( ;; );
} static void CheckNextRun(void) {
taskENTER_CRITICAL();
printf("**************Address1=%pn  ***************",*task3->xStateListItem.pvContainer );
fflush( stdout );
printf("**************Address2=%un  ***************",&(pxReadyTasks[*task3->uxPriority]) );
fflush( stdout );
// if ( task3->xStateListItem.pvContainer==&(pxReadyTasks[task3->uxPriority]) ) // {period=Period_3};
taskEXIT_CRITICAL();
} ~~~ I tired to check if the pvContainer is point to the pxReadyTasksLists[ ], it shows three errors :
  1. pxReadyTasksLists’ undeclared (first use in this function) main_blinky.c
  2. request for member ‘uxPriority’ in something not a structure or union
  3. request for member ‘xStateListItem’ in something not a structure or union
How should I declare the pxReadyTasksLists? as extern? How can I get the TCB imformation from the task handle? Thanks!

how can I get the TCB imformation from the task handle?

You can’t, not directly anyway. The task handle is a pointer to the TCB structure, but it is deliberately kept opaque because you should not access the TCB directly. The TCB is an internal data structure and could, potentially, change at any time between FreeRTOS versions. There are some functions that allow you to obtain task state information though. This link lists all (?) the task utility functions (it’s possibly not completely up to date), one of which is vTaskGetInfo() (http://www.freertos.org/vTaskGetInfo.html ).

how can I get the TCB imformation from the task handle?

Just a few more tips. You wrote : ~~~ vTaskStartScheduler(); CheckNextRun(); ~~~ Note that vTaskStartScheduler() starts the scheduler, and the first task will become active. CheckNextRun() will never get called. You also wrote: ~~~ taskENTERCRITICAL(); printf( “xn” ); fflush( stdout ); taskEXITCRITICAL(); ~~~ I am not sure how your printf() and fflush() have been implemented, but chances are that they don’t like the critical section. A critical section means that all interrupts are temporarily disabled. Remember that you can also temporarily suspend the scheduler, while still allowing for interrupts. And if you use a critical secion, do the absolute minimum, like e.g. : ~~~ void *container, *address;
taskENTER_CRITICAL();
{
    /* Do as little as possible. */
    container = task3->xStateListItem.pvContainer;
    address = &(pxReadyTasks[*task3->uxPriority]);
}
taskEXIT_CRITICAL();
/* Now printf the information obtained. */
~~~ Good luck