<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SOC banking with mixed ROM and RAM</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/36754/soc-banking-with-mixed-rom-and-ram</link><description> We have an SOC under planning, which have embedded ROM and RAM. The common area address range is (0x0000-0x7ffff), and bank area (0x8000-0xffff). The design goal is to have some utility functions pre-compiled and placed in common area and bank0 of ROM</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: SOC banking with mixed ROM and RAM</title><link>https://community.arm.com/thread/73248?ContentTypeID=1</link><pubDate>Tue, 24 May 2005 10:01:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:798c5aa2-dd25-443f-9962-e7b31c52fc44</guid><dc:creator>Robert Chien</dc:creator><description>&lt;p&gt;Hi Reinehard,&lt;br /&gt;
&lt;br /&gt;
Thanks for you reply. I would like to explain the issue as clear as possible.&lt;br /&gt;
&lt;br /&gt;
Supposing there is function in bank 1, named func_in_b1, in which a function call is made to call a function in bank2, named func_in_b2. As below.&lt;br /&gt;
&lt;br /&gt;
void func_in_b1() // a function in bank 1&lt;br /&gt;
{&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    a=func_in_b2(...); // a&lt;br /&gt;
    ...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The compiled assembly code for the function call will be like in the way below.&lt;br /&gt;
&lt;br /&gt;
void func_in_b1() // a function in bank 1&lt;br /&gt;
{&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    a=func_in_b2(...); // a&lt;br /&gt;
      ; push parameters into stack&lt;br /&gt;
      ; LCALL &amp;quot;cross_bank_func_call_table_entry in common area&amp;quot;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;cross_bank_func_call_table_entry&amp;quot; for this call will be in the way below&lt;br /&gt;
&lt;br /&gt;
   ; MOV DPTR, #func_in_b2&lt;br /&gt;
   ; AJMP B_BANK2&lt;br /&gt;
&lt;br /&gt;
In this way Keil C generates a very good and clean way for cross bank function call. Any other functions in all other banks can call the entry to do a cross-bank function call.&lt;br /&gt;
&lt;br /&gt;
I would say Keil C does handlse cross bank function call in a very nice way.&lt;br /&gt;
&lt;br /&gt;
Conditions for my case, however, does not get benefits for this nice way.&lt;br /&gt;
For my case, the common area and bank0 will be fixed as ROM code to lower the chip cost. My customers then will develop their applications in bank 1 and 2, calling functions in the common area. Problem arises that function calls in-between bank 1 and 2 can not be compiled because the common area is already hard coded as ROM. I found a way, which is a sligh alternation to the Keil C compiler way, will work for my case. As below&lt;br /&gt;
&lt;br /&gt;
void func_in_b1() // a function in bank 1&lt;br /&gt;
{&lt;br /&gt;
    ...&lt;br /&gt;
    ...&lt;br /&gt;
    a=func_in_b2(...); // a&lt;br /&gt;
      ; push parameters into stack&lt;br /&gt;
      ; MOV DPTR, #func_in_b2&lt;br /&gt;
      ; LCALL B_BANK2&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
In this way, the cross bank function call is distributed with each call instead of collected in the common area. This is not so clean, but it works for my case.And I think it a good way for anyone who has fixed common area.&lt;br /&gt;
&lt;br /&gt;
Hope this is clear, and thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SOC banking with mixed ROM and RAM</title><link>https://community.arm.com/thread/44061?ContentTypeID=1</link><pubDate>Tue, 24 May 2005 08:43:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e34f9a22-d52d-442d-b9bb-3de7e5e6e946</guid><dc:creator>Keil Software Support Intl.</dc:creator><description>&lt;p&gt;Sorry, I do not understand this problem.  The common area is copied automatically into each bank when the physical common area is not big enough.&lt;br /&gt;
&lt;br /&gt;
See: &lt;a href="http://www.keil.com/support/man/docs/lx51/lx51_bk_commonarea.htm"&gt;http://www.keil.com/support/man/docs/lx51/lx51_bk_commonarea.htm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Reinhard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>