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/CC2650: linker cmd file order problem

Part Number: CC2650

Tool/software: Code Composer Studio

I have encountered a somewhat maddening linker problem while working with the dual "app & stack" development methodology used for SimpleLink BLE projects.  I do not think this problem is specifically related to that, so I am posting in this forum instead. I am using CCS7 with BLE SDK 2.2.0.31 and TI-RTOS 2.18.0.3. I started development using the SimpleBLEPeripheral example project, and significantly modified the "app" portion while leaving the "stack" part intact. In order to facilitate easier inclusion in a revision control system (Git), I moved the unique source and project files to my workspace, and linked to the common, unmodified files that remained in the SDKs.  After some tweaking of the project properties, I was able to build the separate app and stack projects in my workspace, including, in particular, the stack-project-generated ccs_linker_defines.cmd used by the app to find the BLE stack function entry point and set available FLASH/RAM limits. For example:

/*
** Stack Frontier Generator 1.1.0 (2016-05-16 20:46:03.194000)
** ** WARNING - Auto-generated file. Modifications could be lost!
*/

--define=ICALL_RAM0_START=0x20004368
--define=ICALL_STACK0_START=0xf000
--define=ICALL_STACK0_ADDR=0xf001

This must occur in link order before the normal command file C:\ti\simplelink\ble_sdk_2_02_01_18\src\common\cc26xx\ccs\cc26xx_app.cmd

In my app project, I created a new linked resource path variable called STACK_PROJ_LOC, which I gave the value ${WORKSPACE_LOC}\ble_stack, and used that for locating ccs_linker_defines.cmd. Both ccs_linker_defines.cmd and cc26xx_app.cmd appear as linked files in the top directory of the project. Also, under Properties->Build->Link Order, I added the two files and arranged them so that ccs_linker_defines.cmd is on top. Building the project generates ccsObjs.opt like this:

“C:/workspace_ccs7/ble_stack/ccs_linker_defines.cmd" "C:/ti/simplelink/ble_sdk_2_02_00_31/src/common/cc26xx/ccs/cc26xx_app.cmd" "./Drivers/PIN/PINCC26XX.obj" "./Drivers/RF/RF.obj" "./Drivers/UART/UART.obj" "./Drivers/UART/UARTCC26XX.obj" "./ble_lib_if/ICall/icall.obj" "./ble_lib_if/ICall/icall_cc2650.obj" "./ble_lib_if/ICallBLE/ble_user_config.obj" "./ble_lib_if/ICallBLE/icall_api.obj" "./ble_lib_if/PROFILES/gatt_uuid.obj" "./ble_lib_if/PROFILES/gattservapp_util.obj" "./config/board.obj" "./config/ccfg_app_ble.obj" "./src/devinfoservice.obj" "./src/devapp.obj" "./src/gatt_profile.obj"  "./src/main.obj" "./src/peripheral.obj" "./src/util.obj" -l"configPkg/linker.cmd" -llibc.a -l"C:/ti/tirtos_cc13xx_cc26xx_2_18_00_03/products/cc26xxware_2_23_03_17162/driverlib/bin/ccs/driverlib.lib" -l"C:/ti/simplelink/ble_sdk_2_02_00_31/src/rom/common_rom_releases/03282014/common_rom.symbols"

The generated output is properly memory-limited and links (and runs) correctly with the stack build.

Next, for inclusion into Git, we decided to move the stack directory under the app project directory as a sub-module. After moving files around, I used File->Open Projects from File System... to open the new nested structure. CCS opened both projects (with Git labeling), with the stack showing up as a different project, but also as a directory (and also with Git labeling) inside the app project. I changed STACK_PROJ_LOC to ${PROJECT_LOC}\ble_stack to match the new location of ccs_linker_defines.cmd. I also had to exclude the stack directory from the build to avoid errors. Everything was left the same, including the link order setting.  When I build the project now, it generates ccsObjs.opt like this (my emphasis added):

