<?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: using external memory in interrupt routines with char pointer in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203636#M7776</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yes, that's right. I'm using far pointer.&lt;BR /&gt;Using "-CpGPAGE=0x10" Doesn't seem to have any effects.&lt;BR /&gt;I was using "#pragma TRAP_PROC SAVE_ALL_REGS" instead.&lt;BR /&gt;But all this has no effect on this behaviour. Only every second byte is written. When i'm using the debugger i can clearly see that the external ram was accessed, but only every second byte.&lt;BR /&gt;&lt;BR /&gt;I think outside the interrupt routine the compiler is saving the lower/higher byte while accessing the 16 bit RAM 8-Bit byte-wise...&lt;BR /&gt;&lt;BR /&gt;btw can somebody explain to me what "_STORE_FAR_8" in datapage.c is doing ? Has this to do with this ?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Mar 2008 14:51:00 GMT</pubDate>
    <dc:creator>jkampmann</dc:creator>
    <dc:date>2008-03-18T14:51:00Z</dc:date>
    <item>
      <title>using external memory in interrupt routines with char pointer</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203634#M7774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;I have some problems using external memory (0x200000'G-0x27FFFF'G, 16 Bit) within my interrupt routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It is not possible to write with a char pointer to the external memory. Only every second byte (odd addresses) ist written. Writing to external memory using an int pointer works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Character pointers outside from the interrupt routine are working fine, too..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there an easy way to use character pointers within a interrupt routine ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by jkampmann on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-03-17&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;01:43 PM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by jkampmann on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-03-17&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;01:43 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 20:28:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203634#M7774</guid>
      <dc:creator>jkampmann</dc:creator>
      <dc:date>2008-03-17T20:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: using external memory in interrupt routines with char pointer</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203635#M7775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I assume you are using far pointers in your interrupts. Am i right?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;There is one thing you need to know when it goes around using far pointers within interrupt functions.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The GPAGE register is not saved per default in the interrupt function entry code and restored in the exit code.&lt;/DIV&gt;&lt;DIV&gt;In order to tell the compiler it should save/restore the GPAGE register in interrupt entry/exit code you need to build with option -CpGPAGE=0x10.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Note:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; If you are using __rptr you need to build with -CpRPAGE=0x16&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; If you are using __eptr you need to build with -CpEPAGE=0x36&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I hope that helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 22:46:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203635#M7775</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2008-03-17T22:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: using external memory in interrupt routines with char pointer</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203636#M7776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yes, that's right. I'm using far pointer.&lt;BR /&gt;Using "-CpGPAGE=0x10" Doesn't seem to have any effects.&lt;BR /&gt;I was using "#pragma TRAP_PROC SAVE_ALL_REGS" instead.&lt;BR /&gt;But all this has no effect on this behaviour. Only every second byte is written. When i'm using the debugger i can clearly see that the external ram was accessed, but only every second byte.&lt;BR /&gt;&lt;BR /&gt;I think outside the interrupt routine the compiler is saving the lower/higher byte while accessing the 16 bit RAM 8-Bit byte-wise...&lt;BR /&gt;&lt;BR /&gt;btw can somebody explain to me what "_STORE_FAR_8" in datapage.c is doing ? Has this to do with this ?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2008 14:51:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203636#M7776</guid>
      <dc:creator>jkampmann</dc:creator>
      <dc:date>2008-03-18T14:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: using external memory in interrupt routines with char pointer</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203637#M7777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;jkampmann wrote:&lt;BR /&gt;Yes, that's right. I'm using far pointer.&lt;BR /&gt;Using "-CpGPAGE=0x10" Doesn't seem to have any effects.&lt;BR /&gt;I was using "#pragma TRAP_PROC SAVE_ALL_REGS" instead.&lt;BR /&gt;But all this has no effect on this behaviour. Only every second byte is written. When i'm using the debugger i can clearly see that the external ram was accessed, but only every second byte.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;Can you show this code? Does the compiler do 16 bit access for every 2 byte address update?&lt;BR /&gt;Is this issue about the external RAM being accessed with a 16 bit bus with only 8 bit connected?&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;I think outside the interrupt routine the compiler is saving the lower/higher byte while accessing the 16 bit RAM 8-Bit byte-wise...&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;I don't think the compiler does this intentionally. The use pattern of the code may&amp;nbsp; be different for the two uses and that may cause the different code seen.&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;btw can somebody explain to me what "_STORE_FAR_8" in datapage.c is doing ? Has this to do with this ?&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;Hmmm. This question is a bit unexpected. Basically the _STORE_FAR_8 routine is not used when generating code for the S12X, only when generating code for the S12. Does your code use _STORE_FAR_8?&lt;BR /&gt;While S12 code can run on a S12X, this wont take advantage of many of the S12X added features,&lt;BR /&gt;and also the _STORE_FAR_8 is not adapted to the S12X.&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Daniel&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2008 20:56:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/using-external-memory-in-interrupt-routines-with-char-pointer/m-p/203637#M7777</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-03-18T20:56:01Z</dc:date>
    </item>
  </channel>
</rss>

