This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-CC2640R2: Do not see Task Sleep executing in Execution Analysis for a TI-RTOS Basics Lab

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640

Tool/software: Code Composer Studio

Hi 

I just started playing with TI-RTOS task creation and execution as instructed in the TI-RTOS Basics tutorial of SimpleLink Academy training for CC2640. 

Below is my code and screenshots. I don't see Task Sleep executing in the execution graph. It shows me a warning at the bottom that says "1 gap due to data loss". What does it mean and what am I doing wrong?

/* TI-RTOS Header files */
#include <xdc/std.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

#include <ti/drivers/GPIO.h>
#include "Board.h"
#include <ti/sysbios/knl/Clock.h>

/* Driver configuration */
//#include "ti_drivers_config.h"
#define CONFIG_LED_0_GPIO Board_GPIO_LED0
#define CONFIG_LED_1_GPIO Board_GPIO_LED1
#define CONFIG_LED_OFF Board_GPIO_LED_OFF
#define CONFIG_LED_ON Board_GPIO_LED_ON

void myDelay(int count);

/* Could be anything, like computing primes */
#define FakeBlockingSlowWork()   myDelay(12000000)
#define FakeBlockingFastWork()   myDelay(2000000)

Task_Struct workTask;
/* Make sure we have nice 8-byte alignment on the stack to avoid wasting memory */
#pragma DATA_ALIGN(workTaskStack, 8)
#define STACKSIZE 1024
static uint8_t workTaskStack[STACKSIZE];

void doUrgentWork(void)
{
    GPIO_write(CONFIG_LED_1_GPIO, CONFIG_LED_OFF);
    FakeBlockingFastWork(); /* Pretend to do something useful but time-consuming */
    GPIO_write(CONFIG_LED_1_GPIO, CONFIG_LED_ON);
}

void doWork(void)
{
    GPIO_write(CONFIG_LED_0_GPIO, CONFIG_LED_OFF);
    FakeBlockingSlowWork(); /* Pretend to do something useful but time-consuming */
    GPIO_write(CONFIG_LED_0_GPIO, CONFIG_LED_ON);
}

Void workTaskFunc(UArg arg0, UArg arg1)
{
    while (1) {

        /* Do work */
        doWork();

        /* Wait a while, because doWork should be a periodic thing, not continuous.*/
        //myDelay(24000000);
        Task_sleep(500 * (1000 / Clock_tickPeriod));
    }
}

/*
 *  ======== main ========
 *
 */
int main(void)
{
    Board_init();
    GPIO_init();

    /* Set up the led task */
    Task_Params workTaskParams;
    Task_Params_init(&workTaskParams);
    workTaskParams.stackSize = STACKSIZE;
    workTaskParams.priority = 2;
    workTaskParams.stack = &workTaskStack;

    Task_construct(&workTask, workTaskFunc, &workTaskParams, NULL);

    /* Start kernel. */
    BIOS_start();

    return (0);
}

/*
 *  ======== myDelay ========
 *  Assembly function to delay. Decrements the count until it is zero
 *  The exact duration depends on the processor speed.
 */
__asm("    .sect \".text:myDelay\"\n"
      "    .clink\n"
      "    .thumbfunc myDelay\n"
      "    .thumb\n"
      "    .global myDelay\n"
      "myDelay:\n"
      "    subs r0, #1\n"
      "    bne.n myDelay\n"
      "    bx lr\n");