<?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: How do I call normal functions with page memory</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079987#M17323</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL style="color: #2e3033; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;First of all, thank you very much for your answer.&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;I am currently at the entry level. I have&amp;nbsp;No 9S12XEP100 development experience.I read the instructions in some of the chip manuals and looked them up on the Internet.My project USES large arrays(2K or 4K), so I'm using paged memory. I&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;added command “-D__FAR_DATA” and&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;my Project.prm:&lt;/P&gt;&lt;P style="border: 0px;"&gt;PAGED_RAM_SCIBUFF1 INTO&amp;nbsp; RAM_F1;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;#pragma DATA_SEG __GPAGE_SEG PAGED_RAM_SCIBUFF1&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;unsigned char Buffer_SCI_Receive[2048] = {0};&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;#pragma DATA_SEG DEFAULT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f7f8fa; color: #333333; font-weight: normal; font-size: 14px; "&gt;I'm even a little skeptical right now that I'm using paging memory correctly.&lt;/SPAN&gt;But it seems to be working.Because,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my Project.map:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Section Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Size&amp;nbsp; Type&amp;nbsp; &amp;nbsp; &amp;nbsp;From&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;To&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Segment&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;PAGED_RAM_SCIBUFF1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2048&amp;nbsp; &amp;nbsp;R/W&amp;nbsp; &amp;nbsp;0xF11000&amp;nbsp; &amp;nbsp;0xF117FF&amp;nbsp; &amp;nbsp;RAM_F1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I define my own function, I'll use&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;unsigned char * __far,&amp;nbsp;&lt;/SPAN&gt;Because I know I'm going to use the global address pointer.But if I call some function that somebody else wrote like Fun(&lt;SPAN style="background-color: #ffffff;"&gt;unsigned char * buf&lt;/SPAN&gt;) or some library function just like: memcpy(&lt;SPAN style="color: #333333; background-color: #ffffff; text-indent: 28px; font-size: 14px;"&gt;void *destin, void *source, unsigned int size&lt;/SPAN&gt;);(&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 12px;"&gt;&amp;lt;string.h&amp;gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;There will be problems.&lt;/SPAN&gt;It's almost impossible for me to change a lot of other people's code from&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;unsigned char *&lt;SPAN&gt;&amp;nbsp; to&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;unsigned char * __far.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;So I wonder if there's a switch o&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;r some configuration,&lt;/SPAN&gt;So I can call other functions directly.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;I'm looking for a solution.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jul 2020 01:02:46 GMT</pubDate>
    <dc:creator>cornonly</dc:creator>
    <dc:date>2020-07-24T01:02:46Z</dc:date>
    <item>
      <title>How do I call normal functions with page memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079985#M17321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;my Project.prm:&lt;/P&gt;&lt;P&gt;PAGED_RAM_SCIBUFF1 INTO&amp;nbsp; RAM_F1;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my SCI.c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma DATA_SEG __GPAGE_SEG PAGED_RAM_SCIBUFF1&lt;BR /&gt;unsigned char Buffer_SCI_Receive[2048] = {0};&lt;BR /&gt;#pragma DATA_SEG DEFAULT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if I want to use a function, the function :&lt;/P&gt;&lt;P&gt;Fun(unsigned char * __far buf);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;I can use it this way :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;Fun(&lt;SPAN style="color: #3d3d3d;"&gt;Buffer_SCI_Receive&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;but,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;if I use some else&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;&amp;nbsp;.c file ,&amp;nbsp;&lt;/SPAN&gt;Maybe it's from a colleague or&amp;nbsp;Maybe it was downloaded from the Internet.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;Their function most is FUN1&lt;SPAN style="color: #3d3d3d;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d;"&gt;unsigned char * buf);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't just use it like that :&amp;nbsp;&lt;SPAN style="color: #666666; background-color: #ffffff;"&gt;FUN1(&lt;SPAN style="color: #3d3d3d;"&gt;Buffer_SCI_Receive&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff;"&gt;it will&amp;nbsp;&lt;SPAN style="font-weight: normal; font-size: 14px;"&gt;Pointer to the loss.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #666666; font-weight: normal; font-size: 14px; "&gt;How do I use it.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2020 08:04:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079985#M17321</guid>
      <dc:creator>cornonly</dc:creator>
      <dc:date>2020-07-23T08:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call normal functions with page memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079986#M17322</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;I hope I will not confuse you a lot because the topic is "a little bit" complex.&lt;/P&gt;&lt;P&gt;If I understand you well then I am not sure you correctly understand pointer (memory addressing) possibilities. C language is high level and it is good to step short test codes via asm instructions to see what the compiler uses and how the accesses are processed.&lt;/P&gt;&lt;P&gt;The RAM memory can by addressed by:&lt;/P&gt;&lt;UL&gt;&lt;LI style="text-indent: -18.0pt;"&gt;Near pointer (no page is necessary, direct space, 16 bit address is used)&lt;/LI&gt;&lt;LI style="text-indent: -18.0pt;"&gt;Far pointer in global memory space (GLD,GST,…global asm instructions are used with 24bit global address from global address space )&lt;/LI&gt;&lt;LI style="text-indent: -18.0pt;"&gt;Far pointer in RPAGE paged memory space(local space) (The address from window 1000-1FFF is used together with RPAGE register setup )&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Some of the spaces are addressable with all three options, see attached file for XEP100 or XDP512 device.&lt;/P&gt;&lt;P&gt;So, it is not possible to use pointer of different types as a parameter of the function. Each address space has its own principle of an access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, there is a possibility to combine near space with local space when we create 24bit pointer and use common addressing as to local space.&lt;/P&gt;&lt;P&gt;0x004000 is the same as 0x4000 and will be processed as a near address access (RPAGE has no meaning because internal mechanizm recognizes access to near space)&lt;/P&gt;&lt;P&gt;0xFC1000 will set RPAGE=0xFC because access to a RAM memory window is recognized.&lt;/P&gt;&lt;P&gt;(both lines access the same address as you can see in the attached memory map)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But,….the same address in a global address space is 0x0FC000 and global address access instructions are used by compiler.&lt;/P&gt;&lt;P&gt;Because of this, if you create some code with other programmers then you have to define joint point. Or, there is possibility to set agreement that all shared data will be placed in near memory space (2000~5FFF) or the same space but linearly ordered to 4000~7FFF if RAMHM=1 and ROMHM=1. (16kB should be enough if you also reorder data from access and importance point of view)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is also another solution where you can pass the pointer as a number and then inside the function process it on the basis of used address or convert incoming address to suitable (one of them selected for addressing) for next data processing.&lt;/P&gt;&lt;P&gt;(In order to avoid redundant issues I suggest to use near space as described above.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover; If you use far data then do not forget to add to compiler command line command “-D__FAR_DATA” (Alt F7-&amp;gt; Compiler for HCS12) because of possible issues described in the file start12.c on the top.&lt;/P&gt;&lt;P&gt;A simple example code is also attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2020 15:22:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079986#M17322</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2020-07-23T15:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call normal functions with page memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079987#M17323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL style="color: #2e3033; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;First of all, thank you very much for your answer.&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;I am currently at the entry level. I have&amp;nbsp;No 9S12XEP100 development experience.I read the instructions in some of the chip manuals and looked them up on the Internet.My project USES large arrays(2K or 4K), so I'm using paged memory. I&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;added command “-D__FAR_DATA” and&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;my Project.prm:&lt;/P&gt;&lt;P style="border: 0px;"&gt;PAGED_RAM_SCIBUFF1 INTO&amp;nbsp; RAM_F1;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;#pragma DATA_SEG __GPAGE_SEG PAGED_RAM_SCIBUFF1&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;unsigned char Buffer_SCI_Receive[2048] = {0};&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;#pragma DATA_SEG DEFAULT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f7f8fa; color: #333333; font-weight: normal; font-size: 14px; "&gt;I'm even a little skeptical right now that I'm using paging memory correctly.&lt;/SPAN&gt;But it seems to be working.Because,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my Project.map:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Section Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Size&amp;nbsp; Type&amp;nbsp; &amp;nbsp; &amp;nbsp;From&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;To&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Segment&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;PAGED_RAM_SCIBUFF1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2048&amp;nbsp; &amp;nbsp;R/W&amp;nbsp; &amp;nbsp;0xF11000&amp;nbsp; &amp;nbsp;0xF117FF&amp;nbsp; &amp;nbsp;RAM_F1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I define my own function, I'll use&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;unsigned char * __far,&amp;nbsp;&lt;/SPAN&gt;Because I know I'm going to use the global address pointer.But if I call some function that somebody else wrote like Fun(&lt;SPAN style="background-color: #ffffff;"&gt;unsigned char * buf&lt;/SPAN&gt;) or some library function just like: memcpy(&lt;SPAN style="color: #333333; background-color: #ffffff; text-indent: 28px; font-size: 14px;"&gt;void *destin, void *source, unsigned int size&lt;/SPAN&gt;);(&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 12px;"&gt;&amp;lt;string.h&amp;gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;There will be problems.&lt;/SPAN&gt;It's almost impossible for me to change a lot of other people's code from&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;unsigned char *&lt;SPAN&gt;&amp;nbsp; to&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;unsigned char * __far.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;So I wonder if there's a switch o&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;r some configuration,&lt;/SPAN&gt;So I can call other functions directly.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;I'm looking for a solution.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2020 01:02:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079987#M17323</guid>
      <dc:creator>cornonly</dc:creator>
      <dc:date>2020-07-24T01:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call normal functions with page memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079988#M17324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;BR /&gt;You have not mentioned the MCU you use but I suppose some of the derivative of S12XE family. If your colleagues have made functions with a near pointers and you use far space which has no near address alternative then compatibility is not possible. Of course, there are ideas for workarounds you could use but must be tested for each function to be sure there is no problem with it. However, this approach can cause issues in the future when the logic is forgotten and changes should be made or when person who does not know the application logic should add own code into it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Workaround/Adjustment 1.&lt;BR /&gt;Rebuild all user function to *far input parameter and then adjust all processes in the function to this pointer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Workaround/Adjustment 2.&lt;BR /&gt;Redefine each user function to contain two parameters RPAGE and near offset. (The is a condition the varable/string/ array is not allowed to go through more pages because RPAGE is not automatically incremented/decremented with offset overflow/underflow)&lt;BR /&gt;At the beginning of the function set RPAGE and the addrssing will be OK becaus internal mechanizm uses addressing mode on the basis of offset (window) address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Workaroud/Adjustment 3.&lt;BR /&gt;Leave everything as it is just before function call with a near pointer as a parameter set the RPAGE to required value and then call the function with the offset value only. It must be ensured that nothing will change (some interrupt) the RPAGE value while function is not finished.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I wrote, these are the ideas only and each of then reguires some access to original routine. And, which of them is the most suitable and the least dangerous. Hard to answer. It depend on thongs you do and you requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Aug 2020 17:53:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079988#M17324</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2020-08-02T17:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call normal functions with page memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079989#M17325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL style="color: #2e3033; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;First of all, thank you very much for your words&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #4a90e2; font-size: 14px;"&gt;I have been waiting for your answer these days.&lt;SPAN style="color: #333333; background-color: #f7f8fa; font-weight: normal;"&gt;The MCU I am using is S12XEP100.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #666666;"&gt;These days I'm also searching for solutions to the problem.As you said，&lt;SPAN style="color: #333333; background-color: #f7f8fa; font-weight: normal;"&gt;If your colleagues create functions using near Pointers, and you use far Spaces with no near address replacement, compatibility will not be achieved.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #666666;"&gt;I used to use STM32 chip more,&lt;SPAN style="background-color: #ffffff; font-weight: normal;"&gt;It doesn't have that problem.&lt;SPAN style="color: #333333; background-color: #f7f8fa; font-weight: normal;"&gt;I understand the way I choose to define a variable to a segment and write my own function to call.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #666666;"&gt;Sometimes I want to use some open source library functions.&lt;/P&gt;&lt;P class="" data-group="1-1"&gt;For example, I use the FATFS file system.&lt;/P&gt;&lt;P class="" data-group="1-1" style="color: #666666; margin: 0px;"&gt;All of their interface functions are fun(unsigned char * ),&lt;SPAN style="color: #333333; background-color: #f7f8fa; font-weight: normal;"&gt;This means I can't use FATFS directly if I don't have enough non-paging memory space&amp;nbsp;&lt;SPAN style="font-weight: normal;"&gt;unless I need to change each function to&amp;nbsp;&lt;SPAN style="color: #666666; background-color: #f7f8fa;"&gt;(unsigned char * __far),&lt;SPAN style="background-color: #ffffff; font-weight: normal;"&gt;It's almost impossible.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Because there are too many function (unsigned char *) calls.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;UL style="color: #2e3033; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;P class="" data-group="1-1" style="color: #666666; font-size: 14px;"&gt;On the other hand, if I use the RTOS,&lt;/P&gt;&lt;P class="" data-group="1-1"&gt;The task stack size appears to be directly used by non-paging memory,&lt;/P&gt;&lt;UL style="background-color: #f7f8fa; font-weight: normal;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;P class="" data-group="1-1" style="color: #666666;"&gt;Because their interface function is (unsigned char * or void *).&amp;nbsp;&lt;SPAN style="color: #333333; background-color: #f7f8fa; font-weight: normal;"&gt;As a result, the task stack size is limited and USES more non-paged memory, leaving less non-paged memory.&lt;/SPAN&gt;There is almost no room to use FATFS anymore.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN class="" data-group="0-0" style="color: #333333; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;At present, I am still very troubled and have not found a good solution.&lt;/SPAN&gt;&lt;SPAN class="" data-group="0-1" style="color: #333333; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;I now understand the reasons for and use of paged memory and flash memory.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;Currently, some external functions use almost all non-paged memory, as they may be based on some 32-bit microcontrollers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL style="color: #2e3033; font-weight: normal;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;P class="" data-group="1-1" style="color: #666666;"&gt;I hope you can provide some ideas.&lt;/P&gt;&lt;/LI&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;SPAN style="color: #666666; background-color: #ffffff; font-weight: normal; font-size: 14px;"&gt;Thank you very much again!&lt;/SPAN&gt;&lt;P class="" data-group="1-1"&gt;Best regards!&lt;/P&gt;&lt;/LI&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;UL style="color: #2e3033; background-color: #f7f8fa; font-weight: normal; font-size: 14px;"&gt;&lt;LI style="margin: 0px 0px 10px;"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2020 01:12:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079989#M17325</guid>
      <dc:creator>cornonly</dc:creator>
      <dc:date>2020-08-03T01:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I call normal functions with page memory</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079990#M17326</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 one more idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of placing the array into page space place it into global space.&lt;/P&gt;&lt;P&gt;For example global space for large array in RPAGE space F1 and F2 can be defined linearly by global space&lt;/P&gt;&lt;P&gt;&amp;nbsp;MY_GLOBAL_RAM = READ_WRITE&amp;nbsp; DATA_FAR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0F1000'G TO 0x0F2FFF'G; //&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course remove it from paged space definitions.&lt;/P&gt;&lt;P&gt;Moreover, rebuilt the project to a LARGE memory model. In this case all pointers will be paged and access to the variables will be FAR and assembler instructions global store and global load will be used for access.&lt;/P&gt;&lt;P&gt;(Note that in the SMALL and LARGE memory model the default access to variables is near and variables with a far access must be explicitly defined.)&lt;/P&gt;&lt;P&gt;However, it would be good to test each function whether there is no exception or some hidden feature.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2020 15:03:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/How-do-I-call-normal-functions-with-page-memory/m-p/1079990#M17326</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2020-08-11T15:03:23Z</dc:date>
    </item>
  </channel>
</rss>

