<?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 @modifier for addressing in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/modifier-for-addressing/m-p/510063#M12431</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have question about absolute addressing using @&lt;/P&gt;&lt;P&gt;For example if i write a code with some address 0xE08456. I am assuming ppage = 0xE0 and local address 0x8456.&lt;/P&gt;&lt;P&gt;const data@0xE08456 = 10; Now my doubt is how compiler knows that the address 0xE08456 is logical address and not global address. Also the controller gives 16 bits then how it incorporates the address 0xE08456 which is more than 16 bits. Is it the correct way of declaring?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Mar 2016 11:25:14 GMT</pubDate>
    <dc:creator>rahulkrishna</dc:creator>
    <dc:date>2016-03-29T11:25:14Z</dc:date>
    <item>
      <title>@modifier for addressing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/modifier-for-addressing/m-p/510063#M12431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have question about absolute addressing using @&lt;/P&gt;&lt;P&gt;For example if i write a code with some address 0xE08456. I am assuming ppage = 0xE0 and local address 0x8456.&lt;/P&gt;&lt;P&gt;const data@0xE08456 = 10; Now my doubt is how compiler knows that the address 0xE08456 is logical address and not global address. Also the controller gives 16 bits then how it incorporates the address 0xE08456 which is more than 16 bits. Is it the correct way of declaring?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 11:25:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/modifier-for-addressing/m-p/510063#M12431</guid>
      <dc:creator>rahulkrishna</dc:creator>
      <dc:date>2016-03-29T11:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: @modifier for addressing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/modifier-for-addressing/m-p/510064#M12432</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;Unfortunately, I didn’t found a way how to convince linker for accepting global addresses by @ modifier yet.&lt;/P&gt;&lt;P&gt;So, I suppose that the linker expects only logical addresses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However placing by global addresses is still possible and we could use #pragmas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used S12XEP100 and modified prm file:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp; I rewrote addresses to global format. For example:&lt;/P&gt;&lt;PRE class="jive_macro_code _jivemacro_uid_14592607562925386 jive_text_macro" data-renderedposition="190_8_1192_16"&gt;&lt;P&gt;PAGE_C0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = READ_ONLY&amp;nbsp; DATA_FAR IBCC_FAR&amp;nbsp; 0x700000'G TO 0x703FFF'G;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;2.&amp;nbsp;&amp;nbsp;&amp;nbsp; I commented out PAGE_C0 from DEFAULT_ROM. For example:&lt;/P&gt;&lt;PRE class="_jivemacro_uid_14592607641261458 jive_macro_code jive_text_macro" data-renderedposition="232_8_1192_16"&gt;&lt;P&gt;DEFAULT_ROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PAGE_FE,&amp;nbsp; … , PAGE_C1; //, PAGE_C0;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;3.&amp;nbsp;&amp;nbsp;&amp;nbsp; I created user segment. For example:&lt;/P&gt;&lt;PRE class="_jivemacro_uid_14592607698282376 jive_macro_code jive_text_macro" data-renderedposition="274_8_1192_16"&gt;&lt;P&gt;MY_GLOBAL_FLASH&amp;nbsp; INTO&amp;nbsp; PAGE_C0;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;4.&amp;nbsp;&amp;nbsp;&amp;nbsp; I do not reference my constant, therefore, I placed their name into entries. For example:&lt;/P&gt;&lt;PRE class="jive_macro_code _jivemacro_uid_14592607761778611 jive_text_macro" data-renderedposition="316_8_1192_48"&gt;&lt;P&gt;ENTRIES /* keep the following unreferenced variables */&lt;/P&gt;&lt;P&gt;&amp;nbsp; my_const&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I defined my constant in main.c file:&lt;/P&gt;&lt;PRE class="jive_macro_code _jivemacro_uid_14592607895762469 jive_text_macro" data-renderedposition="416_8_1192_48"&gt;&lt;P&gt;#pragma CONST_SEG MY_GLOBAL_FLASH&lt;/P&gt;&lt;P&gt;volatile const unsigned char my_const = 0xAA;&lt;/P&gt;&lt;P&gt;#pragma CONST_SEG DEFAULT&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Since we used global addresses, we are not limited by pages and this approach could be simply used for variables/constants which are bigger than the single page size.&lt;/P&gt;&lt;P&gt;Note: we could additionally use pragma modifiers for driving access to constant/variables in our user segment. For example:&lt;/P&gt;&lt;P&gt;#pragma CONST_SEG&amp;nbsp; __GPAGE_SEG&amp;nbsp; MY_GLOBAL_FLASH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;RadekS&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, 29 Mar 2016 14:14:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/modifier-for-addressing/m-p/510064#M12432</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2016-03-29T14:14:10Z</dc:date>
    </item>
  </channel>
</rss>

