<?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: Example code for banked memory model in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141581#M2722</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;Thanks for your answer.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For example I have the function Test_Func. How do I have to declare this function that this function will be linked into the non banked section?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;prototype */&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;function code&amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;P&gt;Is the above declaration right or do I also have to use #pragma?&lt;/P&gt;&lt;DIV&gt;/*&amp;nbsp;prototype */&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;function code&amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;#pragma CODE_SEG __NEAR_SEG NON_BANKED&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;#pragma CODE_SEG DEFAULT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I´m sorry for my (stupid) questions - I´m a newbie in programming CodeWarrior.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Many&amp;nbsp;thanks!&lt;/DIV&gt;&lt;DIV&gt;Thomas&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Jul 2006 21:14:26 GMT</pubDate>
    <dc:creator>ThomasH</dc:creator>
    <dc:date>2006-07-03T21:14:26Z</dc:date>
    <item>
      <title>Example code for banked memory model</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141579#M2720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Where can I find example code or documents about programming in banked memory model? How do I have to declare functions,..... I can´t find any examples in the compiler documentation.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks!&lt;/DIV&gt;&lt;DIV&gt;Thomas&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 16:27:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141579#M2720</guid>
      <dc:creator>ThomasH</dc:creator>
      <dc:date>2006-06-30T16:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Example code for banked memory model</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141580#M2721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;There is nothing special to do in respect of function definition when you are building in BANKED memory model.&lt;/P&gt;&lt;P&gt;Just rebuild everything with -Mb and the compiler will care about invoking the function with CALL instead of JSR.&lt;/P&gt;&lt;P&gt;Only think you have to really take care of is you HAVE TO place your interrupt function in NON BANKED flash. Entry within the vector table are 16-bit wide. So you need to make sure interrupt functions are placed in NON-BANKED memory.&lt;/P&gt;&lt;P&gt;I am usually recommending to define the interrupt function in the section NON_BANKED as follows:&lt;/P&gt;&lt;P&gt;#ifndef __SMALL__&lt;BR /&gt;#pragma CODE_SEG __NEAR_SEG NON_BANKED&lt;BR /&gt;#endif&lt;BR /&gt;interrupt void INCcount(void) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Insert Code here */&lt;BR /&gt;}&lt;BR /&gt;#ifndef __SMALL__&lt;BR /&gt;#pragma CODE_SEG DEFAULT&lt;BR /&gt;#endif&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jun 2006 17:58:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141580#M2721</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-06-30T17:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Example code for banked memory model</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141581#M2722</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;Thanks for your answer.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For example I have the function Test_Func. How do I have to declare this function that this function will be linked into the non banked section?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;prototype */&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;function code&amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;P&gt;Is the above declaration right or do I also have to use #pragma?&lt;/P&gt;&lt;DIV&gt;/*&amp;nbsp;prototype */&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;function code&amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;#pragma CODE_SEG __NEAR_SEG NON_BANKED&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;#pragma CODE_SEG DEFAULT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I´m sorry for my (stupid) questions - I´m a newbie in programming CodeWarrior.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Many&amp;nbsp;thanks!&lt;/DIV&gt;&lt;DIV&gt;Thomas&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Jul 2006 21:14:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141581#M2722</guid>
      <dc:creator>ThomasH</dc:creator>
      <dc:date>2006-07-03T21:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Example code for banked memory model</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141582#M2723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;DIV&gt;Function should be declared as __near function as follows&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;prototype */&lt;/DIV&gt;&lt;DIV&gt;void __near Test_Func(void);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It should be defined in segment NON_BANKED as follows:&lt;/DIV&gt;&lt;DIV&gt;/*&amp;nbsp;function code&amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;#pragma CODE_SEG __NEAR_SEG NON_BANKED&lt;/DIV&gt;&lt;DIV&gt;void Test_Func(void)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; ....&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;#pragma CODE_SEG DEFAULT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That should be fine&lt;/DIV&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jul 2006 00:31:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Example-code-for-banked-memory-model/m-p/141582#M2723</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-07-04T00:31:46Z</dc:date>
    </item>
  </channel>
</rss>

