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.

RTOS/TM4C129XNCZAD: DK-TM4C129X kit rtos multitasking

Part Number: TM4C129XNCZAD
Other Parts Discussed in Thread: SYSBIOS,

Tool/software: TI-RTOS

I am new to ccs and i wanna use RTOS to run 2 functions parallel. Currently im running ADC code and reading onboard temperature sensor value. But now i want to use the otg example of TivaWare and use it in my example if any one can help ill be glad to hear it thanks . I have edited my code and im attaching the project. For nowim getting these errors


**** Build of configuration Debug for project gpiointerrupt_DK_TM4C129X_TI ****

"C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 2 all -O
making ../src/sysbios/sysbios.aem4f ...
gmake[1]: Nothing to be done for 'all'.
making ../src/sysbios/sysbios.aem4f ...
gmake[2]: Nothing to be done for 'all'.
'Building target: gpiointerrupt_DK_TM4C129X_TI.out'
'Invoking: ARM Linker'
"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --define=ccs="ccs" --define=PART_TM4C129XNCZAD --define=ccs --define=TIVAWARE -g --gcc --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi -z -m"gpiointerrupt_DK_TM4C129X_TI.map" --heap_size=0 --stack_size=512 -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.0.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="gpiointerrupt_DK_TM4C129X_TI_linkInfo.xml" --rom_model -o "gpiointerrupt_DK_TM4C129X_TI.out" "./DK_TM4C129X.obj" "./gpiointerrupt.obj" "../DK_TM4C129X.cmd" "../usb_otg_mouse_ccs.cmd" -l"configPkg/linker.cmd" -l"C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b/grlib/ccs/Debug/grlib.lib" -l"C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b/usblib/ccs/Debug/usblib.lib" -l"C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b/driverlib/ccs/Debug/driverlib.lib" -llibc.a -llibc.a
<Linking>
"../usb_otg_mouse_ccs.cmd", line 47: error #10263: FLASH memory range has already been specified
"../usb_otg_mouse_ccs.cmd", line 47: error #10264: FLASH memory range overlaps existing memory range FLASH
"../usb_otg_mouse_ccs.cmd", line 49: error #10263: SRAM memory range has already been specified
"../usb_otg_mouse_ccs.cmd", line 49: error #10264: SRAM memory range overlaps existing memory range SRAM

undefined first referenced
symbol in file
--------- ----------------
ClearMainWindow ./gpiointerrupt.obj
DeviceInit ./gpiointerrupt.obj
DeviceMain ./gpiointerrupt.obj
FrameDraw ./gpiointerrupt.obj
GetTickms ./gpiointerrupt.obj
HostInit ./gpiointerrupt.obj
HostMain ./gpiointerrupt.obj
Kentec320x240x16_SSD2119Init ./gpiointerrupt.obj
PinoutSet ./gpiointerrupt.obj
ROM_SysCtlPeripheralEnable ./gpiointerrupt.obj
SysCtlVCOGet ./gpiointerrupt.obj
UARTStdioConfig ./gpiointerrupt.obj
UpdateStatus ./gpiointerrupt.obj
g_sKentec320x240x16_SSD2119 ./gpiointerrupt.obj

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "gpiointerrupt_DK_TM4C129X_TI.out" not built

>> Compilation failure
makefile:147: recipe for target 'gpiointerrupt_DK_TM4C129X_TI.out' failed
makefile:143: recipe for target 'all' failed
gmake[1]: *** [gpiointerrupt_DK_TM4C129X_TI.out] Error 1
gmake: *** [all] Error 2

**** Build Finished ****

