0

In my project, I am using an STM32F072C8T7 MCU. In this MCU, there is just one boot pin named as BOOT0. According to the application note, I have to configure the BOOT0 -> GND to choose the main flash as the boot space.

I have done that and the program seems to be working. What I am wondering is that, when I want to upgrade the firmware of my device later in the future, do I need to make any changes to the BOOT0 pin?

enter image description here

adnan
  • 103
  • 3

1 Answers1

0

What I am wondering is that, when I want to upgrade the firmware of my device later in the future, do I need to make any changes to the BOOT0 pin?

If you want to use the factory ROM bootloader to write a new firmware, then yes, for most STM32 parts you would need to take the BOOT0 pin high and then reset the processor. (In some cases it is possible to have your existing program jump into the factory boot ROM as if the pin had been in the other state than it actually is, but that can be a bit tricky to figure out and may require reverse engineering the start of the boot ROM)

However there are a few other common ways to change the program on an STM32 processor which do not go through the factory bootloader and thus do not point to changing the state of the boot pin. Chief among them:

  1. You can use the SWD interface to write to flash. This is common in development (you can also do breakpoint debugging that way) but less common once a product gets into customer's hands.

  2. You can have the running program accept an updated program. Some parts have dual flash banks where you can select a bit to boot one or the other. Or you may be able to write a small routine near the start of flash which selects between two images. Sometimes you need to first load a miniature firmware that is small enough to leave room to then load a new full firmware. This type of a approach is very common in products having radio connectivity where it is often termed an OTA (Over The Air) upgrade. Wired interfaces performing this would often be considered to be custom bootloaders (vs. the factory ROM bootloader) - for example some early parts with USB interfaces didn't have that supported via the factory bootloader, so if you wanted to do an upgrade over USB you had to write your own.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Thank you for the detailed answers. In my current configuration, I have the boot0 pin tied to the ground and the program is stored in the user flash memory. Since I have a bluetooth module connected to the STM, I can issue an OTA firmware update using the method mention in part 2 of your answers? Also, I leave the boot0 pin tied to the ground during this process as well? – adnan Dec 16 '19 at 04:45
  • When you are using your own on-chip software rather than the factory bootloader to write to flash you would indeed leave the boot pin set to start from flash. Realize however that implementing a firmware upgrade scheme is a bit more challenging than writing an ordinary firmware, in ways far beyond what can be covered here. – Chris Stratton Dec 16 '19 at 05:04