Skip to main content
BGowd.3
Associate
Feb 15, 2019 12:42 PM UTC
Question

STM32l072 is not going to bootloader mode.

void JumpToBootloader(void) {
	void (*SysMemBootJump)(void);
 
	volatile uint32_t addr = 0x1FFF0000;
 
	HAL_RCC_DeInit();
 	
 HAL_DeInit(); 
 
 SysTick->CTRL = 0;
	SysTick->LOAD = 0;
	SysTick->VAL = 0;
 
	__disable_irq();
	
	
	__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();	
	
	SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
	
	__set_MSP(*(uint32_t *)addr);
	
	SysMemBootJump();
	
}

I am using STM32l072( B-L072Z-LRWAN1 Discovery kit).Trying to jump to Bootloader using above code .I am trying to flash code using usb to ttl board to port UART2(LPUART1) with Demonstrator GUI tool. After calling above function ,Demonstrator GUI tools is not able to connect to board.

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
Feb 15, 2019 1:29 PM UTC

The interrupt being disable probably isn't helpful in this context, and the SYSCFG clock needs to be enabled for the remap to occur.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
BGowd.3
BGowd.3Author
Associate
Feb 15, 2019 1:59 PM UTC
void JumpToBootloader(void) {
	void (*SysMemBootJump)(void);
 
	volatile uint32_t addr = 0x1FFF0000;
 
	HAL_RCC_DeInit();
 	
 HAL_DeInit(); 
 
 SysTick->CTRL = 0;
	SysTick->LOAD = 0;
	SysTick->VAL = 0;
 
	//__disable_irq();
	
	HAL_RCC_SYSCFG_CLK_ENABLE();
	__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();	
	
	SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
	
	__set_MSP(*(uint32_t *)addr);
	
	SysMemBootJump();
	
}

Not working even the above changes are made (commenting disable irq line and enabling SYSCFG clock ) .

Tesla DeLorean
Guru
Feb 15, 2019 2:05 PM UTC

Are you sure the system loader in the L0 permits this type of operation?

Have you stepped the code into the loader and checked to see if that is behaving normally?

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
BGowd.3
BGowd.3Author
Associate
Feb 21, 2019 6:24 AM UTC

Yes i have checked it .It is mentioned that direct jump to system memory is possible .