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.

CC2652R: Trouble with jumping from bootloader to application

Other Parts Discussed in Thread: CC2652R

I am developing a bootloader and now want to jump to the application. At first I did this with a very barebone application which was a simple loop inside of which an integer kept getting incremented. This worked.

I jump to the application and could see from the disassembly in code composer studio that it was indeed going through that loop.

Now the next step is jumping from the bootloader to a more sophisticated application. To test with I use the pwmled2 example for my board. However this time it fails and ends up in the faultISR.

I suspect this might be because the Board_init() function is both called inside of my bootloader and the pwmled2 example. I need this function in the bootloader to access the SPI, NVS and GPIO API and the pwmled2 example uses it to use the GPIO pins as well.

How do I go around this problem? If it even is the Board_init() function because I am not entirely sure what the problem is. Is it possible to save some form of signal somewhere so I can reset the board and then read that value before calling Board_init() in the bootloader so I can immediately jump to the application?

If I change the configuration settings in the .sycfg file of the bootloader so they look like the ones in the .syscfg of the application then everything works. So the problem must be that pins are configured one way through the Board_init() method in the bootloader and then the Board_init() of the application tries to configure them another way. Is there some sort of opposite of Board_init() available?

Thank you in advance.

I use Code Composer Studio 9.3, the CC2652R, and the SimpleLink CC13x2 26x2 SDK version 3.40.0.02.

This is the code I use to jump to the application:

void jumpToApp(uint32_t sp, uint32_t pc) {
    asm(" LDR SP, [R0, #0x0]");
    asm(" LDR PC, [R0, #4]");
}

  • Hi Vincent,

    In your bootloader, which address in your application do you branch to? 

  • Hi M-W,

    The SP and PC values given to the jumpToApp function are 0 and 4 and the values at these locations in memory are 0x20013FF8 for the SP and 0x00003008 for the PC. The PC points to the resetISR() of the application which goes through the NOROM_CPUcpsid, NOROM_SetupTrimDevice, and _c_int00 routines before it ends up in main.

  • Hi Vincent, 

    have you made sure to close down all the peripherals (that you had in use before) and disable interrupts before doing the jump?

  • I am not sure what changed but everything seems to be working again.

    To continue developing I just kept the .sycfg files of both projects the same and started implementing more features. To come back to this question I changed everything back to what it was before so I could continue debugging this issue. However now everything seems to work. The .sycfg files are different and in the bootloader I use the two LEDs to indicate something is happening, blinking them all the time. At the end right before the jump I call clearDio and close the NVS and some other APIs and then jump. Now when I jump I see the LEDs changing values as they are supposed to do in the pwmled2 example. However I don't think anything is different from before I added those other features and these features do not interact with the hardware at all.

    So it could be I overlooked something very minor which got fixed when I put everything back but I dont know what it is.

    But thank you for your help anyway, M-W.