-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I'm working on a project using the STM32F779. We want to be able to use a bootloader to switch between flash banks bank_1 and bank_2.
I can use the latest st-flash code to write the opt_cr option bytes to set NDBANK and NDBOOT to 0. This places the device in dual-bank mode and dual-boot mode.
st-flash --area=optcr write 0x0fffaafc
Setting option_boot_add can then cause the bootloader to select code in either bank_0 (0x200) or bank_1 (0x2040).
st-flash --reset --area=option_boot_add write 0x20002000
I can't see a way to flash the part when it is in dual-bank mode. The sector erase mapping depends on the mode - the state of both of these option bits.
I've written some code to allow flashing in dual-bank mode, in a fork here, https://github.com/DaveBerkeley/stlink on branch f7-dual-bank-flash. This gets me going for my project (it can only flash bank_1, not bank_2).
st-flash --dual-bank --reset write firmware.bin 0x08000000
Am I missing something, or is this functionality missing? I'd like to contribute my changes if they are useful, but I don't know if the changes would fit in well with the existing project.
See also Application note AN4826 "STM32F7 Series Flash memory dual bank mode"