felis_co wrote on Monday, February 16, 2009:

There is a FreeRTOS dropdown in MPLAB v8.20 RTOS viewer. When selected, it shows some (correct) information, like number of tasks, ticks, queues, etc. However, the tasks window is empty. What do I need to do to get this window populated with task information?

mikej42 wrote on Tuesday, February 17, 2009:

Hello Oleg

You need to set configQUEUE_REGISTRY_SIZE to the maximum number of Queues, the FreeRTOSConfig.h is a likely place. This then shows the queue data. It still shows no tasks, and no task data though


mikej42 wrote on Tuesday, February 17, 2009:

Hi again

If you set configUSE_TRACE_FACILITY to ‘1’ (also in FreeRTOSConfig.h) the tasks now appear in the the viewer - you use more memory of course and slow the operation down but…



felis_co wrote on Tuesday, February 17, 2009:

Hi Mike,

Thank you for the information. When I’m trying to compile with configUSE_TRACE_FACILITY I get the following error:

Executing: "C:\MCC18\bin\mcc18.exe" -p=18F4520 /i"C:\MCC18\h" -I"Z:\projects\RTOS_USB_Host\RTOS_Source" "RTOS_Source\tasks.c" -fo="tasks.o" -D__DEBUG -D__MPLAB_DEBUGGER_ICD2=1 -w3 -DMPLAB_PIC18F_PORT -Ls -Opa- -nw 2074 -nw 2066

MPLAB C18 v3.22 (demo)

Copyright 2000-2008 Microchip Technology Inc.

Days remaining until demo becomes feature limited:  24

Z:\projects\RTOS_USB_Host\RTOS_Source\tasks.c:1820:Error [1131] type mismatch in assignment
Z:\projects\RTOS_USB_Host\RTOS_Source\tasks.c:1823:Error [1131] type mismatch in assignment

pointing to two listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); lines in the follwing fragment of code:

#if ( configUSE_TRACE_FACILITY == 1 )

    static void prvListTaskWithinSingleList( const signed portCHAR *pcWriteBuffer, xList *pxList, signed portCHAR cStatus )
    volatile tskTCB *pxNextTCB, *pxFirstTCB;
    unsigned portSHORT usStackRemaining;

        /* Write the details of all the TCB’s in pxList into the buffer. */
        listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
            listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
            usStackRemaining = usTaskCheckFreeStackSpace( ( unsigned portCHAR * ) pxNextTCB->pxStack );
            sprintf( pcStatusString, ( portCHAR * ) “%s\t\t%c\t%u\t%u\t%u\r\n”, pxNextTCB->pcTaskName, cStatus, ( unsigned int ) pxNextTCB->uxPriority, usStackRemaining, ( unsigned int ) pxNextTCB->uxTCBNumber );
            strcat( ( portCHAR * ) pcWriteBuffer, ( portCHAR * ) pcStatusString );

        } while( pxNextTCB != pxFirstTCB );


my FreeRTOSConfig.h definitions are as follows:

#define configUSE_PREEMPTION            1
#define configUSE_IDLE_HOOK                1
#define configUSE_TICK_HOOK                0
#define configTICK_RATE_HZ                ( ( portTickType ) 1000 )
#define configCPU_CLOCK_HZ                ( ( unsigned portLONG ) 10000000 )
#define configMAX_PRIORITIES            ( ( unsigned portBASE_TYPE ) 3 )
#define configMINIMAL_STACK_SIZE        ( 105 )    //init.105
#define configTOTAL_HEAP_SIZE            ( ( size_t ) 796 /* 1052 */)
#define configMAX_TASK_NAME_LEN            ( 4 )
#define configUSE_TRACE_FACILITY        1
#define configUSE_16_BIT_TICKS            1
#define configIDLE_SHOULD_YIELD            1
#define configUSE_MUTEXES                1
//#define configCHECK_FOR_STACK_OVERFLOW    1
#define configUSE_APPLICATION_TASK_TAG    1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES             0
#define configMAX_CO_ROUTINE_PRIORITIES ( 1 )

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */

#define INCLUDE_vTaskPrioritySet        0
#define INCLUDE_uxTaskPriorityGet        0
#define INCLUDE_vTaskDelete                1
#define INCLUDE_vTaskCleanUpResources    0
#define INCLUDE_vTaskSuspend            1
#define INCLUDE_vTaskDelayUntil            1
#define INCLUDE_vTaskDelay                1
#define INCLUDE_uxTaskGetStackHighWaterMark 1

Could you please take a look and tell me what’s wrong?

Thank you,

jgmartinez wrote on Wednesday, February 18, 2009:

There are some casts that need to be added for MCC18 compiler, either remove warnings or remove errors.

Look for in list.h line 193 and:

pxTCB = (volatile tskTCB *) (px…

mikej42 wrote on Wednesday, February 18, 2009:

The element ( pxConstList )->pxIndex->pvOwner is defined as void *, and I guess the C18 compiler does not silently cast pointer types as some do. I can’t argue about whether they should!

felis_co wrote on Thursday, February 19, 2009:

Thank you, Juan and Mike. I compiled with configUSE_TRACE_FACILITY but it didn’t help much. I still can’t get a list of tasks in RTOS viewer window reliably. It works OK under simulator. It doesn’t show anything with ICD2. Also, queue list is strange - sometimes it contains one queue, sometimes 3, sometimes 10 (I have 4 queues and 2 semaphores).  I think now that this feature in MPLAB is too new to be useful.

jgmartinez wrote on Thursday, February 19, 2009:

I don’t remember where I read about MPLAB RTOS viewer tool is only available for C30 and C32. I’ve tested with C30 and PIC24 that RTOS viewer is OK. Nevertheles this tool do not provides so much information.
Macros available fom 5.0.0 version of FreeRTOS are better solution and platform independent. Meanwhyle Microchip takes in account that FreeRTOS is becoming the best choice, for many people that will select PIC or another platform if FreeRTOS is supported or not.