AnsweredAssumed Answered

STM32F070CBT6 jump to System Memory DFU

Question asked by Frank.Alexander on Dec 8, 2016
Latest reply on Jan 16, 2017 by Frank.Alexander

I'm trying to jump from an application to the DFU System Memory Bootloader.

According to AN2606 this should work with my processor and the System Memory should start at address 0x1FFFC800.

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 here some code how this should work.

In my CDC_Receive_FS function I'm preparing the jump to the bootloader by setting a value 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 0x1fffe6c4

 

Any suggestions?

 

Thanks

 

Outcomes