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/PROCESSOR-SDK-OMAPL137: Bare metal Application development on evm-OMAPL137

Part Number: PROCESSOR-SDK-OMAPL137

Tool/software: Code Composer Studio

I have the following working environment:

1. Code Composer Studio  Version: 8.3.1.00004

2. Spectrum Digital EVM board: evm-OMAPL137

I have already tested the example  C:\ti\pdk_omapl137_1_0_9\packages\MyExampleProjects\GPIO_LedBlink_evmOMAPL137_c674xTestProject and it is working fine under TI-RTOS. Now I'm trying to build a new bare-metal application to control the GPIO pin DS1 of my board. Following is the code listing of the source file:

#define LED_DS1 12u
/* Standard header files */
#include <string.h>
#include <stdio.h>
/* Board header file */
#include <ti/board/board.h>
#include <ti/board/board_cfg.h>
/* Low level driver header files */
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>

//#include "GPIO_board.h"
//-------------------------------------------------------
// PROTOTYPES
//-------------------------------------------------------
void hardware_init(void);
void ledToggle (void);
void gpioPowerOn(void);
void delay(uint32_t count);

//-------------------------------------------------------
// Globals
//-------------------------------------------------------
volatile int16_t i16ToggleCount = 0;   // keep track of # LED toggles
//---------------------------------------------------------------------------
// main()
//---------------------------------------------------------------------------
void main(void)
{
   hardware_init();       // init hardware via Xware
   while(1)         // forever loop
   {
    ledToggle();       // toggle LED
    delay(8100000);      // create a delay of ~1/4sec
    i16ToggleCount += 1;     // keep track of #toggles
   }
}
//-----------------------------------------------------------------------------
// hardware_init()
//-----------------------------------------------------------------------------
void hardware_init(void)      //called by main
{
        Board_initCfg boardCfg;
        boardCfg =
        BOARD_INIT_PINMUX_CONFIG |
        BOARD_INIT_MODULE_CLOCK |
        BOARD_INIT_UART_STDIO;
        Board_init(boardCfg);
        GPIO_init();
        GPIO_setConfig(LED_DS1,GPIO_CFG_OUTPUT);
}
//-----------------------------------------------------------------------------
// ledToggle() is called to toggle LED DS1
//-----------------------------------------------------------------------------
void ledToggle(void)       //called by main
{
 static uint32_t LED_state = 0;    // used to toggle LED state
 if (LED_state == 1)       // if LED_state is "1" - ON, turn LED ON via GPIO
 {
     /* Write high to gpio pin to control LED1 */
         GPIO_write((LED_DS1), 1u);
  }
 else          // LED_state is "0" - OFF, turn LED OFF via GPIO
 {
     GPIO_write((LED_DS1), 0u);
 }
 LED_state ^= 1;        // toggle LED state
}

void delay(uint32_t count)
{
    volatile uint32_t tempCount = 0;
    for (tempCount = 0; tempCount < count; tempCount++)
    {
        /* dummy loop to wait for some time  */
    }
}
After tweaking with include/build paths and predefined  symbols settings for the compiler, I have managed to compile the code successfully. But in the linking phase I am getting errors for the unresolved objects which are actually the functions accessing GPIO hardware on my board. Following is the details of this error:

**** Build of configuration Debug for project blink_target_CCS ****
"C:\\ti\\ccsv8\\utils\\bin\\gmake" -k -j 8 all -O
 
Building file: "../main.c"
Invoking: C6000 Compiler
"C:/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.3.4/bin/cl6x" -mv6740 --include_path="C:/TI_RTOS/C6000/Labs/Lab_02/Project" --include_path="C:/ti/pdk_omapl137_1_0_9/packages" --include_path="C:/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.3.4/include" --define=evmOMAPL137 --define=SOC_OMAPL137 --define=omapl137 -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="main.d_raw"  "../main.c"
Finished building: "../main.c"
 
Building target: "blink_target_CCS.out"
Invoking: C6000 Linker
"C:/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.3.4/bin/cl6x" -mv6740 --define=evmOMAPL137 --define=SOC_OMAPL137 --define=omapl137 -g --diag_warning=225 --diag_wrap=off --display_error_number -z -m"blink_target_CCS.map" --heap_size=0x800 --stack_size=0x800 -i"C:/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.3.4/include" -i"C:/ti/ccsv8/tools/compiler/ti-cgt-c6000_8.3.4/lib" --priority --reread_libs --define=DSP_CORE=1 --diag_wrap=off --display_error_number --warn_sections --xml_link_info="blink_target_CCS_linkInfo.xml" --rom_model -o "blink_target_CCS.out" "./main.obj" "../OMAPL137.cmd"  -llibc.a
<Linking>
 
 undefined      first referenced
  symbol            in file    
 ---------      ----------------
 Board_init     ./main.obj     
 GPIO_init      ./main.obj     
 GPIO_setConfig ./main.obj     
 GPIO_write     ./main.obj     
 
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "blink_target_CCS.out" not built
 
>> Compilation failure
makefile:141: recipe for target 'blink_target_CCS.out' failed
gmake[1]: *** [blink_target_CCS.out] Error 1
makefile:137: recipe for target 'all' failed
gmake: *** [all] Error 2
**** Build Finished ****
I am not sure about what I have to add in the linker file search path to remove above errors. I would be very grateful if anybody could help me fix this problem.
Regards,
Abid Hussain

  • I am not sure about what I have to add in the linker file search path to remove above errors. I would be very grateful if anybody could help me fix this problem.

    In order to get a better idea of what might be the problem, could you share what have you modified in the include/build paths?

    Best Regards,
    Yordan

  • Thanks for your replay. Here is the screen clipping of linker include/search path settings: The TI_PDK_LIBRARIES variable is not pointing to any library file.

  • The path "C:\ti\pdk_omapl137_1_0_9\packages\ti\binary\ti\drv\gpio\gpio_profile\obj\Omapl137\C674\release" or similar contains object files like GPIO_drv.oe674 etc. but I have no idea which library file and search path I have to include to fix the problem.

    Regards,

    Abid Hussain

  • Hi,

    In this case can you create some of the existing GPIO examples in Processor SDK RTOS and see its configuration, then use the same for your bare metal application.

    Best Regards,
    Yordan

  • Dear Yordan,

    Thanks for your advice. In fact, the GPIO example ,which I have already tested , has been created to run under TI RTOS. The file gpio_test.cfg  associated with the example takes care of  linking of appropriate libraries required for the application and there is nothing defined in linker include/search paths. My issue is still there as when I try to create a bare-metal application, I no longer have such configuration file available for my application. Since my application is using GPIO LLD driver, the library functions which I used need to be resolved at the linking stage. 

    Regards,

    Abid Hussain

  • Hi Abid,

    In CCS, right click on your project, select properties, extend the C6000 Compiler and select Include Options. Make sure you have the path to ti/drv/gpio, in the RTOS project this is ${PDK_INSTALL_PATH}/ti/drv/gpio.

    And for the initial creation of a bare metal application, you should refer to the following resource:
     

    Best Regards,
    Yordan