Hi Jorge, thanks for sending me the document.
I went through that document. [As a reference my chip is MK10DN512Z VLL10].
But before discussing the document, I have a leftover question:
1- There are two lcf files I found in the project:
one is at "project root"->"project headers"->project settings->linker files
and the other is in "project root"->project settings->linker files
do i need to edit both?
2- Now back to the document: When I get into debug mode, for FTFL device, I see registers 0x4002_0010 to 0x4002_0013 for protect. Would writing to these registers by using the FLASH_LDD API methods, set the protect registers located in flash configuration field (registers: 0x0000_0408 to 0x0000_040b)?
3- If I write to FTFL_FSEC (register 0x4002_0002), would it configure NV_FSEC (register 0x0000_040C)?
If 2 and 3 are true, then why not writing to those config. field registers directly to configure protect and security features?
4- At the moment, I do not need FSEC. I only would need protect field. For that factory values (the last 1KB of PFLASH0) that I told you, I would make them protect, so no one from outside can change them, only reading them are allowed.
As you showed me, I was able to make that section of the memory read-only for the linker not to write to that region and also I would need to protect it to prevent outsiders or even my FW to write to that section. Only read allowed.
5- It is interesting that the FLASH API available in PE has write/read/erase methods. It allows reading and writing conveniently from/to sections of my Flash. But I was thinking, I already have macros like IOREAD and IOWRITE that do the same thing!? Unless I want to use the FTFL registers. Otherwise, I can directly access flash config. registers?