2
\$\begingroup\$

I am creating a custom board and using STM32F303 chip. I have looked into the datasheet and there are 3 boot modes and according to the datasheet the bootloader resides in the ROM memory.

I got confused on few things like what the three boot modes do? Because in other microcontrollers we have one boot sequence in which the microcontroller fetches the reset handlers address and start executing the startup code and according to the STM32 datasheet using the boot pins we can decide among flash, system memory and SRAM boot.

If I select system memory or SRAM boot does that mean the STM32 has separate reset handlers for these modes or what's their use then?

And secondly, if I decide to boot from flash memory (the chip contains no firmware, only the ROM bootloader is in the chip) then will the bootloader invoke like in other MCUs, that it first looks for the firmware on the serial peripheral and then the MCU fetches the reset handler address here, because I didn't select the system boot mode where bootloader is present?

If yes then for a new chip with no firmware or in every reset I have to first select the system boot mode to invoke the bootloader then I have to select the flash boot mode in STM32?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The boot mode determines which memory address is mapped in the boot memory space (0x00000000):

  • Main Flash memory: 0x08000000
  • System memory: 0x1FFFD800
  • Embedded SRAM: 0x2000000

Source: RM0316, chapter 3.5


Some STM32 devices have an 'Empty Flash Check' mechanism: The STM32 will invoke the boot loader from system memory whenever the BOOT pins are configured for Main Flash memory, but the main flash is empty (virgin device).

Unfortunately your device (STM32 F3) doesn't support this feature. As such you'll have to jumper the BOOT pins appropriately in order to utilize the boot loader from system memory.

Source:

\$\endgroup\$
5
  • \$\begingroup\$ Thanks for the formatting and if my device doesn't support this feature then does it means that the bootloader will not invoke itself whenever stm32 powers up and not going to check for the firmware instead directly jump into reset handler ? \$\endgroup\$
    – Ahsan
    Commented Aug 7, 2023 at 10:12
  • \$\begingroup\$ @Ahsan Yes, it will attempt to boot the firmware, which isn't available. \$\endgroup\$
    – Velvet
    Commented Aug 7, 2023 at 10:21
  • \$\begingroup\$ so the pattern is every time i have to first use the system boot mode (doesnt matter if the firmware is available or not) then the bootloader is invoked and will load the firmware into flash memory then i have to reset it and select the flash memory mode and in this mode bootloader will not check the serial interface unlike other bootloaders and mcu will directly load the reset handlers address and start executing. did i get it right ? \$\endgroup\$
    – Ahsan
    Commented Aug 7, 2023 at 11:01
  • \$\begingroup\$ @Ahsan Yes, that's right. I would use a jumper or a pushbutton for the initial programming. \$\endgroup\$
    – Velvet
    Commented Aug 7, 2023 at 12:20
  • \$\begingroup\$ Thank you very much for all the help. \$\endgroup\$
    – Ahsan
    Commented Aug 8, 2023 at 2:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.