entering and leaving dfu

This commit is contained in:
Conor Patrick 2018-10-28 20:39:56 -04:00
parent 5993aa792a
commit 32f0d2675e
2 changed files with 7 additions and 5 deletions

View File

@ -73,9 +73,9 @@ clean:
flash: $(TARGET).hex flash: $(TARGET).hex
STM32_Programmer_CLI -c port=SWD -halt -e all --readunprotect STM32_Programmer_CLI -c port=SWD -halt -e all --readunprotect
STM32_Programmer_CLI -c port=SWD -halt -d $(TARGET).hex -rst STM32_Programmer_CLI -c port=SWD -halt -d $(TARGET).hex -rst
STM32_Programmer_CLI -c port=SWD -rst
sleep 0.5 detach:
python dfuse-tool/dfuse-tool.py --leave STM32_Programmer_CLI -c port=usb1 -ob nBOOT0=1
cbor: cbor:
cd ../../tinycbor/ && make clean cd ../../tinycbor/ && make clean

View File

@ -25,10 +25,12 @@ void flash_option_bytes_init(int boot_from_dfu)
#else #else
uint32_t val = 0xfffff8b9; uint32_t val = 0xfffff8b9;
#endif #endif
if (!boot_from_dfu)
if (boot_from_dfu)
{ {
val &= ~(1<<26); // nSWBOOT0 = 0 (boot from nBoot0) val &= ~(1<<27); // nBOOT0 = 0 (boot from system rom)
} }
val &= ~(1<<26); // nSWBOOT0 = 0 (boot from nBoot0)
val &= ~(1<<25); // SRAM2_RST = 1 (erase sram on reset) val &= ~(1<<25); // SRAM2_RST = 1 (erase sram on reset)
val &= ~(1<<24); // SRAM2_PE = 1 (parity check en) val &= ~(1<<24); // SRAM2_PE = 1 (parity check en)