If you want to avoid flash programming in case the device is not secured I'd recommend you to rather to attach to a running device instead of Download:
If the device is secured you will see invalid content like this:
If it's unsecured you should see a valid memory dump.
Hope it helps.
I hope I understand you well.
When the device is secured then you are not able to neither load the code into it
nor connect to it and the CW reports it before download.
When the mcu is secured then you can see after download:
The only BDM command which is accessible is mass errase which is able to clear entire memory and set the security bits to the unsecure status. Unsecuring can be performed by CW or external program.
So easily, if you are able to connect to it by BDM before loading the code or hot plugin then it is not secured.
Have you tried to secure the device and then to connect to it? You will see what happens.
If you want to secure the device then just add following on the top of your code as a global variable:
const unsigned char flash_array @ 0xFFFE08 = // secure the device without backdoor key
0xFF, //0xFFF0A RESERVED
0xFF, //0xFFF0B RESERVED
0xFF, //0xFFF0C FPROT
0xFF, //0xFFF0D DFPROT
0xFF, //0xFFF0E FOPT
0xFC, //0xFFF0F FSEC - SECURED without backdoor key
I am a new NXP user. I only know how to Build, Debug & Flash in Commander.
So, I want to learn how to secure and unsecured. Your reply very detail. Thank you very much. Now, I understand how to do that.
I have another question. How to read unsecured MCU (Ex. S12ZVCA) and save it to PC?
Let's assume there is running code in the MCU.
The easiest way is to create a new bareboard project
and do not change anything but:
1) Open a debug configuration
2) Select attach
3) You can look into a memory window and press export
4) Select entire memory and the name of the file