Hi, i use the stm32f405rgt6 and like to jump to the system memory 0x1fff0000. It never stays at DFU stm32_bootloader, it always starts application again.
I tryed two methodes, one just jumping to that address 0x1fff0000 via function pointer and second writing some magic numbers at 0x2001fffc and placing some asm code in the startup *.s file to jump branch to the system bootloader. I had to change controller typ recently. Before that i had the stm32f105 worked perfectly.
Here parts of my code
*.s file
/* Call the clock system intitialization function.*/
bl SystemInit
/* check for a magic number in RAM, if present */
/* branch to bootloader */
LDR R0, =0x2001fff8
LDR R1, =0x12345678
LDR R2, [R0, #0]
STR R0, [R0, #0]
CMP R2, R1
BEQ Bootloader
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl main
bx lr
.size Reset_Handler, .-Reset_Handler
/* Start systemmemory bootloader */
Bootloader:
LDR R0, =0x1fff0000
LDR SP, [R0, #0]
LDR R0, [R0, #4]
BX R0
it does not stay in bootloader and in windows device manager could not see the device as an dfu bootloader device.
rest of code
void JumptoSysMem()
{
volatile uint32_t addr = boot_addr;
USB_OTG_GlobalTypeDef *USBx = hpcd_USB_OTG_FS.Instance;
//Enumeration_USB();
USB_DevDisconnect(USBx);
HAL_Delay(1000);
HAL_RCC_DeInit();
HAL_DeInit();
SysTick->CTRL = 0;
SysTick->VAL = 0;
SysTick->LOAD = 0;
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
__set_MSP(*(uint32_t *)addr);
#if 0
SysMemBootJump = (void (*) (void)) (*((uint32_t *)(addr + 4)));
SysMemBootJump();
#else
//place magic at flash address 0x2001fffc
volatile uint32_t * magic_number_addr = (uint32_t *)0x2001fff8;
*magic_number_addr = magic_number;
__NVIC_SystemReset();
#endif
while(1);
}
what am i doing wrong please give me some detailed information.
Thanks in advance