<?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中的主题 Re: confusion with data_seg and flash variable</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348694#M1567</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the reply. I did not find the attachment of the video. I have created the following codewarrior project and it is compiling properly, why is not showing any error.&amp;nbsp; The main task of the project is to put the configuration parameters in the flash memory at known addresses and during the run time read those configuration parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In main.c file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __GPAGE_SEG PARAMETERS&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_1=3;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_2=1;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_3=2;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_4=5;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_5=8;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_6=0;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* put your own code here */&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; unsigned int *__far localpointer;&lt;/P&gt;&lt;P&gt;&amp;nbsp; unsigned int localvalue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_3);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_4);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_6);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localvalue = *localpointer;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linker file&lt;/P&gt;&lt;P&gt;PARAMETERS INTO PAGE_E0_0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output of the map file is generating as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TESTDATA_1&amp;nbsp; E08000 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_2&amp;nbsp; E08002 2 2 1 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_3&amp;nbsp; E08004 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_4&amp;nbsp; E08006 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_5&amp;nbsp; E08008 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_6&amp;nbsp; E0800A 2 2 1 PARAMETERS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why it is generating correctly at the expected addresses? Or it is wrong I am not able to understand properly. My concern is i have to place some 200 Variables in Flash from One known fixed location to another fixed location how to do it? The code i have shown is the actual code running in some of my systems should i plan to change the code immediately?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Mar 2015 18:08:11 GMT</pubDate>
    <dc:creator>rahulkrishna</dc:creator>
    <dc:date>2015-03-02T18:08:11Z</dc:date>
    <item>
      <title>confusion with data_seg and flash variable</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348692#M1565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i am not able to understand the following problem&lt;/P&gt;&lt;P&gt;The aim of the project is to put a variable in the Flash memory at a particular address&lt;/P&gt;&lt;P&gt;For example: in PAGE_E0_0 at the first address 0xE08000&lt;/P&gt;&lt;P&gt;To execute that i have seen (then written) the following code&lt;/P&gt;&lt;P&gt;suppose in the linker file&lt;/P&gt;&lt;P&gt;SEGMENTS&lt;/P&gt;&lt;P&gt;PAGE_E0_0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = READ_ONLY&amp;nbsp;&amp;nbsp; 0xE08000 TO 0xE087FF; &lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;PLACEMENT&lt;/P&gt;&lt;P&gt;PARAMETER INTO PAGE_E0_0&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;In the main file&lt;/P&gt;&lt;P&gt;int main(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __GPAGE_SEG CALIB_PARAMS&lt;/P&gt;&lt;P&gt; unsigned char PARAMETER;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I write the above code I can see in the map file&amp;nbsp; that the variable PARAMETER is placed in the address 0xE0800 (as i wanted) . But my doubt is as you can see the variable PARAMETER is defined in the Flash memory then why you want to write the following&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __GPAGE_SEG CALIB_PARAMS&lt;/P&gt;&lt;P&gt; unsigned char PARAMETER;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;specifically the DATA_SEG keyword. what is the meaning of the keyword DATA_SEG when the variable is placed in the Flash memory. It is basically used for RAM variables i think.&lt;/P&gt;&lt;P&gt;In case if i assume that the DATA_SEG is wrong and write something like this&lt;/P&gt;&lt;P&gt;#pragma CODE_SEG __GPAGE_SEG CALIB_PARAMS&lt;/P&gt;&lt;P&gt; unsigned char PARAMETER;&lt;/P&gt;&lt;P&gt;#pragma CODE_SEG DEFAULT&lt;/P&gt;&lt;P&gt;Then the variable is not placed in the expected memory location that is in PAGE_E0_0 but in some default ROM memory location which i did not want. Please help me to understand this? Is it legal that #pragma DATA_SEG can be used for flash variables.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 09:48:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348692#M1565</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-03-02T09:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: confusion with data_seg and flash variable</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348693#M1566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rahul,&lt;/P&gt;&lt;P&gt;there are several problems in your code.&lt;/P&gt;&lt;P&gt;1, if you need to define constant data in flash, we need use "const" keyword:&lt;/P&gt;&lt;P&gt;const unsigned char PARAMETER;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;without const, the data will be defined in RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. the const data must be defined as global.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.0xE08000 is paged adderss but not global address, we need to use __PPAGE_SEG instead of __GPAGE_SEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. add global variable to prm ENTRIES section can be avoid optimized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see attached demo code and video.&lt;/P&gt;&lt;P&gt;can this help?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 10:24:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348693#M1566</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-03-02T10:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: confusion with data_seg and flash variable</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348694#M1567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the reply. I did not find the attachment of the video. I have created the following codewarrior project and it is compiling properly, why is not showing any error.&amp;nbsp; The main task of the project is to put the configuration parameters in the flash memory at known addresses and during the run time read those configuration parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In main.c file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __GPAGE_SEG PARAMETERS&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_1=3;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_2=1;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_3=2;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_4=5;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_5=8;&lt;/P&gt;&lt;P&gt;unsigned int TESTDATA_6=0;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void main(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* put your own code here */&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; unsigned int *__far localpointer;&lt;/P&gt;&lt;P&gt;&amp;nbsp; unsigned int localvalue;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_3);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_4);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localpointer = (unsigned int * __far)(&amp;amp;TESTDATA_6);&lt;/P&gt;&lt;P&gt;&amp;nbsp; localvalue = *localpointer;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linker file&lt;/P&gt;&lt;P&gt;PARAMETERS INTO PAGE_E0_0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output of the map file is generating as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TESTDATA_1&amp;nbsp; E08000 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_2&amp;nbsp; E08002 2 2 1 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_3&amp;nbsp; E08004 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_4&amp;nbsp; E08006 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_5&amp;nbsp; E08008 2 2 2 PARAMETERS&lt;/P&gt;&lt;P&gt;TESTDATA_6&amp;nbsp; E0800A 2 2 1 PARAMETERS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why it is generating correctly at the expected addresses? Or it is wrong I am not able to understand properly. My concern is i have to place some 200 Variables in Flash from One known fixed location to another fixed location how to do it? The code i have shown is the actual code running in some of my systems should i plan to change the code immediately?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2015 18:08:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348694#M1567</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-03-02T18:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: confusion with data_seg and flash variable</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348695#M1568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the video is in the zip file of my first post.&lt;/P&gt;&lt;P&gt;regarding your code. can you please upload a demo project so i can check it directly on my side? thanks!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Zhang Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 03:30:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348695#M1568</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2015-03-03T03:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Re: confusion with data_seg and flash variable</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348696#M1569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. please find the project for review.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just now i have seen the video, thankyou very much it was very good.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 05:24:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/confusion-with-data-seg-and-flash-variable/m-p/348696#M1569</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-03-03T05:24:38Z</dc:date>
    </item>
  </channel>
</rss>

