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.

CC2674R10: mcuboot: jump to application fails

Part Number: CC2674R10
Other Parts Discussed in Thread: CC1354P10

Tool/software:

Hi TI Team,

Example: mcuboot_LP_EM_CC1354P10_1_nortos_ticlang
SDK: simplelink_cc13xx_cc26xx_sdk_7_41_00_17

Using the bootloader example compiled with -O0 and EXCLUDE_TRACE undefined lead to an exception.

After investigating we discovered that start_app() in mcuboot_app.c is not safe.
The compiler might generate code which does not behave as expected.
Here is a suggestion for a fix:

__attribute__((noreturn, naked)) static void start_app(const uint32_t * volatile vector_table)
{
    /* The following code resets the SP to the value specified in the
     * provided vector table, and then the Reset Handler is invoked.
     *
     * Per ARM Cortex specification:
     *
     *           ARM Cortex VTOR
     *
     *
     *   Offset             Vector
     *
     * 0x00000000  ++++++++++++++++++++++++++
     *             |    Initial SP value    |
     * 0x00000004  ++++++++++++++++++++++++++
     *             |         Reset          |
     * 0x00000008  ++++++++++++++++++++++++++
     *             |          NMI           |
     *             ++++++++++++++++++++++++++
     *             |           .            |
     *             |           .            |
     *             |           .            |
     *
     * */

    /* Reset the SP with the value stored at vector_table[0] */
    __asm volatile ("ldr r1, [r0]");
    __asm volatile ("msr msp, r1");

    /* Jump to the Reset Handler address at vector_table[1] */
    __asm volatile ("ldr r0, [r0, #4]");
    __asm volatile ("bx r0"); // jump, not call (blx)
}

Best Regards,
Tobias