<?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>CodeWarrior for MCUのトピックRe: Problem started with CW10.4 (Kinetis)</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273574#M10195</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CHAR is typedefed as "signed char" and the array in question is a local static (not global).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meantime the following has been found. By unclicking "Place Read-Only strings in .rodata Section" it places the array in SRAM again - see&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/301910"&gt;Placing strings&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't say whether GCC or the legacy compiler is being used since I am relaying the finding from a uTasker project user - I still use CW10.2 for my testing. However it was also found that declaring the array to make it not to specifically be a string: &lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;STRONG&gt;static CHAR cTest[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 0};&lt;/STRONG&gt; didn't change behaviour (still in Flash).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;I have always worked with this option set since it avoids having lots of string consts being copied to SRAM (which can use up a lot of SRAM when there is a text based command line interface with menus based on string entries but it looks like from CW10.4 arrays that are not consts (and also not used as consts by the code) may be getting included.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Nov 2013 17:29:10 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2013-11-13T17:29:10Z</dc:date>
    <item>
      <title>Problem started with CW10.4 (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273571#M10192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code started failing with CW10.4 and CW10.5 but was Ok with CW10.2:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;static CHAR cTest[] = "abcdefghijklmnop";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;while (i &amp;lt; 16) {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (cTest[i] == 'z') {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cTest[i] = 'a';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cTest[i]++;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code just shifts the string in the buffer each time it is called but the code itself is not the issue.&lt;/P&gt;&lt;P&gt;The problem is that &lt;STRONG&gt;cTEST[]&lt;/STRONG&gt; is located in FLASH from CW10.4 (irrespective of optimisation settings) and so any attempt to modify the string content causes an exception.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No other compliers tested with (GCC, Keil, IAR) put the string in FLASH and CW10.2 put it in SRAM.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code has been modified to allocate &lt;STRONG&gt;cTest[]&lt;/STRONG&gt; on heap to avoid the problem but it would be interesting to know whether there is something specific controlling the behaviour and whether ANSI C defines specifically where the array should be located?&lt;/P&gt;&lt;P&gt;For example, if the code is changed to declare the array specifically as a const&lt;BR /&gt;&lt;STRONG&gt;static const CHAR cTest[] = "abcdefghijklmnop";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;the compiler then throws an error on the lines where writes are made to it. This tells me that the compiler is treating the array (when not declared as const) as being modifiable but the linker is then locating it as a const.&lt;/P&gt;&lt;P&gt;I wonder whether there is some rule such as "make all strings consts" that is being followed??&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2013 17:09:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273571#M10192</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2013-11-12T17:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem started with CW10.4 (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273572#M10193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;what is the type behind CHAR?&lt;/P&gt;&lt;P&gt;And is cTest a global variable or a static local?&lt;/P&gt;&lt;P&gt;Can you confirm that you are not using the ARM gcc in CodeWarrior, but instead the legacy Freescale ARM compiler (Freescale moved to GCC as the default compiler)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2013 17:22:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273572#M10193</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-11-12T17:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem started with CW10.4 (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273573#M10194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;I would say: if the linker allocates that non-const array in FLASH, I would consider this as definitely not expected (a bug?).&lt;/P&gt;&lt;P&gt;I quickly tried your example (with 10.5), and it does allocate it in RAM for me, according to the linker map file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# .app_data&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1FFF8000 00000011 .data&amp;nbsp;&amp;nbsp; cTest&amp;nbsp;&amp;nbsp;&amp;nbsp; (main_c.obj)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2013 18:22:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273573#M10194</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-11-12T18:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Problem started with CW10.4 (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273574#M10195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CHAR is typedefed as "signed char" and the array in question is a local static (not global).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meantime the following has been found. By unclicking "Place Read-Only strings in .rodata Section" it places the array in SRAM again - see&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/301910"&gt;Placing strings&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't say whether GCC or the legacy compiler is being used since I am relaying the finding from a uTasker project user - I still use CW10.2 for my testing. However it was also found that declaring the array to make it not to specifically be a string: &lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;STRONG&gt;static CHAR cTest[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 0};&lt;/STRONG&gt; didn't change behaviour (still in Flash).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;I have always worked with this option set since it avoids having lots of string consts being copied to SRAM (which can use up a lot of SRAM when there is a text based command line interface with menus based on string entries but it looks like from CW10.4 arrays that are not consts (and also not used as consts by the code) may be getting included.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Nov 2013 17:29:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273574#M10195</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2013-11-13T17:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem started with CW10.4 (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273575#M10196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems as though the problem is solved when strings that should not be located in flash are declared as if they are arrays:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;STRONG&gt;static CHAR cTest[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 0};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;New tests have shown that there was an error made during the original trials and this method does work around the difficulty.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Mark&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Nov 2013 11:15:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problem-started-with-CW10-4-Kinetis/m-p/273575#M10196</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2013-11-18T11:15:30Z</dc:date>
    </item>
  </channel>
</rss>

