0
\$\begingroup\$

As I understand the datasheets boot0 pin and boot1 bit (in a register) control how the CPU boots up, which are Main Flash memory, System memory and Embedded SRAM. I honestly don't know the differences in functionality of these memory sections, nor do I want to care right now (feel free to tell me why I should).

My use-case requires programming it through SWD as needed (so not a one-time deal) and boot from it.

I'm not interested in various flash configurations or having bootloaders to program the chip over other protocols. I'm not going to mass-produce this.

Would pulling boot0 pin low through a resistor and simply connecting the SWD connector allow me to do this?

\$\endgroup\$
1
  • \$\begingroup\$ FYI For my part STM32F030cc the truth table in the datasheet seems wrong. I wanted to do the same as you but it kept jumping to the system ROM bootloader instead of main flash until I zero'd the BOOT1 bit even though the datasheet stated BOOT1 is 'x' (dont care) when BOOT0 is grounded. \$\endgroup\$ Jul 13, 2021 at 13:40

1 Answer 1

3
\$\begingroup\$

SWD should work on an unlocked part regardless of the state of the boot0 pin, unless one state triggers the operation of code (or corrupt flash contents misinterpreted as code) which either re-purposes the SWD pins, or puts the chip into a suspend mode with SWD inactive.

Typically if your code does either of these things, it's best to have it not do them until several seconds after reset, so that you can use even a manually triggered reset and immediate SWD connection to get back in. There are however ways to get the initial part of the SWD connection process to happen while the CPU is held in reset, and thus get in before software can disable the SWD.

A sometimes used shortcut however is to temporarily drive boot0 high which (when the chip is unlocked) causes booting from either the bootloader or the SRAM, with the idea that doing so will prevent the "problem" code in flash from running, and make it easier to get an SWD connection going.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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