Skip to content

[feature] OTP Read/Write #1352

@mirkomatonti

Description

@mirkomatonti
  • I made serious effort to avoid creating duplicate or nearly similar issue
  • Programmer/board type: [STLINK V2]
  • Operating system an version: [Linux]
  • stlink tools version and/or git commit hash: [ v1.7.0]
  • stlink commandline tool name: [st-flash]
  • Target chip (and board, if applicable): [STM32L4*]

Hello,

I need to read and write the otp area for a project of mine. I noticed that this feature has not being implemented yet so I did a quick implementation and it works. I know that OTP area is not standard across the STM32 line so how would that work in case I want to do a PR?
Can I just add support to L4x? (which is pretty easy as the OTP area is treated as FLASH) or do I need to do an implementation for all the supported boards?

My implementation is something along the line:

--area=otp read <output.bin> <len> //Read from the OTP start address to len
--area=otp write <input.bin> <add> //Write from a specific OTP address

To keep compatibility with the other boards I basically added two new fields (otp_base and otp_size) to the .chips file which in case they are not set the OTP read/write request returns a Not Implemented error. I suppose this will be helpful in case someone in the future wants to extend support to other boards.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions