<?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>topic Re: What I have to do to put const chars into flash memory? in Kinetis Design Studio</title>
    <link>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577981#M7355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for answer and help!&lt;BR /&gt;Very useful sugestions - everything works fine - I checked:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Piotr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Sep 2016 12:56:35 GMT</pubDate>
    <dc:creator>piotrdzierzak</dc:creator>
    <dc:date>2016-09-06T12:56:35Z</dc:date>
    <item>
      <title>What I have to do to put const chars into flash memory?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577979#M7353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Hello!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;What I have to do to put const chars into flash memory?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;I use KDS like below with j-link from Segger (Picture1).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Picture1:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="160379_160379.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122176i0F6B2ABD91636CAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="160379_160379.bmp" alt="160379_160379.bmp" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="KDS_ver.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/4411iED5569E83F6BE12F/image-size/large?v=v2&amp;amp;px=999" role="button" title="KDS_ver.bmp" alt="KDS_ver.bmp" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;&amp;nbsp; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;For example &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;static&lt;/STRONG&gt; &lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;const&lt;/STRONG&gt; &lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;unsigned&lt;/STRONG&gt; &lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;char&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt; color: #d9e8f7; background: black;"&gt; en_menu_1_0&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #f9faf4; background: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #6897bb; background: black;"&gt;15&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #f9faf4; background: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #17c6a3; background: black;"&gt;"Put into flash"&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;Picture2:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="160380_160380.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122177i64D5306F82208A67/image-size/large?v=v2&amp;amp;px=999" role="button" title="160380_160380.bmp" alt="160380_160380.bmp" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="const_char.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/4457i3B7F51837769C403/image-size/large?v=v2&amp;amp;px=999" role="button" title="const_char.bmp" alt="const_char.bmp" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #1f497d; font-size: 14.0pt;"&gt;map file (Picture3):&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="160381_160381.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122178i4BE16EEF2607B8AB/image-size/large?v=v2&amp;amp;px=999" role="button" title="160381_160381.bmp" alt="160381_160381.bmp" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="mapfile.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/4490i94B4B0309F2E1215/image-size/large?v=v2&amp;amp;px=999" role="button" title="mapfile.bmp" alt="mapfile.bmp" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;When I read from this array in run &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #d9e8f7; background: black;"&gt;i&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #d9e8f7; background: black;"&gt; en_menu_1_0&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #f9faf4; background: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #6897bb; background: black;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #f9faf4; background: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;Picture4:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="160385_160385.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/122179iEA6BEC441F8BF09A/image-size/large?v=v2&amp;amp;px=999" role="button" title="160385_160385.bmp" alt="160385_160385.bmp" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="read_const.bmp"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/4575iDF627726CB30C957/image-size/large?v=v2&amp;amp;px=999" role="button" title="read_const.bmp" alt="read_const.bmp" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;On the Picture4 the value i=0x74 (ASCII == ‘t’) so this is correct. In this situation debbuger show correct value. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;But why:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;1. The debugger shows strange value like in picture2 above, where is&amp;nbsp;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;initialization &lt;/SPAN&gt;&lt;/SPAN&gt;of const unsigned char array? &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;const&lt;/STRONG&gt; &lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;unsigned&lt;/STRONG&gt; &lt;STRONG style="color: #dd2867; background: black; font-size: 14.0pt;"&gt;char&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt; color: #d9e8f7; background: black;"&gt; en_menu_1_0&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #f9faf4; background: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #6897bb; background: black;"&gt;15&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #f9faf4; background: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: lavender; background: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 14.0pt; color: #17c6a3; background: black;"&gt;"Put into flash"&lt;/SPAN&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;2. Why address of static const unsigned char en_menu_1_0 is …. 0x00000000 (picture2)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;...................................................................................................................................................&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Maybe I describe what I want to do....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;I want to prepare menu strings that I want to put to the flash memory. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Then make array of pointers to the array of chars…. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Something like this below for atmel. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;But how can I do this in Kinetis (KL46Z256)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;In 8051 there is “code”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;In atmel ther is “PROGMEM”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;What I have to do in Kinetis KL46?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;example from atmel:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: maroon; font-size: 14.0pt;"&gt;const&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt;"&gt; &lt;STRONG style="color: maroon;"&gt;char&lt;/STRONG&gt; MenuItem1&lt;SPAN style="color: #808030;"&gt;[]&lt;/SPAN&gt; PROGMEM &lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: maroon;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #0000e6;"&gt;Mirek&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: maroon; font-size: 14.0pt;"&gt;const&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt;"&gt; &lt;STRONG style="color: maroon;"&gt;char&lt;/STRONG&gt; MenuItem2&lt;SPAN style="color: #808030;"&gt;[]&lt;/SPAN&gt; PROGMEM &lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: maroon;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #0000e6;"&gt;Tomek&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: maroon; font-size: 14.0pt;"&gt;const&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt;"&gt; &lt;STRONG style="color: maroon;"&gt;char&lt;/STRONG&gt; MenuItem3&lt;SPAN style="color: #808030;"&gt;[]&lt;/SPAN&gt; PROGMEM &lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: maroon;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #0000e6;"&gt;Atnel&lt;/SPAN&gt;&lt;SPAN style="color: maroon;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: maroon; font-size: 14.0pt;"&gt;const&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt;"&gt; &lt;STRONG style="color: maroon;"&gt;char&lt;/STRONG&gt; &lt;SPAN style="color: #808030;"&gt;*&lt;/SPAN&gt; &lt;STRONG style="color: maroon;"&gt;const&lt;/STRONG&gt; MenuItemPointers&lt;SPAN style="color: #808030;"&gt;[]&lt;/SPAN&gt; PROGMEM &lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: purple;"&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp; MenuItem1&lt;SPAN style="color: #808030;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp; MenuItem2&lt;SPAN style="color: #808030;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp; MenuItem3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: purple;"&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: maroon; font-size: 14.0pt;"&gt;int&lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt;"&gt; &lt;SPAN style="color: #400000;"&gt;main&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt; &lt;STRONG style="color: maroon;"&gt;void&lt;/STRONG&gt; &lt;SPAN style="color: #808030;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: purple;"&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;lcd_init&lt;SPAN style="color: #808030;"&gt;()&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;uint8_t i&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&lt;STRONG style="color: maroon;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while&lt;/STRONG&gt;&lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #008c00;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #808030;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: purple;"&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG style="color: maroon;"&gt;for&lt;/STRONG&gt;&lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt;i&lt;SPAN style="color: #808030;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #008c00;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt; i&lt;SPAN style="color: #808030;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #008c00;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt; i&lt;SPAN style="color: #808030;"&gt;++)&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;lcd_str_P&lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt; &lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt;&lt;STRONG style="color: maroon;"&gt;char&lt;/STRONG&gt;&lt;SPAN style="color: #808030;"&gt;*)&lt;/SPAN&gt;pgm_read_word&lt;SPAN style="color: #808030;"&gt;(&lt;/SPAN&gt; &lt;SPAN style="color: #808030;"&gt;&amp;amp;&lt;/SPAN&gt;MenuItemPointers&lt;SPAN style="color: #808030;"&gt;[&lt;/SPAN&gt;i&lt;SPAN style="color: #808030;"&gt;]&lt;/SPAN&gt; &lt;SPAN style="color: #808030;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: #808030;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: purple;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: purple;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: purple;"&gt;...............................................................................................................................................&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;I will be very gratefull for any help and sugestion.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: #1f497d;"&gt;Piotr&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.0pt; color: purple;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 08:24:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577979#M7353</guid>
      <dc:creator>piotrdzierzak</dc:creator>
      <dc:date>2016-08-31T08:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: What I have to do to put const chars into flash memory?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577980#M7354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the code I use with GCC. &amp;nbsp;Some macros make it compatible with AVR-GCC so same code can be used on both ARM and AVR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define PGM_P char const *&lt;/P&gt;&lt;P&gt;#define strncpy_P strncpy&lt;/P&gt;&lt;P&gt;#define PROGMEM&lt;/P&gt;&lt;P&gt;#ifndef PGM_READ_WORD&lt;BR /&gt;#define PGM_READ_WORD(adr) (adr)&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;#define UNUSED( PARAMETER ) (void)(PARAMETER) /** Used to silence 'unused parameter' */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Example function: */&lt;/P&gt;&lt;P&gt;static uint16_t bootload_jump_func( uint8_t const *string_u8 );&lt;BR /&gt;static uint16_t bootload_jump_func( uint8_t const *string_u8 )&lt;BR /&gt;{&lt;BR /&gt; UNUSED( string_u8 );&lt;BR /&gt;bootload_jump_func(); /* Never returns */&lt;BR /&gt; return( 0U ); /* Keep compiler happy, we never get here */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* ******************** Decode incoming ASCII commands ******************** */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * To get the static strings to really be in the flash you have to do&lt;BR /&gt; * it this way with structures. The 'obvious' way only gets the array&lt;BR /&gt; * of pointers in flash, not the strings themselves. Also the&lt;BR /&gt; * #)$*#$(#$*)_# IAR compiler doesn't generate the code you expect&lt;BR /&gt; * sucking away your RAM! #$__*)#$* IAR will not let you put an array&lt;BR /&gt; * of pointers into flash, but it will allow you to put an array of&lt;BR /&gt; * structures into flash.&lt;BR /&gt; */&lt;BR /&gt; typedef uint16_t (*cmdfunc_t)( uint8_t const *string_u8 );&lt;BR /&gt;typedef struct /* define the struct 'cmd_entry' */&lt;BR /&gt;{&lt;BR /&gt; PGM_P string; /* Pointer to string in flash */&lt;BR /&gt; cmdfunc_t function;&lt;BR /&gt;}str_func_entry;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;static const char cmd_str_firmware_update[] PROGMEM = "Firmware_Update";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static const str_func_entry cmd_func_table[] PROGMEM= /* Declare a constant object of type 'cmd_entry' */&lt;BR /&gt; {/* Keep in Alphabetical order for the Help command: */&lt;BR /&gt; {cmd_str_firmware_update, bootload_jump_func}&lt;BR /&gt; };&lt;BR /&gt;#define COMMANDS_AVAILABLE (sizeof( cmd_func_table ) / sizeof( str_func_entry ))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static uint16_t cmd_help_func( uint8_t const *string_u8 )&lt;BR /&gt;{&lt;BR /&gt; UNUSED( string_u8 );&lt;/P&gt;&lt;P&gt;strout_P( text_string_ptr_get( CMDS_TXT_CRLF ) );&lt;BR /&gt; strout_P( text_string_ptr_get( CMDS_TXT_CRLF ) );&lt;/P&gt;&lt;P&gt;for( uint_fast16_t number_of_patterns_u16 = 0U; number_of_patterns_u16 &amp;lt; COMMANDS_AVAILABLE; number_of_patterns_u16++ )&lt;BR /&gt; {&lt;BR /&gt; strout_P( (PGM_P) PGM_READ_WORD( cmd_func_table[number_of_patterns_u16].string ) );&lt;BR /&gt; strout_P( text_string_ptr_get( CMDS_TXT_CRLF ) );&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;strout_P( text_string_ptr_get( CMDS_TXT_CRLF ) );&lt;/P&gt;&lt;P&gt;return( 0U );&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 12:24:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577980#M7354</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2016-08-31T12:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: What I have to do to put const chars into flash memory?</title>
      <link>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577981#M7355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for answer and help!&lt;BR /&gt;Very useful sugestions - everything works fine - I checked:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Piotr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2016 12:56:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Design-Studio/What-I-have-to-do-to-put-const-chars-into-flash-memory/m-p/577981#M7355</guid>
      <dc:creator>piotrdzierzak</dc:creator>
      <dc:date>2016-09-06T12:56:35Z</dc:date>
    </item>
  </channel>
</rss>

