S32K142 FSEC set using cmm script

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K142 FSEC set using cmm script

105 Views
Venk_1
Contributor I

Hello,

We are using the S32K142 in our project with the bootloader and application as separate builds, but sharing a common startup file. We would like to lock the debug ports using a TRACE32 (.cmm) script by programming the FSEC register with the MEEN bit enabled.

  1. Is it possible to modify/program the FSEC configuration using a .cmm script after bootloader and application flashing is completed?
  2. Also, is there any restriction on performing a reset after loading the firmware for the FSEC changes to take effect?
  3. Do you have an example/reference .cmm script that can be used to implement this (FSEC programming with MEEN enabled) on S32K142 and also to perform mass erase?
0 Kudos
Reply
1 Reply

76 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2364473%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K142%20FSEC%20set%20using%20cmm%20script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2364473%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EHello%2C%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EWe%20are%20using%20the%20S32K142%20in%20our%20project%20with%20the%20bootloader%20and%20application%20as%20separate%20builds%2C%20but%20sharing%20a%20common%20startup%20file.%20We%20would%20like%20to%20lock%20the%20debug%20ports%20using%20a%20TRACE32%20(.cmm)%20script%20by%20programming%20the%20FSEC%20register%20with%20the%20MEEN%20bit%20enabled.%3C%2FFONT%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EIs%20it%20possible%20to%20modify%2Fprogram%20the%20FSEC%20configuration%20using%20a%20.cmm%20script%20after%20bootloader%20and%20application%20flashing%20is%20completed%3F%20%3C%2FFONT%3E%3C%2FLI%3E%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EAlso%2C%20is%20there%20any%20restriction%20on%20performing%20a%20reset%20after%20loading%20the%20firmware%20for%20the%20FSEC%20changes%20to%20take%20effect%3F%20%3C%2FFONT%3E%3C%2FLI%3E%3CLI%3E%3CFONT%20face%3D%22arial%2Chelvetica%2Csans-serif%22%3EDo%20you%20have%20an%20example%2Freference%20.cmm%20script%20that%20can%20be%20used%20to%20implement%20this%20(FSEC%20programming%20with%20MEEN%20enabled)%20on%20S32K142%20and%20also%20to%20perform%20mass%20erase%3F%3C%2FFONT%3E%3C%2FLI%3E%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2364877%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K142%20FSEC%20set%20using%20cmm%20script%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2364877%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F262687%22%20target%3D%22_blank%22%3E%40Venk_1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20cmm%20scripts%20can%20be%20used%20for%20whatever%20you%20want%2C%20there%20are%20endless%20possibilities.%20Yes%2C%20you%20can%20modify%20the%20FSEC.%20Take%20a%20look%20at%20beginning%20of%20this%20file%2C%20there's%20a%20description%20how%20to%20use%20this%20default%20programming%20script%3A%3C%2FP%3E%0A%3CP%3Ec%3A%5CT32%5Cdemo%5Carm%5Cflash%5Cs32k.cmm%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThen%20it%20can%20be%20as%20simple%20as%20this%3A%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EDO%20~~%2Fdemo%2Farm%2Fflash%2Fs32k%20PREPAREONLY%20CPU%3DS32K142%3C%2FP%3E%0A%3CP%3Eflash.auto.all%20%2FCENSORSHIP%3CBR%20%2F%3EData.Set%20SD%3A0x40C%20%25LE%200xFE%3CBR%20%2F%3Eflash.auto.off%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ENotice%20that%20flash%20configuration%20field%20is%20protected%20against%20unwanted%20modification.%20It's%20necessary%20to%20use%20parameter%20%22%2FCENSORSHIP%22%20as%20shown%20above%20to%20remove%20the%20protection.%20This%20is%20a%20feature%20of%20this%20programming%20script%2C%20it%20is%20not%20feature%20of%20the%20MCU.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20example%2C%20default%20%22unsecured%22%20value%200xFE%20is%20written%20to%20FSEC%20at%200x40C.%20You%20can%20modify%20it%20to%20required%20value.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20not%20restriction%20related%20to%20reset.%20Yes%2C%20reset%20is%20needed%20to%20activate%20new%20FSEC%20configuration.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20mass%20erase%2C%20use%20this%20command%3A%3C%2FP%3E%0A%3CP%3Eflash.UNSECUREerase%3C%2FP%3E%0A%3CP%3EBut%20if%20CSEc%20is%20enabled%2C%20it%20won't%20work.%20It%20is%20necessary%20to%20erase%20the%20keys%20first.%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3ELuksa%3C%2FP%3E%3C%2FLINGO-BODY%3E