<?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>S12 / MagniV Microcontrollers中的主题 Re: why this code is executing properly</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347497#M10545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much the reply. Now i understood. Can you please tell me or atleast point to the document which gives me some information about the switch you are referring to -D __FAR_DATA what does it do? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Feb 2015 10:07:43 GMT</pubDate>
    <dc:creator>rahulkrishna</dc:creator>
    <dc:date>2015-02-04T10:07:43Z</dc:date>
    <item>
      <title>why this code is executing properly</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347495#M10543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i have written this code and expected the code to fail but it does not.&lt;/P&gt;&lt;P&gt;typedef unsigned char UINT8_T;&lt;/P&gt;&lt;P&gt;#define INDEX 100&lt;/P&gt;&lt;P&gt;#define NULL (void *)0&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __RPAGE_SEG&amp;nbsp; PAGED_RAM&lt;/P&gt;&lt;P&gt;UINT8_T buffer[INDEX];&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG&amp;nbsp; DEFAULT&lt;/P&gt;&lt;P&gt;UINT8_T test_data[100];&lt;/P&gt;&lt;P&gt;UINT8_T *ptr_data=NULL;&lt;/P&gt;&lt;P&gt;void test(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;UINT8_T fl_index_u8=0;&lt;/P&gt;&lt;P&gt;ptr_data = buffer;&lt;/P&gt;&lt;P&gt;for(fl_index_u8=0; fl_index_u8 &amp;lt; 100; fl_index_u8++)&lt;/P&gt;&lt;P&gt; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; buffer[fl_index_u8] = fl_index_u8;&lt;/P&gt;&lt;P&gt;&amp;nbsp; test_data[fl_index_u8] = *ptr_data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ptr_data++;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;It compiled but with warning : C1860: pointer conversion: possible loss of data&lt;/P&gt;&lt;P&gt;I expected that test_data will be filled with default values of 0, but it is filling with data loaded into buffer variable. I am doing the full chip simulation, the address loaded into ptr_data = 0x00 and it is 2 bytes yet the progam is running successfully? &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the map file&lt;/P&gt;&lt;P&gt;ptr_data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2108&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .bss&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;buffer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FD1000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 64&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; PAGED_RAM&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;test_data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 210C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 64&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; .common&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the common area?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 08:10:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347495#M10543</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-02-04T08:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: why this code is executing properly</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347496#M10544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should edit compiler settings and change C1860 message setting to produce compile error, not warning. Your code works because pointer dereference comes after access to buffer[], which sets up RPAGE register to the right value. Since both, buffer[] and *ptr_data are on the same RPAGE, you see data copied properly. Try defining more data, so that more than one R-page is used, also make ptr_data pointing to data, which is allocated on different R-page than buffer[]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure there's -D__FAR_DATA in compiler command line switch. Project wizard may not include this important setting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 09:43:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347496#M10544</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2015-02-04T09:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: why this code is executing properly</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347497#M10545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much the reply. Now i understood. Can you please tell me or atleast point to the document which gives me some information about the switch you are referring to -D __FAR_DATA what does it do? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 10:07:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347497#M10545</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2015-02-04T10:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: why this code is executing properly</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347498#M10546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;__FAR_DATA define is required to make startup file initializing paged data properly. Once you start using paged RAM, you need to have it defined, else startup code will try to init wrong memory areas. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 10:30:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/why-this-code-is-executing-properly/m-p/347498#M10546</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2015-02-04T10:30:50Z</dc:date>
    </item>
  </channel>
</rss>

