<?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: __far and s12 global address</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907500#M16470</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;2. Actually you have two ways to tell compiler your data&amp;nbsp;has special, not 16bit address.&amp;nbsp;Keyword like __far in data declaration or round your declaration with proper pragmas. If your data is shared among C files, you need to use the same __far or pragmas in header file so that compiler sees your data declared the same in all C files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Today is Mother's Day.&amp;nbsp;I wish your mother good health and your family happiness(Chinese style blessing).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, but Mother's Day was&amp;nbsp;actually week ago in my country.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 May 2019 06:45:02 GMT</pubDate>
    <dc:creator>kef2</dc:creator>
    <dc:date>2019-05-13T06:45:02Z</dc:date>
    <item>
      <title>__far and s12 global address</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907496#M16466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear NXPers,&lt;/P&gt;&lt;P&gt;I create a project on&amp;nbsp;MC9S12G** with BANKED model.&lt;/P&gt;&lt;P&gt;There is a structual type variable &amp;nbsp;EMS_infoMapS, its address in page is 0x8000, global address is 0x04000, logic address is ox18000(page=1).The following picture is&amp;nbsp;S12 memory map.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="memory map.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80262iC447D0830CF0609C/image-size/large?v=v2&amp;amp;px=999" role="button" title="memory map.PNG" alt="memory map.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The following code is about the address of&amp;nbsp;&lt;SPAN&gt;EMS_infoMapS,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma CONST_SEG DEFAULT&lt;BR /&gt;extern EMS_CTRLMAP_TYPE * __far EMS_infoMapSP;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma CONST_SEG MAP1_ROM&lt;BR /&gt;volatile const EMS_CTRLMAP_TYPE EMS_infoMapS=&lt;BR /&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;PLACEMENT&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;MAP1_ROM&amp;nbsp;&lt;BR /&gt; INTO PAGE_01;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;END&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And .map file show address allocation results.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;MODULE: -- Map.c.o --&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- PROCEDURES:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- VARIABLES:&lt;/EM&gt;&lt;BR /&gt; &lt;EM&gt;EMS_infoMapSP 1674 3 3 47 .data&lt;/EM&gt;&lt;BR /&gt; &lt;EM&gt;EMS_infoMapS 18000 2EA4 11940 2 MAP1_ROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, I do the following operation,&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void ADC_GetAnagValue1(void)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt; &lt;EM&gt;DisableInterrupts;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ADC_tClntUW = IntpoCur_u16((uint16 * __far) &amp;amp;ADC_tClntUW_CUR,ADC_tClntRsUW);&lt;/EM&gt;&lt;BR /&gt; &lt;EM&gt;EnableInterrupts;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;const uint16 *__far MAPAddr_u16;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;uint16 IntpoCur_u16(const uint16 * __far MAPAddr,uint16 X)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;MAPAddr_u16_reverse = MAPAddr;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I debug, and find&amp;nbsp;MAPAddr&amp;nbsp;is wrong.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="地址错误.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/80470iE27AD877EC190F12/image-size/large?v=v2&amp;amp;px=999" role="button" title="地址错误.PNG" alt="地址错误.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont konw why MAPAddr is but 0x801200 not 0x401200, it is a wrong result.&lt;/P&gt;&lt;P&gt;How can i get&amp;nbsp;&lt;EM&gt;ADC_tClntUW_CUR'&lt;/EM&gt;s true global address?&lt;/P&gt;&lt;P&gt;Looking forward to your reply.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2019 01:22:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907496#M16466</guid>
      <dc:creator>zff</dc:creator>
      <dc:date>2019-05-10T01:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: __far and s12 global address</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907497#M16467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN data-group="0-0" data-section="0" data-sentence="0"&gt;I had the same problem with operating system migration.&lt;/SPAN&gt;&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;Once the program starts manipulating the BANKED&amp;nbsp;page data, the address is wrong, causing the program to runaway!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;So, it is a critical problem&lt;/SPAN&gt;&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt; for me, which&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;has being stalled me.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2019 01:40:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907497#M16467</guid>
      <dc:creator>zff</dc:creator>
      <dc:date>2019-05-10T01:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: __far and s12 global address</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907498#M16468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. First of all which how big flash is in your device? PPAGE=1 is available only on 256k device. On 128k device the least PPAGE is 8, G64 - 0xC and so on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma CONST_SEG MAP1_ROM&lt;BR /&gt;volatile const EMS_CTRLMAP_TYPE EMS_infoMapS=&lt;BR /&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allocating data&amp;nbsp;outside of&amp;nbsp;CPU native 64k address space, you need to tell compiler how that data should be&amp;nbsp;accessed, you need to specify either __FAR_SEG or __PPAGE_SEG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma CONST_SEG __FAR_SEG MAP1_ROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__FAR_SEG will probably trigger C3803 warning, but it is OK. __PPAGE_SEG will limit your data usage from nonbanked functions only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. It is not clear how Mapaddr or ADC is related to EMS_InfoMap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I&amp;nbsp;had the same problem with operating system migration.&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;Once the program starts manipulating the BANKED&amp;nbsp;page data, the address is wrong, causing the program to runaway!&lt;/SPAN&gt;&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;What do you mean here? How you can manipulate const data in paged memory? Are you reprogramming it? &lt;SPAN data-group="0-1" data-section="0" data-sentence="1"&gt;Do you mean manipulating PPAGE register directly? Well, you can't do it while executing paged routine. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 May 2019 06:06:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907498#M16468</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2019-05-12T06:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: __far and s12 global address</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907499#M16469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Karpicz,&lt;/P&gt;&lt;P&gt;Thanks for your technical support. As for your questions, the following is my answers.&lt;/P&gt;&lt;P&gt;1. The size of Flash of my device is 240kB, I am sure it support PPAGE=0x01~0x0F.&lt;/P&gt;&lt;P&gt;2. I read&amp;nbsp;&lt;EM&gt;AN3784 Understanding the Memory Scheme in the S12(X) Architecture&lt;/EM&gt; yesterday the first time, I find I know too little about keywords&lt;EM&gt; __far&lt;/EM&gt; and&amp;nbsp;&amp;nbsp;__RPAGE_SEG/ __EPAGE_SEG/ __PPAGE_SEG/&amp;nbsp;__GPAGE_SEG. Your suggstion&amp;nbsp;'&lt;EM&gt;#pragma CONST_SEG &lt;STRONG&gt;__FAR_SEG&lt;/STRONG&gt; MAP1_ROM&lt;/EM&gt;' is totally right. I am sorry I&amp;nbsp;make such a low-end mistake and&amp;nbsp;cost you a lot of&amp;nbsp;time.&lt;/P&gt;&lt;P&gt;3. ADC map is s part of&amp;nbsp;EMS_InfoMap, and they are in the same page.&amp;nbsp;&lt;SPAN&gt;EMS_InfoMa&lt;/SPAN&gt;p is at 0x004000(global&amp;nbsp;address),&amp;nbsp;&lt;SPAN&gt;ADC map is at&amp;nbsp;0x004012(global&amp;nbsp;address). They are related by pointer. I think the detail for&amp;nbsp;this&amp;nbsp;answer&amp;nbsp;is not important now, because part2 is the most important.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;4. I&amp;nbsp;give you a too&amp;nbsp;&lt;A _jive_internal="true" href="https://community.nxp.com/?keyword=ambiguous"&gt;ambiguous &lt;/A&gt;&lt;A href="https://community.nxp.com/?keyword="&gt;https://community.nxp.com/?keyword=&lt;/A&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/?keyword=description"&gt;description&lt;/A&gt;&amp;nbsp;about&amp;nbsp;operating system migration, making&amp;nbsp;you too confused.This question is &lt;SPAN data-group="9_9"&gt;far&lt;/SPAN&gt; &lt;SPAN data-group="10_10"&gt;more&lt;/SPAN&gt; &lt;SPAN data-group="11_11"&gt;compl&lt;/SPAN&gt;&lt;SPAN data-group="11_11"&gt;ex, I feel difficult to&amp;nbsp;d&lt;/SPAN&gt;&lt;SPAN data-group="11_11"&gt;escribe it clearly now. After solving other problems, I'll co&lt;/SPAN&gt;&lt;SPAN data-group="11_11"&gt;me back to the issue of OS&amp;nbsp;&lt;/SPAN&gt;transplantation&lt;SPAN data-group="11_11"&gt;. If I still can't transplant effectively, I'll d&lt;SPAN data-group="11_11"&gt;escribe &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN data-group="11_11"&gt;my question more clea&lt;/SPAN&gt;&lt;SPAN data-group="11_11"&gt;rly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'll try your approach, and if there's any further confusion, I'll keep asking questions below this post.&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;Today is Mother's Day.&amp;nbsp;I wish your mother good health and your family happiness(Chinese style blessing).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 May 2019 07:26:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907499#M16469</guid>
      <dc:creator>zff</dc:creator>
      <dc:date>2019-05-12T07:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: __far and s12 global address</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907500#M16470</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;2. Actually you have two ways to tell compiler your data&amp;nbsp;has special, not 16bit address.&amp;nbsp;Keyword like __far in data declaration or round your declaration with proper pragmas. If your data is shared among C files, you need to use the same __far or pragmas in header file so that compiler sees your data declared the same in all C files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Today is Mother's Day.&amp;nbsp;I wish your mother good health and your family happiness(Chinese style blessing).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, but Mother's Day was&amp;nbsp;actually week ago in my country.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2019 06:45:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907500#M16470</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2019-05-13T06:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: __far and s12 global address</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907501#M16471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your suggetions.&lt;/P&gt;&lt;P&gt;I'm trying the solutions you provide.&amp;nbsp;If I make&amp;nbsp;critical progress, I will tell you.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;FU&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2019 13:17:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/far-and-s12-global-address/m-p/907501#M16471</guid>
      <dc:creator>zff</dc:creator>
      <dc:date>2019-05-13T13:17:47Z</dc:date>
    </item>
  </channel>
</rss>

