bcustom.htm
来自「Free 8051 asm compiler for linux new ho」· HTM 代码 · 共 271 行
HTM
271 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- Customizing BOOT-51 --><HTML><HEAD><TITLE>Customizing BOOT-51</TITLE><META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1"></HEAD><BODY BACKGROUND="spiral.gif" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#990099" ALINK="#FF0000"><TABLE WIDTH="98%"><TR><TD WIDTH=60 VALIGN=BOTTOM NOWRAP><IMG SRC="transp.gif" ALT="" WIDTH=60 HEIGHT=20></TD><TD><!-- Ab hier Seitentext: --><BIG><BR><P><STRONG><U>II.2 Customizing BOOT-51</U></STRONG></P><P><NOBR>BOOT-51</NOBR> must be customized for the target board, before itis ready for assembly. This is performed with an include file<NOBR><EM>boot51.inc</EM></NOBR>, containing the required configuration data.<NOBR><EM>boot51.inc</EM></NOBR> is generated with the <NOBR>BOOT-51</NOBR>Customization Utility <STRONG>CUSTOMIZ</STRONG>.<BR>There are two major groups of configuration parameters:</P><P><UL TYPE=DISC><LI>baudrate generation</LI><LI>memory addresses</LI></UL></P><P><STRONG>CUSTOMIZ</STRONG> is invoked as shown below:</P><P><STRONG><PRE> customiz <baud> [<timer> [<prec> [<clock> [<start> [<user>]]]]]</PRE></STRONG></P><P>The first four parameters are for baudrate generation, and the last twoparameters are memory addresses. Parameters in brackets are optional.<BR>If <STRONG>CUSTOMIZ</STRONG> is invoked without parameters, it displays a help screen.</P><P><TABLE BORDER=0 CELLPADDING=8><TR><TD VALIGN=TOP><BIG><baud></BIG></TD> <TD><BIG>is the desired nominal baudrate (in Baud), <NOBR>BOOT-51</NOBR> should use for communication with the host system.</BIG> </TD></TR><TR><TD VALIGN=TOP><BIG><timer></BIG></TD> <TD><BIG>is the <NOBR>on-chip</NOBR> timer or baudrate generator that is used for baudrate generation. <NOBR>Legal values are:</NOBR></BIG><BR> <BR> <NOBR>T1 = timer 1, available on nearly all 8051 derivatives (default)</NOBR><BR> <NOBR>T2 = timer 2, available on 8052/32 and all true compatibles</NOBR><BR> <NOBR>BG = internal baudrate generator on 80C515/35 and 80C517/37</NOBR><BR> <NOBR>BA = internal baudrate generator on 80C515A and 80C517A</NOBR><BR> <NOBR>D1 = timer 1 with clock/12 or clock/4 prescaler on 80C320</NOBR> </TD></TR><TR><TD VALIGN=TOP><BIG><prec></BIG></TD> <TD><BIG>is the required relative precision of the baudrate in %. <NOBR>The default precision is 1.0 %.</NOBR></BIG> </TD></TR><TR><TD VALIGN=TOP><BIG><clock></BIG></TD> <TD><BIG>is the system clock frequency in MHz. <NOBR>(11.0592 MHz default)</NOBR></BIG> </TD></TR><TR><TD VALIGN=TOP><BIG><start></BIG></TD> <TD><BIG>is the start address of <NOBR>BOOT-51</NOBR> on the target system in hex representation. <NOBR>(default is 0000H)</NOBR></BIG> </TD></TR><TR><TD VALIGN=TOP><BIG><user></BIG></TD> <TD><BIG>is the usual hex start address of the application programs in the external memory. <NOBR>(default is 8000H)</NOBR></BIG> </TD></TR></TABLE></P><P><STRONG><U>Baudrate:</U></STRONG></P><P>For the serial interface, the standard UART is used that is available onalmost every 8051 derivative. <NOBR>BOOT-51</NOBR> is always running theUART in <NOBR>Mode 1</NOBR>, that is asynchronous mode, <NOBR>8 data</NOBR>bits, <NOBR>1 stop</NOBR> bit, no parity.<BR>However, depending on the derivative, there may be various timers orprescalers that can be used for baudrate generation.<BR>If the desired baudrate cannot be generated or the precision is too bad,<STRONG>CUSTOMIZ</STRONG> will display a corresponding error message. In this case,try another baudrate generator that is also available on your derivative.If this fails, too, try another baudrate that may also do, or think ofusing another oscillator crystal that suits better for the task.You should play around with <STRONG>CUSTOMIZ</STRONG>, to explore how to get bestresults. The tables in <NOBR><A HREF="bappende.htm">Appendix E</A></NOBR>show the precisions of the most frequently used baudrates that can begenerated with the supported timers and baudrate generators, for somestandard clock frequencies.In most cases baudrate deviations of 2 to <NOBR>3 %</NOBR> are noproblem for the communication with a PC. Whenever in doubt, try it!<BR><NOBR>BOOT-51</NOBR> can receive data at very high baudrates without theneed for a handshake protocol. Output is done more slowly with short pausesbetween the characters, to avoid a data overrun of the PC UART. The maximumeffective output speed of <NOBR>BOOT-51</NOBR> is corresponding to 9600 Baud(max. <NOBR>1 character</NOBR> per ms).<BR>In general, speed is rather a problem for the PC than for the micro.</P><P><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD NOWRAP><BIG><STRONG>Example 1:</STRONG></BIG></TD> <TD ROWSPAN=3 WIDTH=30 NOWRAP><BIG> </BIG></TD> <TD NOWRAP><BIG><STRONG><CODE>customiz 9600 BG 0.1 12</CODE></STRONG></BIG></TD></TR><TR><TD> </TD><TD> </TD></TR><TR><TD> </TD> <TD><BIG>will generate an include file for <NOBR>BOOT-51</NOBR> that configures it for 9600 Baud, generated with the internal baudrate generator of a SAB80C535 or SAB80C537 that is clocked with <NOBR>12.0 MHz</NOBR>. The required precision is <NOBR>0.1 %</NOBR>. The bootstrap and application program start addresses are set to their default values.</BIG></TD></TR></TABLE></P><P><STRONG><U>Addresses:</U></STRONG></P><P><STRONG><start></STRONG>:<BR>An 8051 starts program execution at CODE address 0000H after reset.Thus there must always be ROM at CODE address 0000H to execute the firstinstructions. On most 8051 boards there is EPROM in the range<NOBR>0000H-7FFFH</NOBR>, and RAM in the range <NOBR>8000H-FFFFH</NOBR>.However, the final application programs will usually start at address 0000H,and the 8051 interrupt addresses start at address 0003H.If application programs can be loaded into RAM at 8000H,this is normally not quite realistic for testing.<BR>Hence it would be nice to have <NOBR>CODE/XDATA</NOBR>-RAM at address 0000Hto load and test application programs. That is why some evaluation boards(<NOBR>e.g.</NOBR> the Keil <NOBR>MCB-517</NOBR>) remap the EPROM fromaddress 0000H to 8000H, and the RAM from 8000H to 0000H, when the firstmemory access to a CODE address > 7FFFH occurs.<BR>To support this, <NOBR>BOOT-51</NOBR> starts with a long jump to its entrypoint, to eventually remap the memory. If you own a corresponding evaluationboard, specify the <STRONG><start></STRONG> address of <NOBR>BOOT-51</NOBR> tothe location, where it resides after memory remapping!</P><P><STRONG><user></STRONG>:<BR>In principle, <NOBR>BOOT-51</NOBR> can load an application program at anylocation in the external RAM and start it there. However, the interruptaddresses should be redirected to the location, where application programsusually start, e.g. the start address of the external RAM.<BR>Hence the <STRONG><user></STRONG> address should point to the location, wherethe <NOBR>CODE/XDATA</NOBR>-RAM starts. If it starts at 8000H, interrupt0003H is redirected to 8003H, interrupt 000BH to 800BH, and so on.<BR>If the <NOBR>CODE/XDATA</NOBR>-RAM starts at 0000H (after remapping), the<STRONG><user></STRONG> address has no practical meaning and can be left default.</P><P><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD NOWRAP><BIG><STRONG>Example 2:</STRONG></BIG></TD> <TD ROWSPAN=3 WIDTH=30 NOWRAP><BIG> </BIG></TD> <TD NOWRAP><BIG><STRONG><CODE>customiz 19200 T2 1 11.0592 0 C000</CODE></STRONG></BIG></TD></TR><TR><TD> </TD><TD> </TD></TR><TR><TD> </TD> <TD><BIG>will generate an include file for <NOBR>BOOT-51</NOBR> that configures it for 19200 Baud, generated with <NOBR>timer 2</NOBR> of an 80C52 or 80C32 that is clocked with <NOBR>11.0592</NOBR> MHz. The required precision is <NOBR>1 %</NOBR>. <NOBR>BOOT-51</NOBR> is located at address 0000H in the EPROM, and the interrupt addresses are redirected to location 0C000H. </BIG></TD></TR></TABLE></P><P>If <STRONG>CUSTOMIZ</STRONG> aborts with an error message, it returns exit code 1 on<NOBR>parameter-</NOBR> and baudrate-errors, and exit code 2 on fatal runtimeerrors. When <STRONG>CUSTOMIZ</STRONG> terminates without error message, it returnsexit code 0, and a customization header file <NOBR><EM>boot51.inc</EM></NOBR>should be present in the default directory.With this file, <NOBR>BOOT-51</NOBR> can be assembled as usual with</P><P><BLOCKQUOTE><STRONG><PRE>ASEM BOOT51 (DOS)asem boot51.a51 (Linux)</PRE></STRONG></BLOCKQUOTE></P><P>Remember that <NOBR>BOOT-51</NOBR> requires <NOBR>ASEM-51 V1.3</NOBR>or later!<BR>Now there should be an <NOBR>Intel-HEX</NOBR> file<NOBR><EM>boot51.hex</EM></NOBR>, which may serve directly as an input forthe EPROM programmer. We may also convert it to a binary image file withthe HEXBIN utility:</P><P><BLOCKQUOTE><STRONG><PRE>HEXBIN BOOT51/LENGTH:4000 (DOS)hexbin -l 4000 boot51.hex (Linux)</PRE></STRONG></BLOCKQUOTE></P><P>would generate a binary image file <NOBR><EM>boot51.bin</EM></NOBR> fora <NOBR>16 kB</NOBR> EPROM (27C128).<BR>(<STRONG>Note:</STRONG> Only <NOBR>1 kB</NOBR> of EPROM is required for the<NOBR>BOOT-51</NOBR> program code.)<BR>Once in an EPROM, <NOBR>BOOT-51</NOBR> should be ready to run on thetarget system.</P></BIG><!-- Seitentext Ende --><P><BR><BR><CENTER><TABLE WIDTH="70%"><TR><TH><A HREF="boot51.htm"><IMG SRC="home.gif" ALT="[contents]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH> <TH><A HREF="binstall.htm"><IMG SRC="up.gif" ALT="[up]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH> <TH><A HREF="bfiles.htm"><IMG SRC="back.gif" ALT="[back]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH> <TH><A HREF="bcables.htm"><IMG SRC="next.gif" ALT="[next]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH></TR></TABLE></CENTER></P></TD></TR></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?