2024-03-03 4:00 AM
I'm encountering difficulties modifying option bytes on an STM32H723VEH6 microcontroller using a custom C# bootloader. Although the bootloader successfully loads firmware onto the microcontroller, it fails to modify option bytes BOOT_CM7_ADD0 and BOOT_CM7_ADD1 despite following the correct sequence outlined in the reference manual.
If anyone has a code example demonstrating the correct implementation of modifying option bytes using a custom C# bootloader?
public void ModifyOptionBytes(uint bootCm7Add0, uint bootCm7Add1)
{
UnlockFlashCR();
UnlockFlashOPTCR();
// Write the desired new option byte values in the corresponding option registers
WriteOptionBytes(bootCm7Add0, bootCm7Add1);
// Set the option byte start change OPTSTART bit to 1 in the FLASH_OPTCR register
SetOptionByteStartChange();
}
Solved! Go to Solution.
2024-03-03 6:15 PM
Here is example of C# interface to a STM32 bootloader:
https://www.feaser.com/en/blog/2021/03/develop-your-own-firmware-update-tool-in-c-with-libopenblt/
AFAIK the CubeProgrammer API library is intended for C++ and you need to write a C# wrapper to call it from C#.
The API function for OB manipulation is sendOptionBytesCmd. The parameter is a string similar to the OB parameter for CubeProgrammer CLI.
The functions in your source snippet, WriteOptionBytes and SetOptionByteStartChange, are not the public APIs of the CubeProgrammer library.
2024-03-03 6:15 PM
Here is example of C# interface to a STM32 bootloader:
https://www.feaser.com/en/blog/2021/03/develop-your-own-firmware-update-tool-in-c-with-libopenblt/
AFAIK the CubeProgrammer API library is intended for C++ and you need to write a C# wrapper to call it from C#.
The API function for OB manipulation is sendOptionBytesCmd. The parameter is a string similar to the OB parameter for CubeProgrammer CLI.
The functions in your source snippet, WriteOptionBytes and SetOptionByteStartChange, are not the public APIs of the CubeProgrammer library.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.