Skip to main content
JMill.1
Associate III
Jan 3, 2022 6:42 PM UTC
Question

SMT32H743 - How do I exit the bootloader using the GO command?

To enter the system bootloader, we call the following function:

void BootloadCommandHandler(void)

{

  // Set BOOT0 to boot to ROM bootloader

  HAL_SYSCFG_CM7BootAddConfig(SYSCFG_BOOT_ADDR0, 0x1FF00000);

  // Reset CPU

  NVIC_SystemReset();

}

This works just fine and we can bootload the new image. However, when I then jump to 0x0800000 with the GO command, it resets directly back into the bootloader since SYSCFG_BOOT_ADDR0 is still set to the new value of 0x1FF00000; I can confirm this by running the PC side bootloader again. It connects and downloads the new image, confirming that we are still in the bootloader. If I power cycle the board, everything goes back to normal and we are all set. However, we don't want to have to instruct the user to power cycle the device after a remote bootload. Is there any way out of this? Can I call some piece of code that will set SYSCFG_BOOT_ADDR0 back to 0x08000000 and then call another reset?

Thanks,

Jamie

This topic has been closed for replies.

7 replies

JMill.1
JMill.1Author
Associate III
Jan 3, 2022 6:48 PM UTC

I have also tried jumping directly to the bootloader based on many online examples, but this results in a Hard Fault every time. If I could get this to work, I wouldn't have to alter the ADDR0 register and I think the GO command would reset as expected:

  

volatile uint32_t addr = 0x1FF00000;

HAL_RCC_DeInit();

SysTick->CTRL = 0;

SysTick->LOAD = 0;

SysTick->VAL = 0;

__disable_irq();

__set_MSP(*(__IO uint32_t*)addr);

SysMemBootJump = (void (*)(void)) (*((uint32_t *) (addr + 4)));

SysMemBootJump();

MM..1
Super User
Jan 3, 2022 6:56 PM UTC

When your go to app command reset your mcu something is bad.

Second question is if you use SYSCFG_BOOT_ADDR0 and your app do reset, then ofcourse is started bootloader back. Here i see more ways, first your app after start write right SYSCFG_BOOT_ADDR0 or better you start bootloader other way, i use normal jump to system loader without NVIC Reset directly from app.

JMill.1
JMill.1Author
Associate III
Jan 3, 2022 7:08 PM UTC

Can you provide an example of jumping directly to the bootloader? I posted my code attempt at doing this above and it results in a Hard Fault every time.

MM..1
Super User
Jan 3, 2022 7:28 PM UTC

Every MCU have own start addr and you use bad

0693W00000HqRWLQA3.pngstart address is 0x1FF09800

TDK
Jan 3, 2022 7:28 PM UTC

> Can you provide an example of jumping directly to the bootloader? 

https://community.st.com/s/article/STM32H7-bootloader-jump-from-application

> I posted my code attempt at doing this above and it results in a Hard Fault every time.

So debug the hard fault. Find out what it's objecting to and go from there.

"If you feel a post has answered your question, please click ""Accept as Solution""."
JMill.1
JMill.1Author
Associate III
Jan 3, 2022 7:56 PM UTC

Thanks for the link. That worked to get my program to jump directly to the bootloader. But now I send the GO command and I'm still in the bootloader. I am trying to jump to 0x0801408c per the disassembly, but nothing happens. I confirmed that the GO command is being ACK'd.

0693W00000HqReFQAV.png 

EDIT - It seems like the debugger was messing with the operation somehow. When I program and disconnect before invoking the bootloader, then jump to this reset address, everything works fine. Thanks for the help!