Hello everyone
I'm using KV11Z128 mcu. I write my code and now I need protect my flash memory. How can I do this? I can not understand this doc. so please explain step by step.
http://www.nxp.com/assets/documents/data/en/application-notes/AN4507.pdf
Best regards.
Hello Engin Subasi,
Please tell me the details about your flash memory protection.
Do you want to protect the program flash region from program and erase operations? Or you just want to protect your code from reading by other people with the debug interface?
If you don't want to other people to read your flash, you can use the flash security, The security features apply only to external accesses: debug. CPU accesses to the flash are not affected by the status of FSEC.
Please check it at first.
If you still want to use the Protect, you can refer to the KV11 reference manual chapter 31.4.1 Flash Protection, modify flash address 0x408-0x40B.
If you want to secure the chip, you can modify the 0X40C address.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you dear Kerry
I solved my problem. My code snippets here.
static flash_config_t s_flashDriver;
uint8_t fsecdata[16] = {0};
fsecdata[0] = 0xFF;
fsecdata[1] = 0xFF;
fsecdata[2] = 0xFF;
fsecdata[3] = 0xFF;
fsecdata[4] = 0xFF;
fsecdata[5] = 0xFF;
fsecdata[6] = 0xFF;
fsecdata[7] = 0xFF;
fsecdata[8] = 0xFF;
fsecdata[9] = 0xFF;
fsecdata[10] = 0xFF;
fsecdata[11] = 0xFF;
fsecdata[12] = 0b00000100;
fsecdata[13] = 0xFF;
fsecdata[14] = 0xFF;
fsecdata[15] = 0x00;
result = FLASH_Erase(&s_flashDriver, 0x400, 0xf, kFLASH_ApiEraseKey);
// PROGRAM MEMORY BLOCK TO USE LIKE EEPROM
result = FLASH_Program(&s_flashDriver, 0x400, /*(uint32_t *)*/fsecdata, 16);
Hi Engin Subasi,
Thank you for your updated information and the solutions!
If you still have question about this topic, just let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------