<?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: How to relocate memory library function using #pragma? in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223201#M8842</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to put lib functions into a specific segment, the possible solution is to add “#pragma CODE_SEG…” to lib source file. see attached lib sample.zip. please compile “mylib” first on your PC, then run “test” to see result.&lt;/P&gt;&lt;P&gt;it;s for 8bit device.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jan 2014 07:35:40 GMT</pubDate>
    <dc:creator>ZhangJennie</dc:creator>
    <dc:date>2014-01-09T07:35:40Z</dc:date>
    <item>
      <title>How to relocate memory library function using #pragma?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223200#M8841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know how to specify the code segment in a source code. But if I am calling a function using a library, how do I specify the location for this function? For example:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;#pragma CODE_SEG myCodeSeg&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;libfunc1(); //libfunc1() is a function in the library myProj.lib which was included in the project&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found that libfunc1() is not located in myCodeSeg. How to force libfunc1() into a code segment I want?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2014 15:20:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223200#M8841</guid>
      <dc:creator>leesp</dc:creator>
      <dc:date>2014-01-08T15:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to relocate memory library function using #pragma?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223201#M8842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to put lib functions into a specific segment, the possible solution is to add “#pragma CODE_SEG…” to lib source file. see attached lib sample.zip. please compile “mylib” first on your PC, then run “test” to see result.&lt;/P&gt;&lt;P&gt;it;s for 8bit device.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 07:35:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223201#M8842</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2014-01-09T07:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to relocate memory library function using #pragma?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223202#M8843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;Hi. &lt;/P&gt;&lt;P&gt;The lib which i want to include is ansiis.lib which comes with Codewarrior.&lt;/P&gt;&lt;P&gt;So that means i have to open up the source codes, add the #pragma, and recompile? What happens if the source codes also call some library?&lt;/P&gt;&lt;P&gt;Is there any other ways? Will #pragma REALLOC_OBJ work?&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 11:11:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223202#M8843</guid>
      <dc:creator>leesp</dc:creator>
      <dc:date>2014-01-09T11:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to relocate memory library function using #pragma?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223203#M8844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we don't encourage user modify ansi lib file.&lt;/P&gt;&lt;P&gt;ansi lib by default is in&amp;nbsp; NON BANKED memory. why do you want to change it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 11:55:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223203#M8844</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2014-01-09T11:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to relocate memory library function using #pragma?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223204#M8845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;Long story.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a huge project (Project A) which has lots of source codes. #pragma CODE_SEG was not used in this project Therefore the linker allocates all the program binaries in DEFAULT_ROM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to incorporate the source code of another project (Project B) into Project A. The requirement is that all the program binaries of Project B should be allocated in an exclusive protected memory area, separated from DEFAULT_ROM. Therefore in Project B source code, I used #pragma CODE_SEG MyProtectSeg so as to put Project B program in MyProtectSeg, away from&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFAULT_ROM. Also, some of the source codes in Project B use functions in ansiis.lib. So:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//ProjectB_source1.c ... #pragma CODE_SEG MyProtectSeg ...//code abc();//abc() uses functions in ansiis.lib ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the problem comes. Functions in ansiis.lib are not affected by the #pragma (at least I don't know how to control the&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;allocation), and therefore these binaries are allocated in DEFAULT_ROM, which violates the requirement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to solve this?&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 04:57:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223204#M8845</guid>
      <dc:creator>leesp</dc:creator>
      <dc:date>2014-01-10T04:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Re: How to relocate memory library function using #pragma?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223205#M8846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First I must declare one thing:&amp;nbsp; all the source codes and functions are automatically added to segment DEAFULT_ROM unless we use “#pragma CODE_SEG&amp;nbsp; MY_SECTION” to change it.&lt;/P&gt;&lt;P&gt;There is no doubt that your lib function has already integrated with your other source code, but all lib functions is still in the DEAFULT_ROM because you never put “#pragma CODE_SEG MY_SECTION ” on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To change the section of the lib function, i usually follow the steps as below:&lt;/P&gt;&lt;OL start="1"&gt;&lt;LI&gt;make sure where your lib function locates in. (consult .map file)&lt;/LI&gt;&lt;LI&gt;ie. The lib function is string.c. Copy string.c and string.h from system directory and paste these files in your current project folder.&lt;/LI&gt;&lt;LI&gt;Open IDE, add these two files in your project.&lt;/LI&gt;&lt;LI&gt;add ” include “string.h”” to the associated files&lt;/LI&gt;&lt;LI&gt;add “#pragma CODE_SEG&amp;nbsp; MY_SECTION” before the lib fuction in string.c&lt;/LI&gt;&lt;LI&gt;Compile the project. Go to .map file and look the result.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to set up an example of this that I am sending as an attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 06:51:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-relocate-memory-library-function-using-pragma/m-p/223205#M8846</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2014-01-10T06:51:39Z</dc:date>
    </item>
  </channel>
</rss>

