I am writing a minimal bootloader for SAMD51 which for now just launches the application image.
Changed BOOTPROT to reserve 32 KB.
Flashed bootloader at 0x00000000
Flahed App image at 0x00008000
Used .text=0x8000 in Tool Chain ->Memory Settings ( Tried 0x4000 too as suggestied in a post)
Use below code come bootloader main function to jump to app image.
#define APPLICATION_SYSTEM_FLASH_START_ADDRESS 32768
__set_MSP(*(uint32_t *) APPLICATION_SYSTEM_FLASH_START_ADDRESS);
/* Rebase the vector table base address */
SCB->VTOR = ((uint32_t) APPLICATION_SYSTEM_FLASH_START_ADDRESS & SCB_VTOR_TBLOFF_Msk);
asm("bx %0" ::"r"(APPLICATION_SYSTEM_FLASH_START_ADDRESS + 4));
But it does not seem to do anything and results is reboot if WDT is enabled.
Could some one help understanding whats going wrong here ?