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.

SysBIOS in Starterware for OMAPL138

Other Parts Discussed in Thread: OMAPL138, SYSBIOS, OMAP-L138

Hello,

I am beginner to SysBIOS and Starter ware and OMAPL138. 

Please suggest me how to use Starterware sample programs in SysBIOS to interface with peripherals such as LCD, LED, Ethernet(TCP/IP) and USB. 

What are the documents and sections to refer to.

Yours friend,

Mahesh

 

 

  • Mahesh,

    The StarterWare package does not ship with any OS-specific examples, but it should be straightforward to use StarterWare APIs in a SYSBIOS application.  I recommend starting with one peripheral (like LCDC) and copying the peripheral API calls from the relevant StarterWare example application into your SYSBIOS application.  Alternatively, you could migrate an entire StarterWare example application into SYSBIOS:

    1. Add a SYSBIOS configuration (*.cfg file)
    2. Move processing to a Task function
    3. Call BIOS_start() at the end of main() to start the scheduler

    The only "gotcha" to look out for is that SYSBIOS provides its own APIs for cache and interrupt setup.  If you try to use StarterWare APIs for these features, you need to be careful not to apply contradictory settings in SYSBIOS and StarterWare.  Similarly, I don't recommend mixing StarterWare peripheral API calls with SYSBIOS peripheral drivers (i.e. BIOS PSP) in the same application.

    Hope this helps.

  • UIRGENT:

    Hello friend,

    I have unresolved issues within SYSBIOS project using  the SarterWare package in CCSV5.1 using  logic PD BSL 4.2.4 on  ARM9/OMAPL138 SoM on EVM kit.

    First I tested StarterWare "lidd_armv5_omapl138_evmOMAPL138" project and got it working.

    Second as a sanity test I created  Log example in SYSBIOS and got it working as evident from RTA Raw Logs.

    Third I started integrating them.

      - I resolved the include errors in beginning by including all those folders that were included in the example "lidd_armv5_omapl138_evmOMAPL138".

     -  I use the API function definitions of the in the main.c  file and created a task to setup, initialise, etc. for LCDC and display a string on it.

     - The build gives unresolved symbols for every API calls. I copy some the linker errors  here.  The full build console output, main.c code, .cfg text is zipped and attached to this thread.

    undefined          first referenced
      symbol                in file    
     ---------          ----------------
     LIDDAddrIndexSet   ./main.obj     
     LIDDCSTimingConfig ./main.obj     
     LIDDClkConfig      ./main.obj     
     LIDDDataWrite      ./main.obj     
     LIDDDisplayEnable  ./main.obj     
     LIDDModeSet        ./main.obj     
     LIDDPinMuxSetup    ./main.obj     
     PSCModuleControl   ./main.obj  

    **** Build of configuration Debug for project a2 ****
    
    D:\ti\ccsv5\utils\bin\gmake -k all 
    'Building file: ../main.c'
    'Invoking: TMS470 Compiler'
    "D:/ti/ccsv5/tools/compiler/tms470/bin/cl470" -mv5e -g --include_path="D:/ti/ccsv5/tools/compiler/tms470/include" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/include/armv5" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/include/armv5/omapl138" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/include/hw" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/ipclite/include" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/nandlib/include" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/usblib/include" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/grlib" --include_path="D:/Program Files/Texas Instruments/OMAPL138_StarterWare_1_10_01_01/include" --include_path="E:/pratap/omap/ws5/1020489B_CCSv4-2-4_with_SOM-M1_BSL_WS/CCSv4-2-4_with_SOM-M1_BSL_WS/OMAP-L138_GEL_BSL_Files/bsl/inc" --diag_warning=225 --display_error_number -me --abi=eabi --code_state=32 --preproc_with_compile --preproc_dependency="main.pp" --cmd_file="./configPkg/compiler.opt"  "../main.c"
    "../main.c", line 63: warning #552-D: variable "tsk1" was set but never used
    "../main.c", line 87: warning #9-D: nested comment is not allowed
    "../main.c", line 88: warning #9-D: nested comment is not allowed
    "../main.c", line 91: warning #9-D: nested comment is not allowed
    'Finished building: ../main.c'
    ' '
    'Building target: a2.out'
    'Invoking: TMS470 Linker'
    "D:/ti/ccsv5/tools/compiler/tms470/bin/cl470" -mv5e -g --diag_warning=225 --display_error_number -me --abi=eabi --code_state=32 -z -m"a2.map" --warn_sections -i"D:/ti/ccsv5/tools/compiler/tms470/lib" -i"D:/ti/ccsv5/tools/compiler/tms470/include" --reread_libs --rom_model -o "a2.out" -l"./configPkg/linker.cmd"  "./main.obj" -l"libc.a" "E:/pratap/omap/ws5/1020489B_CCSv4-2-4_with_SOM-M1_BSL_WS/CCSv4-2-4_with_SOM-M1_BSL_WS/OMAP-L138_GEL_BSL_Files/bsl/lib/evmomapl138_bsl.lib" 
    <Linking>
    
     undefined          first referenced
      symbol                in file     
     ---------          ----------------
     LIDDAddrIndexSet   ./main.obj      
     LIDDCSTimingConfig ./main.obj      
     LIDDClkConfig      ./main.obj      
     LIDDDataWrite      ./main.obj      
     LIDDDisplayEnable  ./main.obj      
     LIDDModeSet        ./main.obj      
     LIDDPinMuxSetup    ./main.obj      
     PSCModuleControl   ./main.obj      
    
    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "a2.out" not built
    
    >> Compilation failure
    gmake: *** [a2.out] Error 1
    gmake: Target `all' not remade because of errors.
    
    **** Build Finished ****
    
    
    
    =================================================================
    main.c  
    ==========
    /*
     * Integrating StarterWare LCDC into SYSBIOS
     */
    #include <xdc/std.h>
    #include <xdc/runtime/Log.h>
    
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Semaphore.h>
    
    #include <xdc/cfg/global.h>
    
    
    /*
     * 	=====	Include starterWare files
     */
    
    #include "lidd.h"
    #include "psc.h"
    #include "interrupt.h"
    #include "soc_OMAPL138.h"
    #include "hw_psc_OMAPL138.h"
    #include "evmOMAPL138.h"
    
    
    /*
     * 	=====	Internal variable definitions for LCDC
     */
    
    
    #define LIDD_INTERFACE_CLOCK        1181102
    #define LIDD_CS                     0x1
    //	Character LCD command set
    #define LIDD_DISPLAY_INIT_SEQ1      0x30 /*Standard init command*/
    #define LIDD_DISPLAY_INIT_SEQ2      0x38 /*Two line 5x7 dot matrix*/
    #define LIDD_DISPLAY_OFF            0x8
    #define LIDD_DISPLAY_CLEAR          0x1
    #define LIDD_ENTRY_MODE             0x6 /*Incremental address, display shift off*/
    #define LIDD_DISPLAY_HOME           0x2
    #define LIDD_DISPLAY_ON             0xF /*Display, cursor, blink on*/
    #define LIDD_DISPLAY_CURSOR_OFF     0xC /*Display, cursor, blink on*/
    #define LIDD_DISPLAY_SCROLL_RIGHT   0x1C/*Display shift right*/
    #define LIDD_DISPLAY_SCROLL_LEFT    0x18/*Display shift left*/
    #define LIDD_DISPLAY_SET_LINE_1     0x80/*Point to Display RAM line 1 start*/
    #define LIDD_DISPLAY_SET_LINE_2     0xC0/*Point to Display RAM line 2 start*/
    
    
    Void idl0Fxn();
    Void LCDC_task(UArg arg0, UArg arg1);
    
    
    
    
    /*
     *  ======== main ========
     */
    Void main(Int argc, Char* argv[])
    {
    
    	char *message = "LCDC task";
    
        Task_Params taskParams;
        Task_Handle tsk1;
    
        Task_Params_init(&taskParams);
        taskParams.priority = 1;
        tsk1 = Task_create (LCDC_task, &taskParams, NULL);
    
    
    	Log_info0(message);
    	BIOS_start();
    }
    
    
    Void idl0Fxn()
    {
        Log_info0("Entering idl0Fxn.");
    
    //    Semaphore_post(sem0);
    
        Log_info0("Exiting idl0Fxn.");
    
        BIOS_exit(0);
    }
    
    /*
    /*	=====  Internal function definitions for LCDC
    /*
    
    
    /* General delay loop */
    static void Delay(volatile unsigned int count)
    {
        while(count--);
    }
    
    /*
    ** Configures LCD in LIDD mode for interfacing character display
    */
    static void SetUpLCD(void)
    {
        unsigned int csConf;
    
        PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_LCDC, PSC_POWERDOMAIN_ALWAYS_ON,
                         PSC_MDCTL_NEXT_ENABLE);
    
        LIDDPinMuxSetup();
    
        LIDDDisplayEnable();
    
        LIDDClkConfig(SOC_LCDC_0_REGS, LIDD_INTERFACE_CLOCK, SOC_LCDC_0_MODULE_FREQ);
    
        LIDDModeSet(SOC_LCDC_0_REGS, LIDD_MODE_HITACHI);
    
        /*
        ** The strobe timing parameters need to referred to from the
        ** character display datasheet
        */
        csConf = LIDD_CS_CONF(0, 1, 1, 0, 1, 1, 1);
        LIDDCSTimingConfig(SOC_LCDC_0_REGS, LIDD_CS, csConf);
    }
    
    /*
    ** The commands are written to the ADDR register since the writes
    ** to this register asserts the ALE/RS for the character LCD
    */
    static void DisplayControlValueWrite(unsigned char value)
    {
        LIDDAddrIndexSet(SOC_LCDC_0_REGS, LIDD_CS, value);
        Delay(0xFFF);
    }
    /*
    ** Init sequence for the display. For the exact sequence refer to the
    ** character display device data sheet
    */
    static void InitDisplay(void)
    {
        DisplayControlValueWrite(LIDD_DISPLAY_INIT_SEQ1);
        DisplayControlValueWrite(LIDD_DISPLAY_INIT_SEQ1);
        DisplayControlValueWrite(LIDD_DISPLAY_INIT_SEQ1);
    
        DisplayControlValueWrite(LIDD_DISPLAY_INIT_SEQ2);
    
        DisplayControlValueWrite(LIDD_DISPLAY_OFF);
    
        DisplayControlValueWrite(LIDD_DISPLAY_CLEAR);
    
        DisplayControlValueWrite(LIDD_ENTRY_MODE);
    }
    
    static void DisplayMsgWrite(char *msg, unsigned int len)
    {
        unsigned int count;
    
        for (count = 0;  count < len; count++)
        {
            LIDDDataWrite(SOC_LCDC_0_REGS, LIDD_CS, msg[count]);
            Delay(0xFFFF);
        }
    }
    /* Horizontal scroll */
    static void DisplayMsgScroll(unsigned int len)
    {
        unsigned int count;
    
        for (count = 0;  count < len; count++)
        {
            DisplayControlValueWrite(LIDD_DISPLAY_SCROLL_RIGHT);
    		Delay(0xFFFFF);
        }
    
    	Delay(0x3FFFFF);
    
        for (count = 0;  count < len; count++)
        {
            DisplayControlValueWrite(LIDD_DISPLAY_SCROLL_LEFT);
    		Delay(0xFFFFF);
        }
    }
    
    
    
    /*
     * ======== task1 ========
     */
    
    Void LCDC_task(UArg arg0, UArg arg1)
    {
    
       Log_info0("Setting up LCDC");
       SetUpLCD();
       Log_info0("Setting up LCDC complete");
    
       Log_info0("Setting up LCDC");
       InitDisplay();
       Log_info0("Initializing LCDC complete");
    
       /* Turn on the display */
       Log_info0("Turning On the LCDC");
       DisplayControlValueWrite(LIDD_DISPLAY_ON);
       Log_info0("Turning On the LCDC complete");
    
       Log_info0("Bringing Cursor to home in LCDC");
       DisplayControlValueWrite(LIDD_DISPLAY_HOME);
       Log_info0("Bringing Cursor to home in LCDC complete");
    
       Log_info0("Switching Off the cursor in LCDC");
       DisplayControlValueWrite(LIDD_DISPLAY_CURSOR_OFF);
       Log_info0("Switching Off the cursor in LCDC complete");
    
       do
       {
           DisplayControlValueWrite(LIDD_DISPLAY_HOME);
           DisplayMsgWrite("StarterWare in SYSBIOS", 22);
           DisplayMsgScroll(40);
       } while(1);
    
    }
    ====================================================
    a2.cfg file
    ===========
    
    
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Error = xdc.useModule('xdc.runtime.Error');
    var Log = xdc.useModule('xdc.runtime.Log');
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');
    
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var Idle = xdc.useModule('ti.sysbios.knl.Idle');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    
    /* 
     * Program.argSize sets the size of the .args section. 
     * The examples don't use command line args so argSize is set to 0.
     */
    Program.argSize = 0x0;
    
    /*
     * Uncomment this line to globally disable Asserts.
     * All modules inherit the default from the 'Defaults' module.  You
     * can override these defaults on a per-module basis using Module.common$. 
     * Disabling Asserts will save code space and improve runtime performance.
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
     */
    
    /*
     * Uncomment this line to keep module names from being loaded on the target.
     * The module name strings are placed in the .const section. Setting this
     * parameter to false will save space in the .const section.  Error and
     * Assert messages will contain an "unknown module" prefix instead
     * of the actual module name.
    Defaults.common$.namedModule = false;
     */
    
    /*
     * Minimize exit handler array in System.  The System module includes
     * an array of functions that are registered with System_atexit() to be
     * called by System_exit().
     */
    System.maxAtexitHandlers = 4;       
    
    /* 
     * Uncomment this line to disable the Error print function.  
     * We lose error information when this is disabled since the errors are
     * not printed.  Disabling the raiseHook will save some code space if
     * your app is not using System_printf() since the Error_print() function
     * calls System_printf().
    Error.raiseHook = null;
     */
    
    /* 
     * Uncomment this line to keep Error, Assert, and Log strings from being
     * loaded on the target.  These strings are placed in the .const section.
     * Setting this parameter to false will save space in the .const section.
     * Error, Assert and Log message will print raw ids and args instead of
     * a formatted message.
    Text.isLoaded = false;
     */
    
    /*
     * Uncomment this line to disable the output of characters by SysMin
     * when the program exits.  SysMin writes characters to a circular buffer.
     * This buffer can be viewed using the SysMin Output view in ROV.
    SysMin.flushAtExit = false;
     */
    
    /*
     * The BIOS module will create the default heap for the system.
     * Specify the size of this default heap.
     */
    BIOS.heapSize = 0x2000;
    
    /* System stack size (used by ISRs and Swis) */
    Program.stack = 0x1000;
    
    /* Circular buffer size for System_printf() */
    SysMin.bufSize = 0x400;
    
    /* Create the required tasks. */
    var tskParams = new Task.Params;
    tskParams.instance.name = "tsk0";
    tskParams.arg0 = 1;
    tskParams.arg1 = 2;
    tskParams.priority = 1;
    tskParams.vitalTaskFlag = false;
    
    tskParams = new Task.Params;
    tskParams.instance.name = "tsk1";
    tskParams.arg0 = 11;
    tskParams.arg1 = 12;
    tskParams.priority = 1;
    tskParams.vitalTaskFlag = false;
    
    tskParams = new Task.Params;
    tskParams.instance.name = "tsk2";
    tskParams.arg0 = 21;
    tskParams.arg1 = 22;
    tskParams.priority = 1;
    tskParams.vitalTaskFlag = false;
    
    LoggerBuf.TimestampProxy = xdc.useModule('xdc.runtime.Timestamp');
    
    /* Create default logger for the whole system. */
    var LoggerBufParams = new LoggerBuf.Params;
    var logger0 = LoggerBuf.create(LoggerBufParams);
    Defaults.common$.logger = logger0;
    
    /* Turn on USER1 logs in Task module */
    Task.common$.diags_USER1 = Diags.RUNTIME_ON;
    
    /* Turn on INFO logs in Main module (all non-modules) */
    Main.common$.diags_INFO = Diags.RUNTIME_ON;
    
    System.SupportProxy = SysMin;
    
    /* Add idle function */
    Idle.addFunc('&idl0Fxn');
    =======================================================

    Please tell me what is going  wrong in the linking process. I included all the files it seems or any thing missing?

    Please reply soon.

    With warm regards.

    Mahesh

  • The linker is unable to resolve the above listed symbols.  In other words, it can not find the implementation of these functions, structures, etc. within the object and library files you have included in this project.

    If you only included the header file, and setup the compiler with the appropriate path to the header file, that gets you past the compiler.  But the linker will need the path to the object files and library files, as well as any library files included in the project.

  • Dear BrandonAzbell,

    Thank you very much for kind response. I have been waiting till now in this mid-night for this response due to it's urgency.

    As you said:

    But the linker will need the path to the object files and library files, as well as any library files included in the project.

    1. Could you please tell what is the default path location for these in case of LCDC.

    2. I made a quick search of  ".lib" in the SatrterWare installation directory by using Windows search and found too many .lib but could not discover that needed for LCDC project.

    2. Any general guideline towards this for beginners?

    Waiting for the reply,

    Prat

     

     

  • In order to answer you fundamental question of which library, I opened one of the example projects that have been provided for the OMAP-L138 EVM.  Specifically, the Graphics Library demo (grlib_demo) because this would need to use the LCD controller.

    Opening that project showed which libraries where needed.

    You need to include the drivers.lib found in <STARTERWARE_INSTALL_DIR>\binary\armv5\cgt\<device>\drivers\Release

     

    As a general guideline, looking at and understanding the construction of one of the existing example projects for the OMAP-L138 EVM is a great starting point to see what things you need to include.

  • Hello friend,

    although I currently need LCDC features, I linked several .lib files to my project  and resolved the symbol resolution problem. But I have one question. Will linking these extra   .lib files cause any run-time errors/exceptions?

     lib files linked are

    drivers.lib, nand.lib, grlib.lib, usblib.llibutils.lib, system_config.lib, platform.lib, ipclib.lib

     

    2 Now I move ahead to tasking the API calls.

          - I create a single task and called all the APIs to setup, init, control and display the string on LCDC inside the taskfunction. Is this acceptable way of tasking in SYSBIOS with StarterWare API development? Or shall I have to task individual APIs.

     

    - By creating and invoking a single task for setup, init, control and display the string on LCDC with ARM9 gives a run-time exception as shown here.

     

    ==================CIO=====================

    [ARM9_0] Exception occurred in ThreadType_Task.

    Task handle: 0xc3010020.

    Task stack base: 0xc3010068.

    Task stack size: 0x800.

    R0 = 0x01e27040  R8  = 0xffffffff

    R1 = 0x00000010  R9  = 0xffffffff

    R2 = 0x00000000  R10 = 0xffffffff

    R3 = 0x00000003  R11 = 0xffffffff

    R4 [ARM9_0] = 0xffffffff  R12 = 0x00000003

    R5 = 0xffffffff  SP(R13) = 0xc3010800

    R6 = 0xffffffff  LR(R14) = 0xc300012c

    R7 = 0xffffffff  PC(R15) = 0xc3005f6c

    PSR = 0x600000df

    ti.sysbios.family.arm.exc.Exception: line 174: E_dataAbort: pc = 0xc3005f6c, lr = 0xc300012c.

    [ARM9_0] xdc.runtime.Error.raise: terminating execution

     

    code snippet is,

    # include  ……….

    Main()

    {

     

    // Task related declaration without Error_Block;

    // creating task with priority=1

      tsk1 = Task_create (LCDC_task, &taskParams, NULL);

    }

     

    // task fxn:

    Void LCDC_task(UArg arg0, UArg arg1)

    {

     

    unsigned int csConf; 

     Log_info0("Setting up LCDC");

       SetUpLCD();

       Log_info0("Setting up LCDC complete");

       InitDisplay();

     

       /* Turn on the display */

       DisplayControlValueWrite(LIDD_DISPLAY_ON);

       DisplayControlValueWrite(LIDD_DISPLAY_HOME);

       DisplayControlValueWrite(LIDD_DISPLAY_CURSOR_OFF);

     

       do

       {

           DisplayControlValueWrite(LIDD_DISPLAY_HOME);

           DisplayMsgWrite("StarterWare in SYSBIOS", 22);

           DisplayMsgScroll(40);

       } while(1);

     

    }

    ==================================

    RTA Raw log shows the following

     

    334,1,,Main,""../a4_main.c", line 52: before task creation",xdc.runtime.LoggerBuf.Instance#0

     

    "2,518",2,,Main,""../a4_main.c", line 54: after task creation",xdc.runtime.LoggerBuf.Instance#0

     

    "44,570",3,,Main,""../a4_main.c", line 57: after delay",xdc.runtime.LoggerBuf.Instance#0

     

    "44,965",4,,Task,"LM_switch: oldtsk: 0x0, oldfunc: 0x0, newtsk: 0xc3010020, newfunc: 0xc3000810",xdc.runtime.LoggerBuf.Instance#0

     

    "45,139",5,,Main,""../a4_main.c", line 69: Setting up LCDC",xdc.runtime.LoggerBuf.Instance#0

     

    "45,213",6,,Main,""..\LCDSetUp.h", line 47: Inside SetUpLCD",xdc.runtime.LoggerBuf.Instance#0

     

    "53,899",7,,Exception,"ERROR: "(unknown file)", line 174: E_dataAbort: pc = 0xc3005dfc, lr = 0xc300012c.",xdc.runtime.LoggerBuf.Instance#0

     

    It seems that it enters the task function, writes the log but not sure what is happening to API calls.

    Can you please give solution to this exception problem?

    Thank you

    With best regards,

    Prat

     

  • Could anybody clarify the above

    Prat

  • Regarding the libraries, I see an issue with including all of them.  The linker will only pull in the libraries when they are needed.

    For the exception you are observing, you should start backing out items until the exception goes away to understand what the offending code is.