<?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: Working with 9S12 RAM Pages in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357951#M6743</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;did you search community for this. I think this was explained several times in the past.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 3 ways on S12X, which you can use to access the same physical RAM: 1) fastest and simplest CPU address space @0x1000..0x3FFF, 2) via R-page 1k window at @0x1000..0x1FFF, 3) using global addressing instructions, G-page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You asked for contiguous 0x1000..0x3FFF and also what about using two R-pages. These two are mutually exclusive. Using contiguous 0x1000..0x3FFF requires keeping RPAGE=0xFD constant. So either you fix RPAGE and edit PRM to enable contiguous 12k, or use paged RAM. To enable contiguous 12k just change PRM as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* non-paged RAM */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = READ_WRITE&amp;nbsp; DATA_NEAR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1000 TO&amp;nbsp;&amp;nbsp; 0x3FFF;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;P&gt;-D__FAR_DATA&amp;nbsp; is required for proper data initialization at startup&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-CpRPAGE=0xFD&lt;/P&gt;&lt;P&gt; CpRPAGE tells compiler to save/restore RPAGE on entry/exit from interrupt. It is the best to not use slower paged RAM from interrupts. But if you need to, then this switch is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In the application file the variabe is declared as follows:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma DATA_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TECNREC ACNPacket;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Stepping through the code a pointer to the variable is loaded with 0x1000 and the application appears to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It "worked" but didn't set up RPAGE. Wouldn't work for multiple R-pages. You told linker to placed ACNPacket in paged RAM, but didn't tell compiler how it should access paged RAM. It seemed working, but didn't set up RPAGE. You need to use __RPAGE_SEG or __GPAGE_SEG to make compiler aware about access method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __RPAGE_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;TECNREC ACNPacket;&lt;/P&gt;&lt;P&gt; #pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use more R-pages, then you need to add -PsegObj to compiler settings or try searching old messages, I wrote about -PsegObj in the past.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Aug 2014 20:56:21 GMT</pubDate>
    <dc:creator>kef2</dc:creator>
    <dc:date>2014-08-14T20:56:21Z</dc:date>
    <item>
      <title>Working with 9S12 RAM Pages</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357950#M6742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd like to be able to have the compiler use the 4K available from 0x1000 to 0x1FFF so that I have contiguous RAM from 0x1000 to 0x3FFF.&amp;nbsp; By default the data sheet says the RPAGE is set to 0xFD.&amp;nbsp; I can also expressly set that.&lt;/P&gt;&lt;P&gt;Is this the right way to tell the C compiler that I have a structure with 640 bytes in 0x1000 to 0x1FFF area?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The linker PLACEMENT section has&lt;/P&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style=""&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style=""&gt;PAGED_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD style=""&gt;/* paged data accessed by CPU12 only */&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style=""&gt;&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; &lt;/TD&gt;&lt;TD style=""&gt;&lt;/TD&gt;&lt;TD style=""&gt;&lt;P&gt; INTO&amp;nbsp; RAM_FD;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;The command line for the C compiler has:&lt;/P&gt;&lt;P&gt;-D__FAR_DATA &lt;/P&gt;&lt;P&gt;Also&lt;/P&gt;&lt;P&gt;-CpRPAGE=0xFD&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the application file the variable is declared as follows:&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;TECNREC ACNPacket;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stepping through the code a pointer to the variable is loaded with 0x1000 and the application appears to work.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing anything?&amp;nbsp; If I want to use two pages of RAM then what?&amp;nbsp; Will the compiler fill in a value for RPAGE?&lt;/P&gt;&lt;P&gt;If I want to access the data in an interrupt routine it's probably best to first save the RPAGE and expressly set it to FD if I use more than one page?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 07:42:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357950#M6742</guid>
      <dc:creator>jcdammeyer</dc:creator>
      <dc:date>2014-08-14T07:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Working with 9S12 RAM Pages</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357951#M6743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;did you search community for this. I think this was explained several times in the past.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 3 ways on S12X, which you can use to access the same physical RAM: 1) fastest and simplest CPU address space @0x1000..0x3FFF, 2) via R-page 1k window at @0x1000..0x1FFF, 3) using global addressing instructions, G-page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You asked for contiguous 0x1000..0x3FFF and also what about using two R-pages. These two are mutually exclusive. Using contiguous 0x1000..0x3FFF requires keeping RPAGE=0xFD constant. So either you fix RPAGE and edit PRM to enable contiguous 12k, or use paged RAM. To enable contiguous 12k just change PRM as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* non-paged RAM */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = READ_WRITE&amp;nbsp; DATA_NEAR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1000 TO&amp;nbsp;&amp;nbsp; 0x3FFF;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;P&gt;-D__FAR_DATA&amp;nbsp; is required for proper data initialization at startup&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-CpRPAGE=0xFD&lt;/P&gt;&lt;P&gt; CpRPAGE tells compiler to save/restore RPAGE on entry/exit from interrupt. It is the best to not use slower paged RAM from interrupts. But if you need to, then this switch is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In the application file the variabe is declared as follows:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma DATA_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TECNREC ACNPacket;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Stepping through the code a pointer to the variable is loaded with 0x1000 and the application appears to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It "worked" but didn't set up RPAGE. Wouldn't work for multiple R-pages. You told linker to placed ACNPacket in paged RAM, but didn't tell compiler how it should access paged RAM. It seemed working, but didn't set up RPAGE. You need to use __RPAGE_SEG or __GPAGE_SEG to make compiler aware about access method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __RPAGE_SEG PAGED_RAM&lt;/P&gt;&lt;P&gt;TECNREC ACNPacket;&lt;/P&gt;&lt;P&gt; #pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use more R-pages, then you need to add -PsegObj to compiler settings or try searching old messages, I wrote about -PsegObj in the past.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 20:56:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357951#M6743</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2014-08-14T20:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Working with 9S12 RAM Pages</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357952#M6744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John.&lt;/P&gt;&lt;P&gt;I think Edward was well-answered the question, if you still can't figure out the problem, please upload your sample code to demonstrate the problem. also mention how to see your problem with your project.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;&lt;P&gt;ZhangJun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 05:35:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Working-with-9S12-RAM-Pages/m-p/357952#M6744</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2014-08-20T05:35:01Z</dc:date>
    </item>
  </channel>
</rss>

