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.

CC2640R2F: Adding on-chip oad to simple serial socket server example. Linker Error: Unable to find cc2640r2_stack_FlashROM_Library.a

Part Number: CC2640R2F
Other Parts Discussed in Thread: LAUNCHXL-CC2640R2, CC2650, CC2640, UNIFLASH

I am trying to add on-chip oad capability to the simple serial socket server project running on the LaunchXL-CC2640R2 rev 1.0.  I am using the simple serial socket sever example from the sdk revision 2.20.00.49 example pack. I am using the the steps outlined in the sw developers guide and referencing the example on-chip oad project included in the sdk. 

After adding the bim, persistent app, and updating the stack builds, those projects were able to build, link, and run their post-build actions.  However, the application project fails to link with the following error:

IAR Link Error when building the App

Fatal Error[Li001]: could not open file "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\simple_serial_socket_server\tirtos\iar\stack\FlashROM_Library\Exe\cc2640r2lp_stack_FlashROM_Library.a" 

My questions are as follows:

1. Where in the build configuration is the stack image provided to the linker? The simple_peripheral on-chip oad example links to the .out file, not a .a file.

2. When adding oad capability, I removed the stack project for the serial server  and added the stack project from the on-chip example.  Is this correct, or should the stack project  included in the serial server example be modified to support oad. 

3. I directly added the persistent app and bim projects from the on-chip oad example to the simple_serial_socket_server workspace.  Is this correct or should I have coped the projects and added the copied projects to the workspace?  I'm concerned the paths could be incorrect because the example pack installs to a different directory than the included sdk examples.

The serial server project path is:

 C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\simple_serial_socket_server\tirtos\iar

while the bim, stack, and persistent app projects are at:

C:\ti\simplelink_cc2640r2_sdk_2_20_00_49\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar

Thanks for any and all help with this issue!

The IAR Version 8.20.2 project options used are provided below.  You can stop reading here unless you want details of the project settings and defines.

__________________________________________________

Simple Serial Server app options


Linker Configuration File

$SRC_BLE_DIR$\common\cc26xx\iar\cc26xx_app_oad.icf

App Linker Configuration symbols :

CC2650=2
FLASH_ROM_BUILD=2
OSAL_SNV=1

App Compiler Defined Symbols

CC2640R2_LAUNCHXL
CC26XX
CC26XX_R2
DeviceFamily_CC26X0R2
ICALL_EVENTS
ICALL_JT
ICALL_LITE
ICALL_MAX_NUM_ENTITIES=6
ICALL_MAX_NUM_TASKS=4
ICALL_STACK0_ADDR
MAX_NUM_BLE_CONNS=1
SDI_USE_UART
RF_SINGLEMODE
xSTACK_LIBRARY
USE_ICALL
xPOWER_SAVING
xdc_runtime_Assert_DISABLE_ALL
xdc_runtime_Log_DISABLE_ALL
OAD_ONCHIP
MAX_PDU_SIZE=251
IMAGE_INVALIDATE
HAL_IMAGE_B
SPLIT_APP_STACK_IMAGE
OSAL_SNV=1
OSAL_CBTIMER_NUM_TASKS=1

App pre-build command line

"$XDCROOT$\xs" --xdcpath="$XDCPATH$" iar.tools.configuro -c "$TOOLKIT_DIR$" --cc "$COMPILER_PATH$" --device "$DEVICE$" --compileOptions $COMPILER_ARGS_ROOT_QUOTED$ --linkOptions $LINKER_ARGS_QUOTED$ --profile release --projFile "$PROJ_PATH$" --cfgArgs "{NO_ROM:0, OAD_IMG_B:1}" -o $PROJ_DIR$\..\config\configPkg $EXAMPLE_BLE_ROOT$\tirtos\app_ble.cfg

App post-build command line

$TOOLS_BLE_DIR$\output_converter\output_converter.exe $EXE_DIR$\$TARGET_BNAME$.bin

Stack Project options

Stack Output was changed from Library to Executable.

Stack Linker Options

config file: $SRC_BLE_DIR$\common\cc26xx\iar\cc26xx_stack_oad.icf

Stack Linker configuration symbols

FLASH_ROM_BUILD=2
CC2650=2
OSAL_SNV=1

Stack Compiler options

CC26XX
CC26XX_R2
DeviceFamily_CC26X0R2
EXT_HAL_ASSERT
FEATURE_OAD
FLASH_ROM_BUILD
GATT_NO_CLIENT
ICALL_EVENTS
ICALL_JT
ICALL_LITE
OSAL_CBTIMER_NUM_TASKS=1
OSAL_SNV=1
POWER_SAVING
SPLIT_APP_STACK_IMAGE
xSECURITY
USE_ICALL

Stack pre-build command line

$TOOLS_BLE_DIR$\lib_search\lib_search.exe $EXAMPLE_BLE_ROOT$\tirtos\build_config.opt $SRC_BLE_DIR$\blelib $PROJ_DIR$\..\config\lib_linker.cmd cc2640 $TOOLS_BLE_DIR$\lib_search\lib_search.xml $SRC_BLE_DIR$\symbols

Stack post-build command line

