Skip to main content
Associate II
February 24, 2026
Solved

option bytes programming

  • February 24, 2026
  • 1 reply
  • 155 views

Hi,

I want clarification on STM32 option byte programming.

When we write new values to FLASH_OPTR and other option registers:

Where are these FLASH option registers physically located?
Are they inside the FLASH peripheral (0x4002xxxx region) and not in the option byte Flash area (0x1FFF8000)?

When OPTSTRT is set, does the CPU erase/program the option byte pages, or does the FLASH controller hardware automatically erase the option byte Flash area and program it using the values in the FLASH option registers?

I want to clearly understand the internal flow between:

Option byte Flash memory

FLASH option registers

FLASH controller hardware

Thank you.

Best answer by TDK

The FLASH registers (0x4002xxxx region) are an interface to the option bytes. The bytes themselves are stored in non-volatile memory (0x1FFF8000 region).

At startup, the FLASH registers are populated based on the non-volatile values.

> When OPTSTRT is set, does the CPU erase/program the option byte pages, or does the FLASH controller hardware automatically erase the option byte Flash area and program it using the values in the FLASH option registers?

The chip erases and then programs the non-volatile memory only when OPTSTRT is set. If you don't set this, the option bytes are not changed. Nothing is done automatically.

1 reply

TDK
TDKBest answer
Super User
February 24, 2026

The FLASH registers (0x4002xxxx region) are an interface to the option bytes. The bytes themselves are stored in non-volatile memory (0x1FFF8000 region).

At startup, the FLASH registers are populated based on the non-volatile values.

> When OPTSTRT is set, does the CPU erase/program the option byte pages, or does the FLASH controller hardware automatically erase the option byte Flash area and program it using the values in the FLASH option registers?

The chip erases and then programs the non-volatile memory only when OPTSTRT is set. If you don't set this, the option bytes are not changed. Nothing is done automatically.

"If you feel a post has answered your question, please click ""Accept as Solution""."