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.

RTOS/CC2642R: Debug Configuration (RTOS in Flash) Fails w/ Mailbox Structures

Part Number: CC2642R
Other Parts Discussed in Thread: SYSBIOS, LAUNCHXL-CC26X2R1

Tool/software: TI-RTOS

Hello,

My colleague made a post here concerning our issues and lack of debug ability:  

The responses to this thread have been helpful - along with the realization that we had been working in the release configuration which suppressed a lot of the debug options that were available.

I have since run into an issue which has brought our debug efforts to a halt. As I was working between build configurations, I noticed a blurb of code in the ble_release.cfg file that can be commented out to put the BIOS in flash, and then another part to also check our task stacks for overflow conditions:

/* ================ ROM configuration ================ */
/*
 * To use BIOS in flash, comment out the code block below.
 */
var ROM = xdc.useModule('ti.sysbios.rom.ROM');
if (Program.cpu.deviceName.match(/CC26/)) {
  ROM.romName = ROM.CC26X2;
}
else if (Program.cpu.deviceName.match(/CC13/)) {
  ROM.romName = ROM.CC13X2;
}

/* ================ Task configuration ================ */
var Task = xdc.useModule('ti.sysbios.knl.Task');
/*
* Check task stacks for overflow conditions.
*
* Pick one:
* - true (default)
* Enables runtime checks for task stack overflow conditions during
* context switching ("from" and "to")
* - false
* Disables runtime checks for task stack overflow conditions.
*
* When using BIOS in ROM:
* This option must be set to false.
*/
Task.checkStackFlag = true;
//Task.checkStackFlag = false;

Great, right? Well, not so fast.

After making the modifications necessary to exclude/include the right code in my now modified .cfg file, I cleaned and re-built the project, where I was hit with the old "unresolved symbols remain" error. Namely, the below was undefined:

undefined first referenced
symbol in file
--------- ----------------
ti_sysbios_knl_Mailbox_Params__init__S <whole-program>
ti_sysbios_knl_Mailbox_construct <whole-program>
ti_sysbios_knl_Mailbox_pend__E <whole-program>
ti_sysbios_knl_Mailbox_post__E <whole-program>

Obviously, these are all of the basic mailbox-structure function calls that we use over and over for multiple I2C and SPI operations to multiple external hardware devices. The code files are still existent, I can use F3 to jump into the source files and see the definitions in the source files and everything. As it seems, whenever you put RTOS into flash, these functions are no longer defined (or are just not in the BIOS.obj library or something). If you uncomment the "put BIOS in ROM" section back in and use ROM-based RTOS, everything is fine again.

So now the fun debug features I was looking forward to aren't usable unless I heavily modify my code to exclude mailbox usage... which is pointless.

Being the skeptical individual I am, I immediately thought I did something wrong to break the code, and it was my fault. So, I opened a brand new simple_peripheral project in a different workspace. It built successfully in both Release and Debug configurations, BUT it doesn't use a mailbox. So, I added my structure and variable definitions, along with some of my init code below and dropped it straight into SimplePeripheral_init so I knew it would attempt to link it in: 

// TW DEBUG
typedef struct I2C_InfoMsgObj {
uint8_t slave_addr;
uint8_t tx_length;
uint8_t* tx_data;
uint8_t rx_length;
uint8_t* rx_data;
} I2C_InfoMsgObj;
typedef struct I2C_MailboxInfoMsgObj {
Mailbox_MbxElem elem; /* Mailbox header */
I2C_InfoMsgObj obj; /* Info mailbox */
} I2C_MailboxInfoMsgObj;
I2C_MailboxInfoMsgObj i2cInfoBuffer[4];
Mailbox_Struct I2C_mbxInfoStruct;
Mailbox_Handle I2C_mbxInfoHandle;

  // TW DEBUG
  Mailbox_Params mbxParams;
  Mailbox_Params_init(&mbxParams);
  mbxParams.buf = &i2cInfoBuffer;
  mbxParams.bufSize = sizeof(i2cInfoBuffer);
  Mailbox_construct(&I2C_mbxInfoStruct, sizeof(I2C_InfoMsgObj), 4, &mbxParams, NULL);
  I2C_mbxInfoHandle = Mailbox_handle(&I2C_mbxInfoStruct);

The result is that the Debug configuration spit out a very similar error, but only with the first two parts included (as I didn't copy in pend/post usage at all).

After all this - the question becomes, is the flash library image of TI-RTOS not complete with Mailbox usage? How do I get these functions to be properly defined so I can have a proper debug configuration?

undefined first referenced
symbol in file 
--------- ----------------
ti_sysbios_knl_Mailbox_Params__init__S <whole-program> 
ti_sysbios_knl_Mailbox_construct <whole-program> 

  • Hi Tyler,

    Could you upload your .cfg file?

    I just tried to replicate your steps in a fresh project for the LAUNCHXL-CC26X2R1, with both the release and debug configurations of TI-RTOS, and still got no linker errors. Which SDK version are you using?
  • Edvard, 

    We recently took measures to step-by-step upgrade our project to use simplelink_cc26x2_sdk_2_30_00_34. As far as I know this is the most up to date.

    Below you will find attached the modified version of simple_peripheral.c I used to cause the error in the Debug configuration (linking step failed so I never got to put the code on any target), as well as the modified version of the release .cfg file I have been using with our own source code.

    Let me know if you need anything else.

    Altered version of simple_peripheral.c3175.simple_peripheral.c

    Config file:ble_release_modified.cfg

  • Edvard,

    For good measure, I re-retried my process and got the same failure. To summarize all the steps (so hopefully you can see the issue as well):

    1. Clean import of ble5_simple_peripheral_cc26x2r1lb_app project from the Resource Explorer (Software -> SimpleLink CC26X2 SDK - v:2.30.00.34 -> Examples -> Development Tools -> CC26x2R LaunchPad -> BLE5-Stack -> simple_peripheral -> TI-RTOS -> CCS Compiler -> simple_peripheral_app)
    2. Rebuild stack library project for good measure
    3. Change active build configuration to FlashROM_Debug
    4. Make modifications shown in previously attached altered version of simple_peripheral example
    5. Rebuild app project

    Below is the entirety of the error message I recieve:

    <Linking>
    
     undefined                              first referenced
      symbol                                    in file     
     ---------                              ----------------
     ti_sysbios_knl_Mailbox_Params__init__S <whole-program> 
     ti_sysbios_knl_Mailbox_construct       <whole-program> 
    
    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "ble5_simple_peripheral_cc26x2r1lp_app.out" not built
    
    >> Compilation failure
    makefile:190: recipe for target 'ble5_simple_peripheral_cc26x2r1lp_app.out' failed
    makefile:183: recipe for target 'all' failed
    gmake[1]: *** [ble5_simple_peripheral_cc26x2r1lp_app.out] Error 1
    gmake: *** [all] Error 2
    
    **** Build Finished ****
    

    I'll continue to try and debug this from my side, but I'm kind of lost as to where to go with it.

    Regards,
    Tyler Witt

  • Ok, I will try to retrace your steps.
  • I'm able to reproduce your error. The problem is that the *.cfg in the project does not include Mailbox when configuring the kernel.

    Add the following line anywhere in the *.cfg file,

    var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');

    and rebuild.

  • Edvard,

    That worked for me - thank you for the quick turnaround and resolution!

    Regards,
    Tyler Witt