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.

CC2630: How to build a TIMAC program starting at an address other than 0x0 - getting a bad ROM link

Part Number: CC2630
Other Parts Discussed in Thread: SYSBIOS, TIMAC, CC2650

I am writing for an existing (deployed) hardware product that has been running a non TI RTOS solution. Due to the nature of the flash on the CC2630 I cannot write to flash addresses below 0x1000 from software, thus any update I can apply remotely must only work with code at 0x1000 and after.

I've done the following to my ICF file

-  define symbol FLASH_SIZE          = 0x00020000;  // 128K
+  define symbol FLASH_SIZE          = 0x0001F000;  // 124K
..
-define region FLASH      = mem:[from FLASH_START to FLASH_END];
+define region FLASH      = mem:[from FLASH_SLOT_1 to FLASH_END];
..
-place at address mem:FLASH_START { readonly section .intvec };
-keep                             { readonly section .intvec };
+place at address mem:FLASH_SLOT_1 { readonly section .intvec };
+keep                              { readonly section .intvec };
... (cc26xx_rtos_rom.icf, done with every item below 0x1000)
-place at address mem:0x00000538 {readonly section .const_xdc_runtime_IModule_Interface__BASE__C};
+place at address mem:0x00001538 {readonly section .const_xdc_runtime_IModule_Interface__BASE__C};

The result compiles but fails shortly after jumping to __iar_program_start. It always ends at ti_sysbios_rom_cortexm_cc26xx_CC26xx_badRomLink__E. I attempted removing USE_SYSBIOS_IN_ROM=1 but it didn't change the result. The following code is still automatically generated in configPkg/package/cfg/app_prm3.c

Void ti_sysbios_rom_cortexm_cc26xx_CC26xx_checkRevision__E()
{
    if (*((UInt32 *)(REVISION_WORD)) != 0x20284770) {
	ti_sysbios_rom_cortexm_cc26xx_CC26xx_badRomRevision__E();
    }
    if (&ti_sysbios_rom_ROM_AONRTCChannelEnable != (Void *)(0x590)) {
	ti_sysbios_rom_cortexm_cc26xx_CC26xx_badRomLink__E();
    }
}

This code appears generated by CC26xx.xdt conditional on if it's an IAR build, nothing to do with sysbios being in ROM or where it might be located

%if (Program.build.target.$name.match(/iar/)) {
#pragma inline=never
Void ti_sysbios_rom_cortexm_cc26xx_CC26xx_badRomLink__E() {
	/* Loop here forever if application is built without the ROM section placements in the .icf file */
        while(1) {
            ;
        }
}

%}
Void ti_sysbios_rom_cortexm_cc26xx_CC26xx_checkRevision__E()
{
    if (*((UInt32 *)(REVISION_WORD)) != 0x20284770) {
	ti_sysbios_rom_cortexm_cc26xx_CC26xx_badRomRevision__E();
    }
%if (Program.build.target.$name.match(/iar/)) {
    if (&ti_sysbios_rom_ROM_AONRTCChannelEnable != (Void *)(0x590)) {
	ti_sysbios_rom_cortexm_cc26xx_CC26xx_badRomLink__E();
    }
%}
}

I'm not sure where to go from here. I either need a way to properly move the ROM references above 0x1000 or to work without them.

  • Hi,

    Thank you for reaching out. We will look into this and get back to you as soon as possible. In the meantime, can you specify which SDK version you are using?

    Best Regards,

    Jan

  • Hi Jan, I am using the versions required by TIMAC

         - TI-RTOS:  tirtos_simplelink_2_11_01_09
         - XDCTOOLS: xdctools_3_30_06_67_core

  • Stepping through the ROM sections assembly it is clear that there is no way to make it work. The ROM sections contain hard-coded to jumps with addresses <0x1000 so that section must be programmed in a compatible way. So the only way forward is to never call into ROM. This doesn't look possible with Z Stack on the 40/50 variants of the platform but I can't find a clear answer for TIMAC. The information I posted above doesn't bode well, though, since there are clearly some hard-coded assumptions that jumps are made into ROM. Although my predecessor was able to hack together a working implementation making no jumps into ROM, but he never wrote what versions he copied from (or how/if he modified them before committing) so I'm playing archeologist here.

  • Unfortunately the configurations in sysbios look like my suspicions are confirmed. Not sure why a config with this name was written in the first place but

    enum RomName {
        CC2650,         /*! Use for all CC26xx devices */
    CC1350,         /*! Use for all CC13xx devices */
    CC2650_FLASH,	/*! THIS OPTION IS NOT SUPPORTED! */
    TM0SXX,		/*! THIS OPTION IS NOT SUPPORTED! */
    POTENZA		/*! THIS OPTION IS NOT SUPPORTED! */
    };

    I'm hoping I'm wrong and there's some supported away around this but it really looks like I'm SOL.

  • Hi Daniel,

    Have you modified the configuration file (*.cfg) to build SYSBIOS in Flash instead of ROM?  See the relevant E2E thread and set useSysbiosInRom to false.  Also, are you using the TIMAC Stack in Flash or ROM (see cc26xx_timac_stack_release.icf of the cc2650Stack project for more details) and have you made any changes to this project.

    Regards,
    Ryan

  • Ha, I totally forgot about the .cfg file. That was basically the solution. I did the following in addition to my original steps:

    * Followed the thread linked above and commented set "useSysbiosInRom = false;" (this cfg was copied from the MSA app)

    * Set ICALL_STACK0_ADDR to a higher value than the 0x9000 set in the MSA app, otherwise I had insufficient room for my app.

    * Modified timac_1_05_02_43299\Projects\mac\Stack\cc26xx_RTOS\include\CC2650\ICallAddrs.h to hardcode ICALL_STACK0_ADDR to the same address (its hardcoded at 0x9000 so it will cause crashes if left as-is). I will likely migrate this file into my source controlled project now that it's nonstandard.