gpiointerrupt_DK_TM4C129X_TI.rar

  • Hi,

     There are several TI-RTOS USB examples. Please start with these examples as TI-RTOS has its drivers to support USB. I don't think mixing the TivaWare USB with TI-RTOS is a good idea as you may run into other problems. 

      

  • I wanna use the otg cable as im using usb cable to power the board. What should i do to run 2 tasks simultaneously in TI-RTOS.
  • I used Ti-RTOS example of usb and tried it with my code it builds fine but in debug mode it stucks on HWI.C file on this command
    switch (excContext->threadType)
    any idea whats the problem
    heres my code

    /*
     * Copyright (c) 2015, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== gpiointerrupt.c ========
     */
    
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    /* TI-RTOS Header files */
    #include <ti/drivers/GPIO.h>
    
    /* Example/Board Header files */
    #include "Board.h"
    
    /*Tiva Rc headers */
    #include <stdio.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "driverlib/gpio.h"
    #include "driverlib/sysctl.h"
    #include "C:\ti\TivaWare_C_Series-2.1.3.156\driverlib\adc.h"
    #include "inc/hw_ints.h"
    #include "C:\ti\TivaWare_C_Series-2.1.3.156\driverlib\sysctl.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/systick.h"
    #include "inc/hw_types.h"
    #include "driverlib/debug.h"
    
    //otg
    /*
     *  ======== usbmousehost.c ========
     */
    
    #include <stdbool.h>
    
    /* XDCtools Header files */
    #include <xdc/std.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>
    
    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    
    /* TI-RTOS Header files */
    #include <ti/drivers/GPIO.h>
    
    /* Example/Board Header files */
    #include "Board.h"
    
    /* USB Reference Module Header file */
    #include "USBMH.h"
    
    #define TASKSTACKSIZE   768
    
    Task_Struct task0Struct;
    Char task0Stack[TASKSTACKSIZE];
    /*
     *  ======== taskFxn ========
     *  Task for this function is created statically. See the project's .cfg file.
     */
    Void taskFxn(UArg arg0, UArg arg1)
    {
        USBMH_State state;
    
        System_printf("Mouse cursor position\n");
    
        while (true) {
    
            /* Block while the device is NOT connected to the USB */
            USBMH_waitForConnect(BIOS_WAIT_FOREVER);
    
            /* Determine the status of the mouse */
            USBMH_getState(&state);
    
            /* Update LED outputs */
            GPIO_write(Board_LED0, state.button1 ? Board_LED_ON : Board_LED_OFF);
            GPIO_write(Board_LED1, state.button2 ? Board_LED_ON : Board_LED_OFF);
    
            System_printf("X:%03d\tY:%03d\r", state.deltaX, state.deltaY);
    
            Task_sleep(100);
        }
    }
    
    
    
    
    
    
    
    /* variable to be read by GUI Composer */
    int count = 0;
    void hardware_init(void);
    void software(void);
    /*
     *  ======== gpioButtonFxn0 ========
     *  Callback function for the GPIO interrupt on Board_BUTTON0.
     */
    void gpioButtonFxn0(unsigned int index)
    {
        /* Clear the GPIO interrupt and toggle an LED */
        GPIO_toggle(Board_LED0);
    
        if (count++ == 100) {
            count = 0;
        }
    }
    
    /*
     *  ======== gpioButtonFxn1 ========
     *  Callback function for the GPIO interrupt on Board_BUTTON1.
     *  This may not be used for all boards.
     */
    void gpioButtonFxn1(unsigned int index)
    {
        /* Clear the GPIO interrupt and toggle an LED */
        GPIO_toggle(Board_LED1);
    
        if (count++ == 100) {
            count = 0;
        }
    }
    
    /*
     *  ======== main ========
     */
    int main(void)
    {
        /* Call board init functions */
        Board_initGeneral();
        Board_initGPIO();
        Board_initUART();
    
        hardware_init();
    
    
        /* Turn on user LED */
        GPIO_write(Board_LED0, Board_LED_ON);
       // GPIOPinWrite(Board_PORTK_1,1);
    
        System_printf("Starting the GPIO Interrupt example\nSystem provider is set"
                      " to SysMin. Halt the target to view any SysMin contents in"
                      " ROV.\n");
        /* SysMin will only print to the console when you call flush or exit */
        System_flush();
    
        /* install Button callback */
        GPIO_setCallback(Board_BUTTON0, gpioButtonFxn0);
    
        /* Enable interrupts */
        GPIO_enableInt(Board_BUTTON0);
    
        /*
         *  If more than one input pin is available for your device, interrupts
         *  will be enabled on Board_BUTTON1.
         */
        if (Board_BUTTON0 != Board_BUTTON1) {
            /* install Button callback */
            GPIO_setCallback(Board_BUTTON1, gpioButtonFxn1);
            GPIO_enableInt(Board_BUTTON1);
        }
    
        /* Start BIOS */
        BIOS_start();
    
        return (0);
    }
    
    void hardware_init(void)
    {
                        unsigned long ulADC0Value[1];
                        unsigned long ulADC0Value1[14];
                        volatile unsigned long ulTempAvg;
                        volatile unsigned long ulTempAvg1;
                        volatile unsigned long ulTempValueC;
                        volatile unsigned long ulTempValueF;
                       // SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_25MHZ);
                       // SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |SYSCTL_XTAL_25MHZ);
                        SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |SYSCTL_CFG_VCO_480), 120000000);
                        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);//Enabling ADC0
                        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);//enabling port E
                        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1);//defining pin PE1
    
                        ADCSequenceDisable(ADC0_BASE, 3);
                        ADCSequenceDisable(ADC0_BASE, 2);
                        ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
                        ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);
                        //Channel 2 PE1
                        ADCSequenceStepConfigure(ADC0_BASE, 2,0, ADC_CTL_CH2);
                        ADCSequenceStepConfigure(ADC0_BASE, 2, 1, ADC_CTL_CH2);
                        ADCSequenceStepConfigure(ADC0_BASE, 2, 2, ADC_CTL_CH2);
                        ADCSequenceStepConfigure(ADC0_BASE, 2, 0, ADC_CTL_CH2 | ADC_CTL_IE | ADC_CTL_END);
                       //Channel TS
                        ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END);
                        ADCSequenceEnable(ADC0_BASE, 3);
                        ADCSequenceEnable(ADC0_BASE, 2);
                        while(1)
                        {
                        ADCProcessorTrigger(ADC0_BASE, 3);
                        ADCProcessorTrigger(ADC0_BASE, 2);
                        //waiting for conversion
                        while(!ADCIntStatus(ADC0_BASE, 3, false)){}
                        while(!ADCIntStatus(ADC0_BASE, 2, false)){}
                        //Getting values
                        ADCSequenceDataGet(ADC0_BASE, 3, ulADC0Value);
                        ADCSequenceDataGet(ADC0_BASE, 2, ulADC0Value1);
                        ulTempAvg = (ulADC0Value[0] );
                        ulTempAvg1 = (ulADC0Value1[0] +ulADC0Value1[1]+ulADC0Value1[2]+ulADC0Value1[3])/4;
                        ulTempValueC = (1475 - ((2475 * ulTempAvg)) / 4096)/10;
                        ADCIntClear(ADC0_BASE, 3);
                        ADCIntClear(ADC0_BASE, 2);
                        software();
                        }
    }
    
    
    
    /*
     *  ======== main ========
     */
    
    void software(void)
    {
        /* Construct BIOS objects */
           Task_Params taskParams;
    
           /* Call board init functions */
           Board_initGeneral();
           Board_initGPIO();
           Board_initUSB(Board_USBHOST);
    
           /* Construct Mouse Task thread */
           Task_Params_init(&taskParams);
           taskParams.stackSize = TASKSTACKSIZE;
           taskParams.stack = &task0Stack;
           taskParams.priority = 2;
           Task_construct(&task0Struct, (Task_FuncPtr)taskFxn, &taskParams, NULL);
    
           /* Turn on user LED */
           GPIO_write(Board_LED0, Board_LED_ON);
    
           System_printf("Starting the USB Mouse Host example\nSystem provider is set"
                         " to SysMin. Halt the target to view any SysMin contents in"
                         " ROV.\n");
           /* SysMin will only print to the console when you call flush or exit */
           System_flush();
    
           USBMH_init();
    
           /* Start BIOS */
           //BIOS_start();
    
           return (0);
    }
    

  • Not clear on your question on running two tasks simultaneously. You just use the Task_construct to create a new task. Take a look at the TI-RTOS SPI example where two tasks are created, one for the master and another for the slave. Each task is created with its own stack and priority.