I am using the STM32F439 and looking to find a way to write code in the internal flash. Is there a protected area for quality assurance and security? It's supposed to be used for company's intellectual property.

I would also like to know if there's a way to rewrite the system memory, I presume that it is the most protected area and couldn't find a way to write the code on it.

  • 2
    \$\begingroup\$ By system memory, do you mean the internal factory bootloader? For your questions, which MCU documents you have read? The datasheet, reference manual and bootloader appnote? \$\endgroup\$ – Justme Apr 28 at 16:37
  • \$\begingroup\$ Usually code in the internal flash is re-written with a JTAG tool like the st-link V2 or V3. If you want to modify code that is already there then you'll need the equivalent knowledge of a few computer engineering courses. \$\endgroup\$ – Voltage Spike Apr 28 at 16:49
  • 1
    \$\begingroup\$ Your question is very unclear. Maybe you'll be interested in the Read Protection (RDP) feature described in the Reference Manual. \$\endgroup\$ – kkrambo Apr 28 at 19:50
  • 1
    \$\begingroup\$ "Im using the stm32f439 and looking to find a way to write code in the internal flash" This is utterly confusing. If you are "USING" it, than how you do it WITHOUT writing the code into internal flash? \$\endgroup\$ – Maple Apr 29 at 5:59
  • 1
    \$\begingroup\$ Are you looking to get the chip to reprogram its own flash (ie, perform an in field firmware update), or are you looking for how to program during development/manufacture? \$\endgroup\$ – Colin Apr 29 at 12:45

Assuming the goal is protect company intellectual property, STM32F7 and STM32F401re family of product offer distinct level of protection that might work.

Readout Protection (RDP)

  • Level 0: No readout protection
  • Level 1: memory readout protection
  • Level 2: chip read out protection

Proprietary code Read out Protection (PcROP)

  • PcROP is capable of preventing the CPU of executing malicious code

Write Protection (WRP)

  • Protecting the flash sector Read/Write/Erase Access

The attached reference documents have in-depth details of the features. The following slide from the attached document might be of interest.

Protect Confidentiality of Software

Readout Protection Configuration are done through options bytes. Review the content around option bytes.

Option Bytes

The FLASH_OPTCR register is used to modify the option bytes.

In the respective microcontroller datasheet look for information similar to the below. This should help zero in the content that is of interest.

enter image description here

The system memory (ROM) stores the native bootloader (STM32F401re) and is read only.



Not the answer you're looking for? Browse other questions tagged or ask your own question.