<?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 Development ToolsのトピックString literals allocation.</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/String-literals-allocation/m-p/891655#M7545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;the following global variable definition in a&amp;nbsp;&lt;SPAN&gt;fresh&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;bareboard project for MC9S12ZVML128 created with CW 10.6.4 (S12Z compiler 1.0.5).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;char const *pcc = "abcdefghijklmnopq";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After a build, the map file shows the following:&lt;/P&gt;&lt;P&gt;- pcc is allocated to section .data (&lt;STRONG style="color: #339966; "&gt;expected&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;- pcc points to an address from section .data (&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;unexpected&lt;/STRONG&gt; &lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;It seems that the string literal is&amp;nbsp;stored in section .copy and used to initialize a variable&amp;nbsp;from .data to which pcc points to in the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on the linker documentation and the content of the .prm file I was expecting the string literal to&amp;nbsp;end up in the ROM segment (.rodata1 section) and pcc to point to the ROM address of the literal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the link of the documentation that I used:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/reference-manual/Build_Tools_Utilities.pdf"&gt;https://www.nxp.com/docs/en/reference-manual/Build_Tools_Utilities.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this behavior correct and if so what's the explanation ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 May 2019 16:06:34 GMT</pubDate>
    <dc:creator>daniel_aciubota</dc:creator>
    <dc:date>2019-05-13T16:06:34Z</dc:date>
    <item>
      <title>String literals allocation.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/String-literals-allocation/m-p/891655#M7545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;the following global variable definition in a&amp;nbsp;&lt;SPAN&gt;fresh&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;bareboard project for MC9S12ZVML128 created with CW 10.6.4 (S12Z compiler 1.0.5).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;char const *pcc = "abcdefghijklmnopq";&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After a build, the map file shows the following:&lt;/P&gt;&lt;P&gt;- pcc is allocated to section .data (&lt;STRONG style="color: #339966; "&gt;expected&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;- pcc points to an address from section .data (&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;unexpected&lt;/STRONG&gt; &lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;It seems that the string literal is&amp;nbsp;stored in section .copy and used to initialize a variable&amp;nbsp;from .data to which pcc points to in the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on the linker documentation and the content of the .prm file I was expecting the string literal to&amp;nbsp;end up in the ROM segment (.rodata1 section) and pcc to point to the ROM address of the literal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the link of the documentation that I used:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/reference-manual/Build_Tools_Utilities.pdf"&gt;https://www.nxp.com/docs/en/reference-manual/Build_Tools_Utilities.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this behavior correct and if so what's the explanation ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2019 16:06:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/String-literals-allocation/m-p/891655#M7545</guid>
      <dc:creator>daniel_aciubota</dc:creator>
      <dc:date>2019-05-13T16:06:34Z</dc:date>
    </item>
  </channel>
</rss>

