<?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>LX51 RESERVE directive</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/19016/lx51-reserve-directive</link><description> I have a &amp;quot;classic&amp;quot; bank-switched project using LX51 that needs to reserve some address ranges to prevent code from being assigned to those areas. I have a linker directive thus: 
 
RESERVE (0xf000-0xffff,0x1fff8-0x1ffff) 
 
yet the linker will happily</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: LX51 RESERVE directive</title><link>https://community.arm.com/thread/97290?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2005 12:05:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d6aae43c-b86a-4f39-a196-424a1d56617d</guid><dc:creator>Keil Software Support Intl.</dc:creator><description>&lt;p&gt;RESERVE (B0:0xf000-B0:0xffff) is just fine.&lt;br /&gt;
&lt;br /&gt;
Reinhard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LX51 RESERVE directive</title><link>https://community.arm.com/thread/87295?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2005 11:45:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:47702bed-f7ae-458a-9b7f-7299ee2959e0</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;Thanks for the help on the syntax for RESERVE.  Is the high order bit necessary?  That is, RESERVE (B0:0x80f000-0x80ffff) rather than RESERVE (B0:0xf000-B0:0xffff)?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;If the ROM area that is dedicated as common area is not large enough to contain the entire common code, the linker duplicates the remaining part of the common code area into the beginning of each code bank.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The behavior that I saw was the the &lt;i&gt;high&lt;/i&gt; end of the bank area would contain common bank code.  That is, common would range from 0 - 7fff, then there would be bank code from 8000 - e900 (say), and then there would be more common code from e900 up.  This behavior was with the &amp;quot;Off-Chip Code Memory&amp;quot; in uVision set to 0 - 0xffff, which apparently translates to a CLASSES (CODE()) directive to the linker.  Restricting the range to 0 - 0x7fff solves the problem.  I assumed this was just misconfiguration on my part.  (But maybe discrepancies between CODE and BANKAREA rate a warning?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LX51 RESERVE directive</title><link>https://community.arm.com/thread/44329?ContentTypeID=1</link><pubDate>Sat, 16 Jul 2005 16:56:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5e265972-4dd3-4b91-a0be-2de96a7e78b6</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;You need to include the bank prefix with the addresses.  For example,&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
LX51 ... RESERVE(B0:0X808000-B0:0X808FFF,
                 B1:0X818000-B1:0X818FFF,
                 C:0X200-C:0X2FF)
&lt;/pre&gt;
&lt;br /&gt;
results in the following memory map (from the linker):&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
* * * * * * * * * * *   C O D E   M E M O R Y   * * * * * * * * * * * * *

***   CODE BANK 0   ***
&lt;b&gt;808000H   808FFFH   001000H   ---    ---      *** RESERVED MEMORY ***&lt;/b&gt;
009000H   00901BH   00001CH   BYTE   UNIT     CODE/B0        ?PR?FUNC0?C_BANK0

***   CODE BANK 1   ***
&lt;b&gt;818000H   818FFFH   001000H   ---    ---      *** RESERVED MEMORY ***&lt;/b&gt;
009000H   00901BH   00001CH   BYTE   UNIT     CODE/B1        ?PR?FUNC1?C_BANK1

***   CODE BANK 2   ***
008000H   008018H   000019H   BYTE   UNIT     CODE/B2        ?PR?FUNC2?C_BANK2

***   COMMON AREA   ***
000000H   000002H   000003H   ---    OFFS..   CODE           ?CO??C_STARTUP?0
000003H   000063H   000061H   BYTE   INBLOCK  CODE           ?BANK?SELECT
000064H   0000F1H   00008EH   BYTE   UNIT     CODE           ?C?LIB_CODE
0000F2H   00017DH   00008CH   BYTE   UNIT     CODE           ?C_C51STARTUP
00017EH   0001E5H   000068H   BYTE   UNIT     CODE           ?CO?C_ROOT
0001E6H   0001EDH   000008H   BYTE   UNIT     CODE           ?C_INITSEG
0001EEH   0001FFH   000012H   ---    ---      **GAP**
&lt;b&gt;000200H   0002FFH   000100H   ---    ---      *** RESERVED MEMORY ***&lt;/b&gt;
000300H   00065BH   00035CH   BYTE   UNIT     CODE           ?PR?PRINTF?PRINTF
00065CH   0006A1H   000046H   BYTE   UNIT     CODE           ?CO?C_BANK1
0006A2H   0006E7H   000046H   BYTE   UNIT     CODE           ?CO?C_BANK0
&lt;/pre&gt;
&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
I&amp;#39;ve found in the past that if CODE is allowed to grow beyond 0x7fff, then code that should be limited to the common bank (0 - 0x7fff) can be located in the high end of the bank area (0x8000 - 0xffff) if such space happens to be unused by the code for that bank. That layout is bugged, since there&amp;#39;s no guarantee that the upper bank with necessary code will happen to be switched in.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Yes.  This is documented in the manual:  &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;
However, the common area that is copied to each code bank starts at the low end of each bank.&lt;br /&gt;
&lt;br /&gt;
Also, there is a &lt;b&gt;?B_RST_BANK&lt;/b&gt; option in the &lt;b&gt;L51_BANK.A51&lt;/b&gt; file that specifies which code bnak is switched in at reset.&lt;br /&gt;
&lt;br /&gt;
If your configuration has a way to select NO code bank, you may need to monitor the size of the common area very carefully.  Otherwise, the normal banking system should work well.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>