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.

CC2340R5: Jump to address

Other Parts Discussed in Thread: SYSCONFIG, CC2340R5, UNIFLASH

Hello , members

SDK version : 7.10.00.35

I load two images to CC2340,

Test Example Project :

(1) uartballback -> starting address : 0x00000000 (cant adversiting)

(2) basic_ble_LP_EM -> starting address : 0x00004800 (can adversiting)

(3) address = 0x00004800

I try to write code to make uartcallback can be jump to starting address of basic_ble_LP_EM 


I set a breakpoint at JUMP_TO_APPLICATION , and I check Disassembly to be right

then It really jump to "0x00004800" ,

But I press F5 , then It jump to "faultISR" , 

0x00004800 is vaild

if successlly , it can advertising data

Can anyone tell me how to correct it?






  • Hello Li,

    You have not provided any command linker (*.cmd) or SysConfig files, along with the dual-image loading procedure, so it is not feasible to assist with further debugging your use case with the information provided.  "JUMP_TO_APPLICATION" is not an API referenced by the SDK.

    If you are attempting to create a custom bootloader, I recommend you start with mcuboot and basic_ble_off_chip projects.  This approach uses two separate applications/projects to start off from reset in mcuboot and jumps to a valid basic_ble project.  You can read through the BLE5-Stack User's Guide and Debugging Guide as well as the Bluetooth LE SimpleLink Academy Labs

    Otherwise, you should simply merge the uartballback and basic_ble applications into one project.  If the one UART peripheral is an issue, then it should be possible to share this resource between applications by using TI Drivers to switch UART instances and pin designations during run-time.

    Regards,
    Ryan

  • Hello,Ryan

    I use uart2callback_LP_EM_CC2340R5_freertos_ticlang and basic_ble_LP_EM_CC2340R5_freertos_ticlang , only JUMP_TO_APPLICATION is added in uart2callback_LP_EM_CC2340R5_freertos_ticlang , then call it in MainThread

    I want to make a bootloader and use UART to update the code of basic_ble_LP, and then my idea is to use ARM Assembly's BX to jump to basic_ble_LP starting ADDRESS

    1.If I want to use ARM Assembly to jump to the basic_ble_LP project and run it successfully, is there a way to do it?

    2.Which part of the MCUboot code is responsible for receiving update data? Which part is used to jump to basic_ble_off_chip ?

    3.How can I switch ? have any example code?

    4.I find this function HapiEnterApplication(),that It seems that it can be used to jump to the address of another project, but I didnt know how to set ?

  • I don't have evidence that you've made the correct changes to the uart2callback and basic_ble project's source files to operate them consecutively on a CC2340R5 device.  Based on your bootloader goal I once again must recommend that you consider mcuboot and basic_ble_off_chip instead.

    1. Yes as evident in mcuboot's API start_app.  Here is the MCUBoot README for additional details.

    2. The default mcuboot does not perform data updates as it is provided for RF stacks which perform OAD updates.  There is a layer provided for communicating with the external flash memory through SPI, which can store candidate images to be loaded for the CC2340R5.

    3. Resources for doing this have been shared above.  

    4. There is no clear usage of HapiEnterApplication in the SDK.

    Regards,
    Ryan

  • 1.OK , so I use the start_app function ,then can be jump address can be implemented so that CC2340 can execute the main application. Is my understanding correct?

    2.I find sample code of mcuboot in SDK , but I didn't modify any code , then I try to build this project , It display Error . Why ?

    3.I find HapiEnterApplication() in "hapi.h" , It has a description of this API ? But it still proves that it cannot be used?

  • 1. That is the correct understanding in the context of the mcuboot project, which has the correct setup to work alongside an application image.  You would still need to load both programs consecutively as demonstrated in the previously provided SimpleLink Academy Labs.

    2. Try updating to SDK v7.40 and be sure to use CCS v12.5+ as stated in the SDK Release Notes, otherwise I have no suggestions without further context.

    3. I don't see the API actually being referenced in the SDK.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // void BootEnterApplication(void)
    /*****************************************************************************
    * \brief Called from bootloader to transfer into application
    * When called from a bootloader this function will apply application security
    * restrictions and transfer to application (set up VTOR register, setup SP and
    * jump to entry point as defined by application vector table in CCFG). The
    * function will never return.
    *
    * When called from an application the function will return without doing
    * anything.
    *****************************************************************************/
    #define HapiEnterApplication() HAPI_TABLE_POINTER->enterApplication()
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards,
    Ryan

  • But if I use the two projects MCUboot and BLE_offchip, how do I decide the address of BLE_offchip? uniFlash can only use HEX files to set the starting address, but the bin file generated according to the method above E2E is very large.

  • MCUboot defines BOOT_PRIMARY_1_BASE_ADDRESS as 0x6000 in flash_map_backend.h, where the BLE_offchip project likewise defines its PERSISTENT_HDR_BASE.  The application binary image should explicitly be loaded to address 0x6000 using Uniflash or similar.  Here is the Internal Flash Memory Layout and I once again recommend that you follow the BLE5-Stack SLAs.

    Regards,
    Ryan

  • Okay, then I have another question. You said that the start_app API can jump to the Vector Table of the Main Application, and the content of this API is

    Fullscreen
    1
    2
    __asm__ volatile("MSR msp %0" : : "r" (vector_table[0]);
    (void(void*(*vector_table+1)))
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    This code uses the ARM Assembly method and then resets the SP register to let the PC start execution from the value of address vector_table+1, right?

    Assuming that I use the uartcallback project, copy the start_app API method and set the vector_table, I should be able to jump successfully. Is my understanding correct?

  • My recommendation is that you use MCUBoot and add UART functionality to this project accordingly.  Adding these instructions without having the correct environment setup may have unintended affects on your build behavior/observations. 

    Regards,
    Ryan