2024-09-22 02:06 PM
Motivation: Release a product (STM32F072RBT) with no buttons or toggles on the PCB and allow customers to flash and interact with their product over USB serial interface.
Requirement: Keep BOOT0 held high so the STM32 is in DFU mode upon initial connection to computer. The computer software can either flash or leave immediately to 0x08000000 running the flash program.
Issue: The DFU leave command does not work while BOOT0 is held high.
Potential Solutions: Users have solved this issue on STMF4 products due to it having a Cortex-M3/M4 https://community.st.com/t5/stm32-mcus-embedded-software/leave-dfu-while-boot0-is-high-stm32f4/td-p/556307
Uncommenting this line could potentially solve this on those products as well.
#define USER_VECT_TAB_ADDRESS
However I haven't found resources with a step by step solution for Cortex-M0 (STM32F072RBT)
Solved! Go to Solution.
2024-09-22 03:30 PM
There is no vector-table-remap register (SCB_VTOR) on Cortex-M0, and the vector table is always assumed to be at address 0x0000'0000, where the System memory is remapped when reset with BOOT0 high. So before enabling any interrupt in the user program, you have to remap FLASH to address 0x0000'0000 through SYSCFG_CFGR1.MEM_MODE (or remap RAM and copy vector table at the beginning of RAM, in the same register-field).
I am not sure if leaving BOOT0 has no other side effects other than the System Memory being remapped at 0x0000'0000 at reset.
JW
2024-09-22 03:30 PM
There is no vector-table-remap register (SCB_VTOR) on Cortex-M0, and the vector table is always assumed to be at address 0x0000'0000, where the System memory is remapped when reset with BOOT0 high. So before enabling any interrupt in the user program, you have to remap FLASH to address 0x0000'0000 through SYSCFG_CFGR1.MEM_MODE (or remap RAM and copy vector table at the beginning of RAM, in the same register-field).
I am not sure if leaving BOOT0 has no other side effects other than the System Memory being remapped at 0x0000'0000 at reset.
JW
2024-09-22 04:01 PM
This works! Placing this in "system_stm32f0xx.c"
void SystemInit(void) {
SYSCFG->CFGR1 &= ~(0x1 << 5);
}
I had tried this prior however something in my app code was causing this to fail. This totally works from a blank project. You're a life-saver!