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

sd_ble_enable causing hang if application is jumped to from bootloader

I am using sd 7.0.0, I have a simple bootloader implementation that follows the bootloader sample code pretty closely. When I jump to my application from the bootloader and call sd_ble_enable, it hangs inside the SVC_handler. If I load my application without the bootloader, it runs fine. I do not enable sd inside my bootloader anywhere. I also know that main() inside the application is being reached. Here is my code that handles setting up the vector table address and jumping to the application.

void StartApplication(void)
{
    interrupts_disable();   
    
    sd_mbr_command_t com = {SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET, CODE_START};
    sd_mbr_command(&com);
    
    JumpToApplication(CODE_START);
}

void JumpToApplication(uint32_t start_addr)
{
    __asm volatile("LDR   R2, [R0]\t\n"
          "MSR   MSP, R2\t\n"
          "LDR   R3, [R0, #0x00000004]\t\n"
          "BX    R3\t\n"
          ".ALIGN\t\n");
}

I have no idea what I am doing wrong. Any help would be greatly appreciated.

Parents
  • I have not yet done the upgrade to use the SD 7.0.0 so I am not very familiar with the MBR stuff yet. However, after perusing the documentation a bit one line from the details section on the sd_mbr_command_vector_table_base_set_t caught my eye:

    "Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset."
    

    So perhaps a reset is required rather than jumping to the application?

Reply
  • I have not yet done the upgrade to use the SD 7.0.0 so I am not very familiar with the MBR stuff yet. However, after perusing the documentation a bit one line from the details section on the sd_mbr_command_vector_table_base_set_t caught my eye:

    "Once this function has been called, this address is where the MBR will start to forward interrupts to after a reset."
    

    So perhaps a reset is required rather than jumping to the application?

Children
Related