Author Topic: Rewriting Code in Internal Flash of stm32f439  (Read 637 times)

0 Members and 1 Guest are viewing this topic.

Offline lordsant333Topic starter

  • Newbie
  • Posts: 1
  • Country: it
Rewriting Code in Internal Flash of stm32f439
« on: April 28, 2021, 03:53:17 pm »
Hi all,

Im 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.

I would really appreciate any help,

Thanks!
 

Offline ajb

  • Super Contributor
  • ***
  • Posts: 2608
  • Country: us
Re: Rewriting Code in Internal Flash of stm32f439
« Reply #1 on: April 28, 2021, 04:28:58 pm »
What exactly are you trying to store in flash?  Application updates? Configuration data? Security keys?

It's definitely possible to rewrite the program flash memory, bootloaders do that to update the system software all the time.  It is not possible (at least as far as anyone outside of ST knows, probably) to rewrite any of system flash where the factory bootloaders are stored. 

All of the flash available for you to write is basically the same.  No part of it is more or less secure than any other part.  You can use the security features of the MCU (lock bits) to prevent others from reading out the memory, but if someone wants to copy your software bad enough these features can eventually be defeated.

You can also use part of the internal flash memory for storing configuration, including device keys, in place of EEPROM or something.  You would need to make sure that you don't accidentally overwrite that part of memory when doing a software update, and parts with lots of flash usually have large pages that make this not very efficient, but it can be done.  If you need secure storage, then an external specialty security IC may be a better option.  If you need configuration storage, an external EEPROM or FRAM might be better.
 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Rewriting Code in Internal Flash of stm32f439
« Reply #2 on: April 28, 2021, 09:42:04 pm »
It is not possible (at least as far as anyone outside of ST knows, probably) to rewrite any of system flash where the factory bootloaders are stored. 

Totally agree with your advice. I reserve a 2kb sector of the STM32F103C8 flash in one of my Forth cores and while I can write to any location in it, to write a second time to the same location is only possible after that whole sector is erased.

Regarding the factory bootloader code area, wouldn't it make sense to have it in rom and not flash which I believe is smaller and won't ever lose that code ?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf