cniosmicroc

How can I resolve this warning?


The code compiles and runs but I want to handle the warning.

enter image description here

#include <stdio.h>
#include "includes.h"
#include <string.h>

#define DEBUG 1

/* Definition of Task Stacks */
/* Stack grows from HIGH to LOW memory */
#define   TASK_STACKSIZE       2048
OS_STK    task1_stk[TASK_STACKSIZE];
OS_STK    task2_stk[TASK_STACKSIZE];
OS_STK    stat_stk[TASK_STACKSIZE];

/* Definition of Task Priorities */
#define TASK1_PRIORITY      6  // highest priority
#define TASK2_PRIORITY      7
#define TASK_STAT_PRIORITY 12  // lowest priority 

void printStackSize(INT8U prio)
{
    INT8U err;
    OS_STK_DATA stk_data;

    err = OSTaskStkChk(prio, &stk_data);
    if (err == OS_NO_ERR) 
    {
        if (DEBUG == 1)
           printf("Task Priority %d - Used: %d; Free: %d\n", 
                   prio, stk_data.OSFree, stk_data.OSUsed);
    }
    else
    {
        if (DEBUG == 1)
           printf("Stack Check Error!\n");    
    }
}

Solution

  • Without knowing the definition of INT32U it's hard to say, but you probably want:

    printf("Task Priority %d - Used: %u; Free: %u\n", 
            prio, stk_data.OSFree, stk_data.OSUsed);
    

    or:

    printf("Task Priority %d - Used: %lu; Free: %lu\n", 
            prio, stk_data.OSFree, stk_data.OSUsed);