This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Modify bootloader address

Hi Sir,

As check below link, we know how to re-write the bootloader address.

https://devzone.nordicsemi.com/f/nordic-q-a/26300/how-to-use-nrfjprog-to-write-uicr-bootloaderaddr 

1. But could we re-write the bootloader address in Application layer?

2. If we program two application image in the flash (example,like one in 0x26000, another in 0x46000)

   Could we jump to difference application address from bootloader?

Thank you.

BRs, Han

  • Hi Edvin,

    1. we tried to assign the "start_addr" to 0x26000 (or 0x46000), but boot fail.

    2. Change the flash start address setting from Keil C (0x26000 -. 0x46000), but fail.

    3. Add  below code jump to 0x46000 in the main () function, but fail.

    4. The "bootloader settings page" is from IDE? or main() function of bootloader?

    ------------ 

    typedef  void ( *pFunction ) ( void );

    int main(void)

    {

        uint8_t op_mode = 0U;

        pFunction jump2app;

        uint32_t jump_addr;

           

        jump_addr = * ( __IO uint32_t * ) ( 0x46000UL + 4UL );

        jump2app = ( pFunction ) jump_addr;

        /* Initialize user application's Stack Pointer */

        __set_MSP ( * ( __IO uint32_t * ) ( 0x46000UL ) );

        jump2app();

    ....

    }

    -------------

    Thank you.

    BRs, Han

  • Hello Han,

    Does your implementation from your last reply work if you don't change the application start_addr to 0x46000?

  • Hi Edvin,

    1. From item 1, If we don't change the "start_addr" and keep the original code, it works ( start addr is 0x26000). (bootloader's main())

    2. From item 3, if we common the code as below, it works because it will go through the original part that start w/ 0x26000.

    ======

        //jump_addr = * ( __IO uint32_t * ) ( 0x46000UL + 4UL );

        //jump2app = ( pFunction ) jump_addr;

        /* Initialize user application's Stack Pointer */

        //__set_MSP ( * ( __IO uint32_t * ) ( 0x46000UL ) );

        //jump2app();

    ======

    Thank you,

    BRs, Han

  • I am not able to follow the logic from your main() function.

    If you try:

    typedef  void ( *pFunction ) ( void );
    
    int main(void)
    
    {
    
        uint8_t op_mode = 0U;
    
        pFunction jump2app;
    
        uint32_t jump_addr;
    
           
    
        jump_addr = * ( __IO uint32_t * ) ( 0x26000UL);
    
        jump2app = ( pFunction ) jump_addr;
    
        /* Initialize user application's Stack Pointer */
    
        __set_MSP ( * ( __IO uint32_t * ) ( 0x26000UL ) );
    
        jump2app();
    
    ....
    
    }

    What happens then? 

    Is it possible to send your project, so that I can try to understand how your implementation is working? Right now, I know only that it isn't working. Not what the part that isn't working looks like.

    BR,

    Edvin

  • Hi Edvin,

    Attached project use "\nrf5_SDK_for_Mesh_v2.1.1_src\examples\seria", the "main.c" only update code for 'jump to 0x46000', others are same as source code.

    Another project use "\nRF5_SDK_15.0.0_a53641a\examples\ble_peripheral\ble_app_uart\pca10040\s132\ses", only modify the start address from 0x26000 to 0x46000 in SES.

    Please let me know if needs more information.

    Thank you.

    BRs, Han

Related