<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis Microcontrollers中的主题 Re: How to enable security on a KL15</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282912#M10616</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to get it working. Quite simple. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I knew that In CW10.3 the linker file has a section for the flash configuration field. The section is named .cfmconfig.&lt;/P&gt;&lt;P&gt;So I just declared a 13 byte char array and placed it at that location. The code is like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;// Setting the flash security fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;uint8_t FCFValues[]__attribute__((section(".cfmconfig"))) =&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;{ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // 8 Bytes for backdoor comparison key. Set to default value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0xFF,0xFF,0xFF,0xFF, // 4 Bytes for flash protection field. Set to default value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0x00 // 1 Byte for the security reg. SEC bits = 00 (Security enable), MEEN bits = 00 (Mass erase enable);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;// The rest of the bytes in the FCF do not need any configuration for read protect&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this I am not able to read or debug. But I am able to mass erase and reprogram. Serves my purpose.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The reference manual is a bit tricky as it &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;does &lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;not&lt;/SPAN&gt; list the registers in order of their address&lt;/EM&gt;&lt;/SPAN&gt; at page 413, Section 27.3.1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FCF.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/119137i8595320D4DAE702C/image-size/large?v=v2&amp;amp;px=999" role="button" title="FCF.jpg" alt="FCF.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Looking at the table above one can easily assume that the flash security byte is at the end of the FCF. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I made the same mistake and actually programmed the FCF wrongly one time. Luckily it didn't lock up my MCU.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Do correct me if I mentioned anything wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Safwat &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Mar 2013 10:17:41 GMT</pubDate>
    <dc:creator>Safwat</dc:creator>
    <dc:date>2013-03-05T10:17:41Z</dc:date>
    <item>
      <title>How to enable security on a KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282911#M10615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a KL15 series MCU for my development.&lt;/P&gt;&lt;P&gt;But I am not sure on how to set the values of the FTFA_FSEC registers to secure my flash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the FSEC register is loaded at reset, I'm guessing that I should populate proper values in the &lt;EM&gt;flash configuration field &lt;/EM&gt;and load the firmware in my MCU. After reset,&amp;nbsp; FTFA_FSEC register should be loaded with the intended security bits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is it a better idea to use the &lt;EM&gt;"in application flash programming"&lt;/EM&gt; to set the &lt;EM&gt;flash config field&lt;/EM&gt; followed by a reset?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would be helpful if there was some example on how to properly do this. I don't want to mess up and permanently lock my QFN device. Difficult to manual solder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would appreciate some working sample code on how to do this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Safwat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 04:20:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282911#M10615</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-03-05T04:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable security on a KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282912#M10616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to get it working. Quite simple. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I knew that In CW10.3 the linker file has a section for the flash configuration field. The section is named .cfmconfig.&lt;/P&gt;&lt;P&gt;So I just declared a 13 byte char array and placed it at that location. The code is like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;// Setting the flash security fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;uint8_t FCFValues[]__attribute__((section(".cfmconfig"))) =&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;{ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // 8 Bytes for backdoor comparison key. Set to default value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0xFF,0xFF,0xFF,0xFF, // 4 Bytes for flash protection field. Set to default value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0x00 // 1 Byte for the security reg. SEC bits = 00 (Security enable), MEEN bits = 00 (Mass erase enable);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;// The rest of the bytes in the FCF do not need any configuration for read protect&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this I am not able to read or debug. But I am able to mass erase and reprogram. Serves my purpose.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The reference manual is a bit tricky as it &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;does &lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;not&lt;/SPAN&gt; list the registers in order of their address&lt;/EM&gt;&lt;/SPAN&gt; at page 413, Section 27.3.1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="FCF.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/119137i8595320D4DAE702C/image-size/large?v=v2&amp;amp;px=999" role="button" title="FCF.jpg" alt="FCF.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Looking at the table above one can easily assume that the flash security byte is at the end of the FCF. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I made the same mistake and actually programmed the FCF wrongly one time. Luckily it didn't lock up my MCU.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Do correct me if I mentioned anything wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Safwat &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 10:17:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282912#M10616</guid>
      <dc:creator>Safwat</dc:creator>
      <dc:date>2013-03-05T10:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable security on a KL15</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282913#M10617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great job Safwat, thanks for sharing! :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 22:25:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-security-on-a-KL15/m-p/282913#M10617</guid>
      <dc:creator>Monica</dc:creator>
      <dc:date>2013-03-05T22:25:25Z</dc:date>
    </item>
  </channel>
</rss>

