pyocd / pyOCD

Open source Python library for programming and debugging Arm Cortex-M microcontrollers
https://pyocd.io
Apache License 2.0
1.11k stars 477 forks source link

What is needed for STM32F4xx OTP support? #761

Open anthrax-0 opened 4 years ago

anthrax-0 commented 4 years ago

Hi, It seems that builtin targets for stm32f4xx do not have support for OTP area and that .FLM for it is present in the Keil pack and is the same for all of them. Is it enough to just add additional FLASH_ALGO to the target and use it in the corresponding FlashRegion or there are some other changes required?

flit commented 4 years ago

Yes, that should be all that is required. Just generate the flash algo blob as described in adding_new_targets.md, insert the generated FLASH_ALGO dict, and add an appropriate FlashRegion to the target's memory map.

You might want to add a custom flash class with an override_security_bits() method, like pyocd.target.family.flash_kinetis.Flash_Kinetis, that prevents accidental locking of the device.

If you need any other help, I'll be happy to answer questions!