"C:/ti/simplelink/ble_sdk_2_02_00_31/src/common/cc26xx/ccs/cc26xx_app.cmd" "./Drivers/PIN/PINCC26XX.obj" "./Drivers/RF/RF.obj" "./Drivers/UART/UART.obj" "./Drivers/UART/UARTCC26XX.obj" "./ble_lib_if/ICall/icall.obj" "./ble_lib_if/ICall/icall_cc2650.obj" "./ble_lib_if/ICallBLE/ble_user_config.obj" "./ble_lib_if/ICallBLE/icall_api.obj" "./ble_lib_if/PROFILES/gatt_uuid.obj" "./ble_lib_if/PROFILES/gattservapp_util.obj" "./config/board.obj" "./config/ccfg_app_ble.obj" "./src/devinfoservice.obj" "./src/devapp.obj" "./src/gatt_profile.obj"  "./src/main.obj" "./src/peripheral.obj" "./src/util.obj" "../ble_stack/ccs_linker_defines.cmd" -l"configPkg/linker.cmd" -llibc.a -l"C:/ti/tirtos_cc13xx_cc26xx_2_18_00_03/products/cc26xxware_2_23_03_17162/driverlib/bin/ccs/driverlib.lib" -l"C:/ti/simplelink/ble_sdk_2_02_00_31/src/rom/common_rom_releases/03282014/common_rom.symbols"

The resulting output is not linked properly with the BLE stack software, and does not work. I tried various combinations of moving files around and renaming, but the result was the same. In particular, it does not seem like the link order setting has any effect at all. The only thing I got to work (and match my original two-directory project) was by copying cc26xx_app.cmd into the ble_stack directory, and changing its name so that it occurred alphabetically after ccs_linker_defines.cmd (in which case, it ended up at the end of the link line, but at least after ccs_linker_defines.cmd).

Is there some reason the link order is not working? Is my method of nesting these projects not allowed?

Thanks for any help you can provide.

dave

  • Dave,

    This is indeed a strange issue but I did find one related internal bug report with very similar symptoms. However, that bug was supposed to be fixed in CCS 6.2 and higher. 
    Since you mentioned you were using CCSv7 that makes me wonder if it's the same issue or a different root cause that manifests itself in a similar manner.

    To start off, could you please attach the project metadata files (.*project) for the app project that does not honor the link order setting? If that is not sufficient to determine
    root cause we may need more, but let us start there first.

  • Thanks for responding.  Here are the requested files.

    ble_app_project.zip

  • any updates?

    Thanks!

    dave

  • Hi Dave,

    Because you have moved the "ccs_linker_defines.cmd" file from the root of the project into a subdirectory, you will need to remove/re-add it to the link order (Properties > Build > Link Order tab) in order to update its relative path.

    Let me know if this fixes your issue.

    Thanks,

    - Baltasar

  • Hi Baltasar,

    Thanks for responding.

    I already have done that in the project files I sent:

    (STACK_PROJ_LOC is defined as ${PROJECT_LOC}\ble_stack, and that file opens fine when I click on it from the project explorer.)

    One weird thing I found that does not happen with the (working) separate-directory version of these two projects is setting "Linker Command File" under the General/Main tab. In the other project, I set it to "<none>", and it appears blank when I open it subsequently.  On this broken version, I've tried setting it to none, which (I think) causes the linker command files to be excluded in Project Explorer.  If I "un"-exclude them, it inserts cc26xx_app.cmd under linker command file. If I force it to ccs_linker_defines.cmd, that does not work either.

  • Hi Dave,

    Since your ccs_linker_defines.cmd file is now physically inside the app project, there is no need to refer to it using a path-variable anymore.  I think this is what is causing the mismatch between the link-order and the makefile generation.  If you "unlink" that file and then re-add it to the link-order, it should show up as "ble_stack/ccs_linker_defines.cmd" in the Link Order tab.

    - Baltasar

  • Hi Baltasar,

    Yup, looks like that was the issue. I deleted the stack path variable entirely, updated the link order, and updated the also-affected Build->Advanced Options->Command Files. Rebuilding generated a correct ccsObjs.opt and an output identical to the separate-directory version.

    Many thanks for your help!

    dave