RT74765. twr-k60n512: implement `envm_write()` for the `cptf` command
Write the necessary data into flash by flash sectors (2 Kbytes). Use the "Program Section" command to write a complete flash sector. If only a part of the sector should be updated, firstly load the existing data that should not be changed into the write buffer (flash programming acceleration RAM), and then write from this buffer into the flash sector. This technique makes it possible to update even single bytes without damaging other data in the same flash sector. Before writing at the flash address 0x40C, a check is performed to make sure the MCU will not switch to the secure state. All functions that may be called from `envm_write()` are put into the `.ramcode` section, because the internal flash is not a safe place when self-upgrade is in progress. Like in the FNET project, we disable Single Entry Buffer and Data Cache via FMC registers. This must be a workaround for an errata.
Showing with 371 additions and 11 deletions