cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L072CZ - Jumping in DFU bootloader via software

andre239955_stm1_stmicro
Associate III

Hello

I'm migrating my STM32F072 project to the STM32L072.

In my original project (F072) I can jump to the DFU bootloader by software via a function located before SystemInit.

I tried to convert this to be used by L072 by changing the address of bootloader program to 0x1ff00004 it's not working.

Is it due to the dual memory bank? Is there a way to get it working?

Thank-you

André

11 REPLIES 11
Uwe Bonnes
Principal III

I.m.h.o., best way to do so is to set some marker in on-chip ram, trigger reset and early in startup code test for that pattern in RAM and if found, reset it. set up VTOR etc for system bootloader and jump to system bootloader.

TDK
Guru

This thread claims the BOOT0 pin is sampled in the bootloader, but I'm a bit skeptical. The other comments should help you:

https://community.arm.com/developer/tools-software/tools/f/keil-forum/41955/stm32l072-jumping-to-embedded-bootloader-from-application-code

If you feel a post has answered your question, please click "Accept as Solution".
void (*SysMemBootJump)(void);
 
#define SRAM_ADDRESS_DFU			(unsigned long *)0x20004FF0	// *((unsigned long *)0x20004FF0) 20kRam
 
void SystemInit (void)
{
		  if ( *((unsigned long *)SRAM_ADDRESS_DFU) == 0xDEADBEEF ) {
	       *((unsigned long *)SRAM_ADDRESS_DFU) =  0xCAFEFEED; // Reset our trigger
	      __set_MSP(0x20002250);
	                                                     // 0x1ff0 0000 is "System Memory" start address for STM32 L0xx
	      SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1ff00004)); // Point the PC to the System Memory reset vector (+4)
	      SysMemBootJump();
	      while (1);
	  }
....

Hi,

It's exactly what I do, working perfectly with F072, not working with L072

Uwe Bonnes
Principal III

You have to set  SYSCFG->CFGR1 so that system rom gets mapped at address 0 before the jump

Hi thank-you for feedback,

I added

	      SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1ff00004)); // Point the PC to the System Memory reset vector (+4)
	      SYSCFG->CFGR1 |= 0x01 ;
	      SysMemBootJump();

Maybe I didn't correctly understand you, but the system reset immediately and didn't jump in the DFU mode

Uwe Bonnes
Principal III

STM32L0 also has VTOR, so you may need to set it too.

Not better :(

Uwe Bonnes
Principal III

Then single step in the debugger and find out where and why things go wrong.

ulysse
Associate

Hi, I'm facing the same issue on my L072.

Have you finally succeeded to get into DFU ? If so, can you tell me how ?