cancel
Showing results for 
Search instead for 
Did you mean: 

DFU files and setting option bytes using CubeProgrammer_API

unicyclebloke
Associate III

My project is using an STM32U575.

I have been studying the DfuSe file format and wondered if this can be used to change the values of option bytes. I can see that CubeProgrammer_API used strings such as "-ob nSWBOOT0=1" with sendOptionByteCmd(). If I were to include a target in a DfuSe file whose address is one of the option byte registers, would this successfully change the option bytes? That is to say, is the bootloader smart enough to handle writes to option bytes (presumably by spotting the target address)? In firmware, this is more complicated than writing to regular flash.

For context: 

We are performing firmware update over USB using the built-in ST bootloader. The update is initiated in the firmware by changing the nSWBOOT0 option bit and resetting, which runs the bootloader. So far, we have then used STM32CubeProgrammer to connect to the device and send the latest BIN image. After that, we use STM32CubeProgrammer to change the option bit again, and then reset to run the new firmware. This works well enough, but the client wants a custom tool integrated with a PC application (which we have also written).

I've looked at CubeProgrammer_API USB_Example.cpp and could certainly make that work. Unfortunately, the API comes as a DLL (no source code that I could find) with quite a lot of dependencies such as Qt6. This made me wonder about implementing a DFU update directly on top of WinUSB. This amounts to transferring a file which the bootloader on the STM32 decodes. 

  

0 REPLIES 0