<?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: Assigning value to global variable in LCF is assigning an address instead of a value in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Assigning-value-to-global-variable-in-LCF-is-assigning-an/m-p/471270#M6994</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial','sans-serif';"&gt;I viewed your link command file which defines “F__xRAM__start”&amp;nbsp; in LCF as:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F__xRAM__start = 0xAA55;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;By default, in C file, it uses the variable defined in LCF as an address, so in order to get your expected value in C file, please use it as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;extern int __xRAM__start;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;void function()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;int i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;i = (int)&amp;amp;__xRAM__start;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;…&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;I attached the example project, as well as the screenshot for its assembly out and running result. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="var in lcf.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53664iB266A8F9EFF90B30/image-size/large?v=v2&amp;amp;px=999" role="button" title="var in lcf.png" alt="var in lcf.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Fiona Kuang&lt;/P&gt;&lt;P&gt;Technical Information &amp;amp; Commercial Support&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Feb 2016 07:01:52 GMT</pubDate>
    <dc:creator>TICS_Fiona</dc:creator>
    <dc:date>2016-02-23T07:01:52Z</dc:date>
    <item>
      <title>Assigning value to global variable in LCF is assigning an address instead of a value</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Assigning-value-to-global-variable-in-LCF-is-assigning-an/m-p/471269#M6993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reading the "Linker Chapter" of "Targeting MC56F83xx/DSP5685x Controllers", page 286, it states that I can assign a value to global variable in the linker control file and then access it in the application C code. The variable must start with capital 'F'.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I do this assignment, it is assigning an address to the variable rather than the value which is not helpful. In the "PDF manual" the example shows storing and retrieving a value, not address assignment and pointer operations. I actually wanted to use the F_var = .;. I got weird results to I resorted to using a constant, F_var = 0xAA55. This demonstrated the issue well.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See attachments.&lt;/P&gt;&lt;P&gt;I included a view of the X memory and P memory. In either case, it shows that a pointer out 0xAA54 is meaningless and non-nonsensical. Both are regions of all FF's.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone can help or explain this to me, I would appreciate it.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338863"&gt;nxp_post_2016-02-18.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Feb 2016 23:10:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Assigning-value-to-global-variable-in-LCF-is-assigning-an/m-p/471269#M6993</guid>
      <dc:creator>j___</dc:creator>
      <dc:date>2016-02-18T23:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning value to global variable in LCF is assigning an address instead of a value</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Assigning-value-to-global-variable-in-LCF-is-assigning-an/m-p/471270#M6994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial','sans-serif';"&gt;I viewed your link command file which defines “F__xRAM__start”&amp;nbsp; in LCF as:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F__xRAM__start = 0xAA55;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;By default, in C file, it uses the variable defined in LCF as an address, so in order to get your expected value in C file, please use it as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;extern int __xRAM__start;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;void function()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;int i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;i = (int)&amp;amp;__xRAM__start;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;…&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif';"&gt;I attached the example project, as well as the screenshot for its assembly out and running result. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="var in lcf.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53664iB266A8F9EFF90B30/image-size/large?v=v2&amp;amp;px=999" role="button" title="var in lcf.png" alt="var in lcf.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Fiona Kuang&lt;/P&gt;&lt;P&gt;Technical Information &amp;amp; Commercial Support&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 07:01:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Assigning-value-to-global-variable-in-LCF-is-assigning-an/m-p/471270#M6994</guid>
      <dc:creator>TICS_Fiona</dc:creator>
      <dc:date>2016-02-23T07:01:52Z</dc:date>
    </item>
  </channel>
</rss>

