STM32F070CBT6 jump to System Memory DFU
I'm trying to jump from an application to the DFU
System Memory Bootloader.
According toAN2606 this should work with my processor and the System Memory should start at address0x1FFFC800.
I'm using an external clock (HSE) with 16MHz.
I'm using CDC with CubeMX which is working as expected.
For testing I want to jump to the DFU Bootloader when receiving someting via CDC.
I found
http://stackoverflow.com/a/28288454
some code how this should work.In myCDC_Receive_FS function I'm preparing the jump to the bootloader by setting avalue in the RAM and checking this value in SystemInit function:
// 16k SRAM in address 0x2000 0000 - 0x2000 3FFF
*((unsigned long *)0x20003FF0) = 0xDEADBEEF;// Reset the processor
NVIC_SystemReset();I changed the SystemInit function
void (*SysMemBootJump)(void);
void SystemInit(void)
{ if ( *((unsigned long *)0x20003FF0) == 0xDEADBEEF ) { *((unsigned long *)0x20003FF0) = 0xCAFEFEED; // Reset our trigger __set_MSP(0x1FFFC800); //__set_MSP(0x20002250); SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1FFFC804)); // Point the PC to the System Memory reset vector (+4) SysMemBootJump(); while (1); }When I'm sending something via CDC with the PC I can see in the debugger the function
SysMemBootJump is called.
But after that Windows does not detect the DFU device.
In the dissassembly I can see this:
1fffe6c4: str r2, [r3, #0]
1fffe6c6: ldr r4, [r0, #0] 1fffe6c8: cmp r4, r1 1fffe6ca: beq.n 0x1fffe6c4Any suggestions?
Thanks
#dfu #system-memory