How to program Option Bytes on STM32G474RE with STMCUBE-IDE with Segger

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • How to program Option Bytes on STM32G474RE with STMCUBE-IDE with Segger

      Dear Support,

      how do i update the option bytes with STMStudio with Cube IDE?
      I'm using STM32G474RE MCU.

      The wiki mentions the following instructions:

      Segger Wiki wrote:

      STM32G4 option byte programming
      For STM32G4 devices, the option byte page(s) can be programmed via J-Flash.When programming the option bytes, the following conditions must be met:
      • Per bank: All option bytes must be written in one go. It is not possible to only write - for example - one word.
      • Reserved bits must be written with "1" otherwise writing the option bytes will not work as expected and the verify of the written area will fail.

      I could also work with JlinkExe.
      But the steps are not clear for me. E.g. Using JLink EXE. Is there some simple jlink script, which I can use to program the option bytes (i want to change the boot bits)

      Thank you so much for the help! I'm really lost!

    • Hi Michael,
      Programming the option bytes of the STM32G4 series is implemented in the J-Link DLL natively.

      You could link the option bytes data to the option bytes memory location (0x1FFF7800) in your IDE or in e.g. a .hex-file.
      When downloading the application J-Link takes care of unlocking and programming the option bytes.

      You can also use the J-Link Commander to change the option bytes/flash registers.
      It is possible to write 32-bit memory values directly with the J-Link Commander with the "w4" command.
      Please note:
      When using this method, you will have to take care of all necessary steps yourself, like e.g. unlocking the option bytes, etc.
      For more information about how to write the option bytes for the STM32G4 series, please refer to the device's Reference Manual.

      Does this answer your question?

      Best regards,
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system:

      Or you can contact us via e-mail.