Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

NRF52840 Application boots from different flash address

Hi,

   In my project i need to include two different applications(one without soft device and and one with soft device) and a bootloader(secure ble) with nRF 5 SDK 17.1.0.

   Application1 START ADDRESS : 0x27000.

   Application2 START ADDRESS : 0xD8000.

   Bootloader  START ADDRESS : 0xF3000.

   Softdevice  START ADDRESS : 0x1000.

   1.I need to switch between application1 or application 2 from boootloader.How can we do this?.

   2.Is it possible to switch from app1 to app2 or vice versa?.

   we followed this link but it didn't helped. https://devzone.nordicsemi.com/f/nordic-q-a/85074/how-to-change-the-mbr-jump-address-location?pifragment-684=2 

  •  else
        {
            NRF_POWER->TASKS_CONSTLAT = 0;
    
            // Erase additional data like peer data or advertisement name
            ret_val = nrf_dfu_settings_additional_erase();
            if (ret_val != NRF_SUCCESS)
            {
                return NRF_ERROR_INTERNAL;
            }
    
            m_flash_write_done = false;
            nrf_dfu_settings_backup(flash_write_callback);
            ASSERT(m_flash_write_done);
    
            //uint32_t appSwitchCheck = nrf_power_gpregret_get();
            if((nrf_power_gpregret_get() & SWITCH_APPLICATION2)==SWITCH_APPLICATION2){
              NRF_LOG_DEBUG("APP 2 0xD8000.");
              start_app_without_sd(0xD8000);
            }else{
              NRF_LOG_DEBUG("APP 1 0x27000.");
              start_app_with_sd(0x27000);
            }
            //nrf_bootloader_app_start();
            NRF_LOG_ERROR("Unreachable");
        }
        
        void start_app_with_sd(uint32_t startAddress)
    {
        nrf_dfu_mbr_init_sd();
    
        // Disable and clear interrupts
        NVIC->ICER[0] = 0xFFFFFFFF;
        NVIC->ICPR[0] = 0xFFFFFFFF;
        NVIC->ICER[1] = 0xFFFFFFFF;
        NVIC->ICPR[1] = 0xFFFFFFFF;
    
        sd_softdevice_vector_table_base_set(startAddress);
        nrf_dfu_mbr_irq_forward_address_set(MBR_SIZE);
        nrf_bootloader_app_start_final(startAddress);
    }
    
    void start_app_without_sd(uint32_t startAddress)
    {
        NVIC->ICER[0] = 0xFFFFFFFF;
        NVIC->ICPR[0] = 0xFFFFFFFF;
        NVIC->ICER[1] = 0xFFFFFFFF;
        NVIC->ICPR[1] = 0xFFFFFFFF;
    
        nrf_dfu_mbr_irq_forward_address_set(startAddress);
        nrf_bootloader_app_start_final(startAddress);
    }
        
        
        
        

  • Hi Akshay, 


    Attached is an example I made a while ago. 
    It's made for nRF52832 but the principle should be the same. 

    The bootloader will always jump to the application at address 0x20000. And the RTC example is moved to start at address 0x20000. 

    Please pay attention to the modification in the source files and to the flash_placement.xml. 

    rtc_moved.zip

    secure_bootloader_jumptoapp.zip

    I don't think it's much different from what you are doing now. But maybe you can compare the code and findout what's missing. 

Related