cmd /C "$TOOLS_BLE_DIR$\frontier\frontier.exe iar $PROJ_DIR$\$CONFIG_NAME$\List\$TARGET_BNAME$.map $PROJ_DIR$\..\config\iar_boundary.bdef $PROJ_DIR$\..\config\iar_boundary.xcl & $TOOLS_BLE_DIR$\output_converter\output_converter.exe $EXE_DIR$\sp_oad_onchip_$PROJ_FNAME$_$CONFIG_NAME$.bin -b $PROJ_DIR$\..\config\iar_boundary.bdef & $TOOLS_BLE_DIR$\oad\oad_image_tool_unsecure.exe iar $PROJ_DIR$ 2 $EXE_DIR$\$TARGET_BNAME$.hex $PROJ_DIR$\..\config\iar_boundary.xcl -o $EXE_DIR$\$TARGET_BNAME$_oad"

  • Hey Jay,

    I apologize for the delay in response.

    Take a look at the SimpleLink Academy Module that outlines how to add OAD to an existing project: dev.ti.com/.../

    You are correct in that we need to modify the existing stack project for simple serial socket. Do not remove that stack library from the project, as all we're doing is adding on. The simple serial application relies on some of the apis in the stack project.

    The SimpleLink Academy module is detailed, so follow those steps to avoid any path/linker issues.

    Let me know if you have any questions along the way.

  • The link provided gives instructions for how to add off-chip oad capability to an existing project. Is there another module that details the steps to add on-chip oad to an existing project?

  • Hey Jay,

    Take a look here: dev.ti.com/.../oad_onchip.html

    The flash space on the device may be limited when using on-chip OAD on the CC2640R2. Note, the documentation linked is for an older version of our SDK, but most things will translate over.

  • Any updates, Jay?
  • The Link was helpful and I am currently working through the steps in the guide. I might not have an update until next week, but will post the status when it is complete.

    Thanks!

  • Hey Jay,

    How's it going? Please let me know if you have any follow up questions.
  • After following the upgrade steps outlined in the provided link, I am getting link errors.due to duplicate definitions..

    Is this related to switching from a STACK_LIBRARY configuration to a SPLIT_APP_STACK_IMAGE?

     

    Linking
    Error[Li006]: duplicate definitions for "L2CAP_bm_alloc"; in "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\bluetooth_processor\tirtos\iar\app\FlashROM_StackLibrary\Obj\icall_api_lite.o", and "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\
    bluetooth_processor\tirtos\iar\config\ble_r2.symbols"
    Error[Li006]: duplicate definitions for "GATT_bm_alloc"; in "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\bluetooth_processor\tirtos\iar\app\FlashROM_StackLibrary\Obj\icall_api_lite.o", and "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\
    bluetooth_processor\tirtos\iar\config\ble_r2.symbols"
    Error[Li006]: duplicate definitions for "GATT_bm_free"; in "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\bluetooth_processor\tirtos\iar\app\FlashROM_StackLibrary\Obj\icall_api_lite.o", and "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\
    bluetooth_processor\tirtos\iar\config\ble_r2.symbols"
    Error[Li006]: duplicate definitions for "linkDBNumConns"; in "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\bluetooth_processor\tirtos\iar\app\FlashROM_StackLibrary\Obj\peripheral.o", and "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\
    bluetooth_processor\tirtos\iar\config\ble_r2.symbols"
    Error[Li005]: no definition for "_bim_var" [referenced from C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\bluetooth_processor\tirtos\iar\app\FlashROM_StackLibrary\Obj\simple_serial_socket_server.o]
    Error while running Linker

    Build aborted.

  • It looks like maybe there is an unnecessary include path in the file search path for your project. This can be related to the configuration switch, although I'm not certain.

    Most duplicate definitions are pointing to an object file, which is normally created after a build. Before adjusting the file search paths, try doing a clean build on the project. If the error persists, we may have to adjust the project settings. Please send a screenshot of the search path on the application side.

    Just to be sure, there were no changes made to the stack library, correct?
  • This linker error was introduced when switching from STACK_LIBRARY to SPLIT_APP_STACK_IMAGE. This was needed because the reset event handler called 2CAP_RegisterFlowCtrlTask(selfEntity), which needs the #define IDX_l2CAP_RegisterFlowCtrlTask, which is only included if STACK_LIBRARY is not defined.

    I tried with both build configurations of the stack,  one with STACK_LIBRARY and one with SPLIT_APP_STACK_IMAGE.  Both yield the same linker error.

    Cleaning the solution and re-building did not fix the issue.

    Linker Libraries Screenshot:

    Linker Include 

  • Hi,

    When converting from stack library to split image you will want to remove the ble_r2.symbols as this is now included by the stack.

    This is the cause of the double linking errors you have.

  • Hello,

    I haven’t heard from you for a few days, so I’m assuming you were able to resolve your issue. If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.

    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.
  • Sean's suggestion to remove the  ble_r2.symbols file from the config worked to resolve the linker error.  I had to replace it with the common_r2.symbols file in order to link the application.  I tried to load the images using UniFlash, but the stack was configured to be built as a library, so no hex file for the stack was generated. 

    I tried to switch the stack image from a library to a separate app and stack image, so the stack build would produce a downloadable .hex file.

    Change Stack Project General options -  set output file to executable rather than library

    For the stack, persistent, and serial server apps:

    Change stack preprocessor symbol STACK_LIBRARY to xSTACK_LIBRARY

    Add SPLIT_APP_STACK_IMAGE preprocessor symbol to the stack.

    After doing this, the stack builds, but the app is looking to link in the old library.  

    Fatal Error[Li001]: could not open file "C:\ti\ble_examples-simplelink_cc2640r2_sdk-2.20\examples\rtos\CC2640R2_LAUNCHXL\bleapps\bluetooth_processor\tirtos\iar\stack\FlashROM_Library\Exe\cc2640r2lp_stack_FlashROM_Library.a" 

    I looked at the Linker Library settings in the project and the linker cmd files linker.cmd, lib_linker.cmd, and did not see a reference to the old stack library.  The headers indicate these files are automatically generated, but the data created and modified doesn't coincide with the time they were build ( several days old ).

  • Hey Jay,

    cmd files are actually used in CCS. The equivalent in IAR is .icf, so check those files in your IAR workspace to see if there are any references to the old stack library.