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.

OTA client linker problem

Other Parts Discussed in Thread: CC2538, Z-STACK

I follow part 4 of SWRA353 v1.6 to add OTA client functionality on an application. I work on SampleLight application. Either I miss a step or the instruction has missing steps. I followed the steps on the instruction but when I compile the code it outputs this linker error 

Error[Li005]: no definition for "HalOTAInvRC" [referenced from C:\Texas Instruments\Z-Stack Home 1.2.2.42930\Projects\zstack\HomeAutomation\SampleLight\CC2538\Router\Obj\zcl_ota.o]

Error[Li005]: no definition for "HalOTARead" [referenced from C:\Texas Instruments\Z-Stack Home 1.2.2.42930\Projects\zstack\HomeAutomation\SampleLight\CC2538\Router\Obj\zcl_ota.o]

Error[Li005]: no definition for "HalOTAWrite" [referenced from C:\Texas Instruments\Z-Stack Home 1.2.2.42930\Projects\zstack\HomeAutomation\SampleLight\CC2538\Router\Obj\zcl_ota.o]

Error[Li005]: no definition for "HalOTAChkDL" [referenced from C:\Texas Instruments\Z-Stack Home 1.2.2.42930\Projects\zstack\HomeAutomation\SampleLight\CC2538\Router\Obj\zcl_ota.o]

Error[Li005]: no definition for "HalOTAInit" [referenced from C:\Texas Instruments\Z-Stack Home 1.2.2.42930\Projects\zstack\HomeAutomation\SampleLight\CC2538\Router\Obj\OnBoard.o]

However, I have the same linker options as SampleSwitch has.

The steps I followed:

1) added zcl_ota.c and zcl_ota.h to Profile folder on IAR

2) added

#if (defined OTA_CLIENT) && (OTA_CLIENT == TRUE)
#include "zcl_ota.h"
#endif

as a header,

#if (defined OTA_CLIENT) && (OTA_CLIENT == TRUE)
zclOTA_event_loop
#endif

into const pTaskEventHandlerFn tasksArr[] = {}, and

#if (defined OTA_CLIENT) && (OTA_CLIENT == TRUE)
zclOTA_Init( taskID );
#endif

into void osalInitTasks( void )() 

3) added "$PROJ_DIR$\..\..\..\OTA\Source" into "additiona include directories", and 

OTA_CLIENT=TRUE
OTA_HA
OTA_MANUFACTURER_ID=0xBEBE
OTA_TYPE_ID=0x2538
HAL_IMG_AREA=0

preprocessor

4) enabled "generate additional output" on "output converter" tab, then selected "intel extended" output format, and enabled "overrisedefault" option

5) Linker > Config, clicked on "override default" and "$PROJ_DIR$\..\..\..\Tools\CC2538DB\CC2538-OTA-Image-A.icf"

6) Clean > Rebuild all

I see that hal_ota.c and hal_ota.h are missings, then added them manually. now it outputs this error

"Fatal Error[Pe1696]: cannot open source file "armcm3flashutil.h" C:\Texas Instruments\Z-Stack Home 1.2.2.42930\Components\hal\target\CC2538\hal_ota.c 45"

(line 45 is "#include "armcm3flashutil.h""). I couldn't find location of the header. Did I do something wrong by including the extra include directory or do I need to add another directory that is not written on the document?

  • armcm3flashutil.h and armcm3flashutil.h are located at \Components\osal\mcu\cc2538

  • adding that folder to include solved the compiling problem. However, the program get stuck on ROM when I compile and load the new SampleLight with OTA client functionality. Something on the config or hal_ota.c/.h causes problem.

    I commented the additional OTA code on the OSAL_SampleLight.c ("zclOTA_event_loop", " zclOTA_Init( taskID++ );", and "  #include "zcl_ota.h"" lines).

    I have the following includes:

    $PROJ_DIR$\..\Source
    $PROJ_DIR$\..\..\Source
    $PROJ_DIR$\..\..\..\OTA\Source
    $PROJ_DIR$\..\..\..\..\..\Components\osal\mcu\cc2538
    $PROJ_DIR$\..\..\..\Zmain\TI2538DB
    $PROJ_DIR$\..\..\..\..\..\Components\hal\include
    $PROJ_DIR$\..\..\..\..\..\Components\hal\target\CC2538
    $PROJ_DIR$\..\..\..\..\..\Components\driverlib\cc2538\inc
    $PROJ_DIR$\..\..\..\..\..\Components\driverlib\cc2538\source
    $PROJ_DIR$\..\..\..\..\..\Components\sdriverlib\cc2538\source
    $PROJ_DIR$\..\..\..\..\..\Components\bsp\srf06eb_cc2538\drivers\source
    $PROJ_DIR$\..\..\..\..\..\Components\mac\include
    $PROJ_DIR$\..\..\..\..\..\Components\mac\high_level
    $PROJ_DIR$\..\..\..\..\..\Components\mac\low_level\srf05\single_chip
    $PROJ_DIR$\..\..\..\..\..\Components\mac\low_level\srf05
    $PROJ_DIR$\..\..\..\..\..\Components\mt
    $PROJ_DIR$\..\..\..\..\..\Components\osal\include
    $PROJ_DIR$\..\..\..\..\..\Components\services\sdata
    $PROJ_DIR$\..\..\..\..\..\Components\services\saddr
    $PROJ_DIR$\..\..\..\..\..\Components\stack\af
    $PROJ_DIR$\..\..\..\..\..\Components\stack\nwk
    $PROJ_DIR$\..\..\..\..\..\Components\stack\sapi
    $PROJ_DIR$\..\..\..\..\..\Components\stack\sec
    $PROJ_DIR$\..\..\..\..\..\Components\stack\sys
    $PROJ_DIR$\..\..\..\..\..\Components\stack\zcl
    $PROJ_DIR$\..\..\..\..\..\Components\stack\zdo
    $PROJ_DIR$\..\..\..\..\..\Components\zmac
    $PROJ_DIR$\..\..\..\..\..\Components\zmac\f8w

    Definitions:

    ewarm
    CC2538_USE_ALTERNATE_INTERRUPT_MAP=1
    FEATURE_RESET_MACRO
    SECURE=1
    TC_LINKKEY_JOIN
    NV_INIT
    xNV_RESTORE
    HOLD_AUTO_START
    ZTOOL_P1
    MT_TASK
    MT_APP_FUNC
    MT_SYS_FUNC
    MT_ZDO_FUNC
    LCD_SUPPORTED=DEBUG
    MULTICAST_ENABLED=FALSE
    ZCL_READ
    ZCL_WRITE
    ZCL_REPORT
    ZCL_EZMODE
    ZCL_BASIC
    ZCL_IDENTIFY
    ZCL_ON_OFF
    ZCL_SCENES
    ZCL_GROUPS
    xZCL_LEVEL_CTRL
    ZCL_DIAGNOSTIC
    FEATURE_SYSTEM_STATS
    xHAL_PWM
    xHAL_LED=FALSE
    OTA_CLIENT=TRUE
    OTA_HA
    HAL_IMG_AREA=0

    Output Converter: binary (intel extended does not change the result)

    Linker > Config: $PROJ_DIR$\..\..\..\Tools\CC2538DB\CC2538-OTA-Image-A.icf 

    Is there any include or definition that seem wrong to you? 

  • What do you mean the program get stuck on ROM?
  • When I press "download and debug" button, it loads the program then loops between 0xe3c and 0xe5a



    When I remove the OTA configs and leave the default configs, the code starts from the main()