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.

CC13xx jump from bootloader to app

Hello

I'm write my custom bootloader (with TI RTOS) and app (also with TI RTOS). That are 2 separated applications mapped in another address in memory. That works fine. Problemm is with switching between this designs. I found some solution for another processors, but it doesn't work. After jump the application freezes...

I tryed, but unsuccessful:

uint32_t APP_ADDR = 0x10000;

HWREG(NVIC_DIS0) = 0xffffffff;
HWREG(NVIC_DIS1) = 0xffffffff;
			
HWREG(NVIC_VTABLE) = APP_ADDR;

__asm("    ldr     r1, [r0]\n"
"    mov     sp, r1\n");

__asm("    ldr     r0, [r0, #4]\n"
"    bx      r0\n");

  • I moved this thread to the device forum since it really is not a TI-RTOS issue. Have you looked at the bootloader code in TivaWare as a reference? Look in <TivaWare_install_dir>\boot_loader. Note: TI-RTOS does not include the bootloader code currently (there is an enhancement request to do so), so you'll need to get the TivaWare product to see the code.

    Todd
  • Hello Todd

    CC13xx is a Sub-1GHz device and it should be in Sub 1GHz Forum.

    Hello Jiri,

    Sorry for moving the post around. Hopefully you would be able to resolve the issue here.

    Regards
    Amit
  • Hi Jiri,

    First of all, you have to know that the C compiler may allocate different registers for local variables. So, you got to ensure what register is used since you are use inline assembly. It is better to do this all in assembly.

    You are assigning APP_ADDR to "vector table offset" register and then try to jump to the word address at 0x10004 (if C compiler assigned R0 to APP_ADDR). For ARMv7-M architecture, the vector table is only "constant values" to be read by CPU, not opcode to execute. I mean that CPU doesn't jump to there and execute code at 0x10004.

    After changing SP, what you need to do is jump to the "entry-point" of an application. An entry-point is usually named _c_int00 if compiled by TI C compiler i.e. "B   _c_int00".

    But this is not true since CC13xx and CC26xx need to trim device right after power up. TI already provides a function called trimeDevice() which needs to be executed before _c_int00. So, do this in assembly.

    RESET_ISR:
        BL    trimDevice
        B     _c_int00
    
    

    Where RESET_ISR is the address you need to put at address 0x10004. I can find trimDevice() in CC26xxWare, you have to find it in CC13xxWare(?) source tree. And now jump to RESET_ISR instead of _c_int00.

    Hope that this helpful for you.

  • I have solved my problemm. The problemm was, I jumped to app after run TI-RTOS (BIOS_start()) -> TI-RTOS exception. When I put the code befor this function, then it works fine.

    Thanks for useful answers.