AnsweredAssumed Answered

How to protect flash on MKL17Z256VLH4?

Question asked by pcpro178 on Jul 30, 2018
Latest reply on Jul 31, 2018 by Kerry Zhou

Can anyone tell me if this would be a proper implementation for protecting the program flash from JTAG reads?  The functions used here are taken straight from the Kinetis SDK v2.0 API Reference Manual (KSDK20APIRM).  It's got some good information on individual API functions, but not much on wider implementation.


flash_protection_state_t protectionState;
stat = FLASH_IsProtected(&Config, 0, 0x40000UL, &protectionState);
stat = (kStatus_FLASH_Success == stat) ? kStatus_Success : kStatus_Fail;

pstat.valueLow32b = (pflash_protection_status_low_t)UINT32_MAX;
if ((kStatus_FLASH_Success == stat) && (kFLASH_ProtectionStateProtected != protectionState))
stat = FLASH_PflashSetProtection(&Config, &pstat);