Hi @Venk_1
The cmm scripts can be used for whatever you want, there are endless possibilities. Yes, you can modify the FSEC. Take a look at beginning of this file, there's a description how to use this default programming script:
c:\T32\demo\arm\flash\s32k.cmm
Then it can be as simple as this:
DO ~~/demo/arm/flash/s32k PREPAREONLY CPU=S32K142
flash.auto.all /CENSORSHIP
Data.Set SD:0x40C %LE 0xFE
flash.auto.off
Notice that flash configuration field is protected against unwanted modification. It's necessary to use parameter "/CENSORSHIP" as shown above to remove the protection. This is a feature of this programming script, it is not feature of the MCU.
In this example, default "unsecured" value 0xFE is written to FSEC at 0x40C. You can modify it to required value.
There are not restriction related to reset. Yes, reset is needed to activate new FSEC configuration.
For mass erase, use this command:
flash.UNSECUREerase
But if CSEc is enabled, it won't work. It is necessary to erase the keys first.
Regards,
Luksa