Mbed Bootloader stuck in loop


I am trying to create a program for an STM32F407ZG that has a bootloader. I have the bootloader bin compiled and size restricted as it should be, matching a flash sector address. The bootloader successfully calls mbed_start_application(POST_APPLICATION_ADDR) (which is at 0x08010000), then proceeds to do nothing. Using the STM32 ST-LINK Utility, I can see it is stuck in a loop between the bootloader and the main application from what I can tell. I objdumped the dumped the ELF files:


#if defined (__GNUC__) || defined (__ICCARM__)

void start_new_application(void *sp, void *pc)
    __asm volatile(
 8001d4e:	e9d4 3100 	ldrd	r3, r1, [r4]
 8001d52:	2200      	movs	r2, #0
 8001d54:	f382 8814 	msr	CONTROL, r2
 8001d58:	469d      	mov	sp, r3
 8001d5a:	f382 8810 	msr	PRIMASK, r2
 8001d5e:	4708      	bx	r1


  ldr   sp, =_estack     /* set stack pointer */
 8010ef0:	3101      	adds	r1, #1
 8010ef2:	428a      	cmp	r2, r1

/* Copy the data segment initializers from flash to SRAM */  
  movs  r1, #0
 8010ef4:	d004      	beq.n	8010f00 <LoopCopyDataInit>
  b  LoopCopyDataInit
 8010ef6:	4770      	bx	lr

08010ef8 <CopyDataInit>:

Stepping through with the ST-LINK Utility and watching the program counter, it loops from 0x8001d4e to 0x8001d5e in the bootloader, jumps to 0x8010ef0 in the main application, runs to 0x8010ef6, then back to 0x8001d4e in the bootloader. Now I don’t really know what I’m doing here, or if any of this is useful to anyone, but I don’t know where to take it from here. Anyone have any suggestions as to why this is happening? This is being compiled with mbed-os 6.5.0 with GCC_ARM

Anyone have any ideas? I am holding off on an order of 1200 of this MCU until I can get an answer…