📄 boot51.doc
字号:
MCS-51 Microcontroller Family Bootstrap Program BBBBBB OOOOO OOOOO TTTTTTTT 5555555 11 BB BB OO OO OO OO TT 55 111 BB BB OO OO OO OO TT 55 11 BBBBBB OO OO OO OO TT ==== 555555 11 BB BB OO OO OO OO TT 55 11 BB BB OO OO OO OO TT 55 11 BBBBBB OOOOO OOOOO TT 555555 1111 U S E R ' S M A N U A L Version 1.1 December 15, 2002 copyright (c) 1996, 2002 by W.W. Heinz TABLE OF CONTENTS -----------------I. IntroductionII. BOOT-51 Installation II.1 Files II.2 Customizing BOOT-51 II.3 Tailoring the Cables II.4 Design of MCS-51 Evaluation BoardsIII. BOOT-51 Operation III.1 Interactive Operation III.2 Batch File Operation under MS-DOS III.3 DOS Upload Utilities III.4 Shell Script Operation under Linux III.5 The BLINK ProgramIV. Troubleshooting IV.1 General Trouble IV.2 Trouble under MS-DOS IV.3 Trouble under LinuxAppendix A: CUSTOMIZ Error Messages A.1 Parameter Errors A.2 Baudrate Errors A.3 Runtime ErrorsAppendix B: RESET51 Error MessagesAppendix C: BOOT-51 Error MessagesAppendix D: TrademarksAppendix E: Tables of BaudratesI. Introduction---------------Usually an 8051 application program is not running correctly from scratch,and it is not quite easy to debug it without a suitable test equipment.It is very inconvenient, to burn the program into an EPROM after everychange. Instead it would be nice to load the program into the externalRAM of the target board and then start it. This would dramatically speedup the turn-around cycles. However, three problems must be solved first: 1. There must be a suitable interface to transmit the application program from the host (PC) to the target (8051) system. 2. The target board needs a suitable firmware that can receive a program from the host computer, store it in the external RAM, and finally execute it. 3. Once loaded, the application program must be executable, although it is stored in the external RAM, which is usually mapped into the XDATA address space. (Programs can only be executed in the CODE address space!)The corresponding three solutions are: 1. an RS-232 interface between the PC and the 8051 board 2. a bootstrap program 3. external RAM that is mapped into both the CODE and XDATA address spaceNearly all evaluation boards for 8051 derivatives are meeting requirements1 and 3. In most cases, it is easy to establish a memory map according torequirement 3, even on target boards that do not originally support it.(See chapter "II.4 Design of MCS-51 Evaluation Boards".)Requirement 2 can be met by burning a customized version of BOOT-51 intothe EPROM of the target board. After system reset, it can receive anIntel-HEX file over the serial interface, store it in the external RAM,and finally jump to the program start address.BOOT-51 itself doesn't need any external RAM, and requires only 1 kB ofEPROM. In principle, it is not restricted to a PC-based host system, butpresently only the host platforms MS-DOS, Windows 9x, and Linux (i386)are supported.Sure, a bootstrap program cannot replace a target debugger, but it's a start.II. BOOT-51 Installation------------------------The BOOT-51 support files are usually installed on the host system togetherwith the latest ASEM-51 version. Of course BOOT-51 must be installed on theMCS-51 target system, too.Before burning BOOT-51 into an EPROM, it must be customized for the targetboard, and one or two cables must be tailored for local requirements.If the design of the target system is not yet finished, some basic knowledge,concerning the general design of MCS-51 evaluation boards, might be helpfulto meet the hardware requirements from the beginning.II.1 Files----------The BOOT-51 package for DOS/Windows consists of the following files: BOOT51.DOC BOOT-51 User's Manual, ASCII format BOOT51.HTM index file of the BOOT-51 documentation, HTML format *.HTM further pages of the HTML documentation *.GIF GIF images referenced by HTML pages BOOT51.A51 BOOT-51 assembler source (for ASEM-51 V1.3 and up) CUSTOMIZ.EXE BOOT-51 customization utility BOOT.BAT batch file for application program upload UPLOAD.BAT called by BOOT.BAT only COMPORT.EXE setup utility for PC serial ports RESET51.EXE program to reset the target system via PC ports SLEEP.EXE program to wait for the reset recovery time BLINK.A51 sample test program for BOOT-51The BOOT-51 package for Linux consists of the following files: boot51.doc BOOT-51 User's Manual, ASCII format boot51.htm index file of the BOOT-51 documentation, HTML format *.htm further pages of the HTML documentation *.gif GIF images referenced by HTML pages boot51.a51 BOOT-51 assembler source (for ASEM-51 V1.3 and up) customiz BOOT-51 customization utility customiz.1 man-page for customiz boot shell script for application program upload boot.1 man-page for boot upload called by boot only (generic version) upload.new "new" upload (optimized for stty 2.0 or later) reset51 program to reset the target system via PC ports reset51.1 man-page for reset51 blink.a51 sample test program for BOOT-51II.2 Customizing BOOT-51------------------------BOOT-51 must be customized for the target board, before it is ready forassembly. This is performed with an include file boot51.inc, containingthe required configuration data. boot51.inc is generated with the BOOT-51Customization Utility CUSTOMIZ.There are two major groups of configuration parameters: - baudrate generation - memory addressesCUSTOMIZ is invoked as shown below: customiz <baud> [<timer> [<prec> [<clock> [<start> [<user>]]]]]The first four parameters are for baudrate generation, and the last twoparameters are memory addresses. Parameters in brackets are optional.If CUSTOMIZ is invoked without parameters, it displays a help screen.<baud> is the desired nominal baudrate (in Baud), BOOT-51 should use for communication with the host system.<timer> is the on-chip timer or baudrate generator that is used for baudrate generation. Legal values are: T1 = timer 1, available on nearly all 8051 derivatives (default) T2 = timer 2, available on 8052/32 and all true compatibles BG = internal baudrate generator on 80C515/35 and 80C517/37 BA = internal baudrate generator on 80C515A and 80C517A D1 = timer 1 with clock/12 or clock/4 prescaler on 80C320<prec> is the required relative precision of the baudrate in %. The default precision is 1.0 %.<clock> is the system clock frequency in MHz. (11.0592 MHz default)<start> is the start address of BOOT-51 on the target system in hex representation. (default is 0000H)<user> is the usual hex start address of the application programs in the external memory. (default is 8000H)Baudrate:---------For the serial interface, the standard UART is used that is available onalmost every 8051 derivative. BOOT-51 is always running the UART in Mode 1,that is asynchronous mode, 8 data bits, 1 stop bit, no parity.However, depending on the derivative, there may be various timers orprescalers that can be used for baudrate generation.If the desired baudrate cannot be generated or the precision is too bad,CUSTOMIZ will display a corresponding error message. In this case, tryanother 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 CUSTOMIZ, to explore how to get best results.The tables in Appendix E show the precisions of the most frequently usedbaudrates that can be generated with the supported timers and baudrategenerators, for some standard clock frequencies.In most cases baudrate deviations of 2 to 3 % are no problem for thecommunication with a PC. Whenever in doubt, try it!BOOT-51 can receive data at very high baudrates without the need for ahandshake protocol. Output is done more slowly with short pauses betweenthe characters, to avoid a data overrun of the PC UART. The maximumeffective output speed of BOOT-51 is corresponding to 9600 Baud(max. 1 character per ms).In general, speed is rather a problem for the PC than for the micro.Example 1: customiz 9600 BG 0.1 12---------- will generate an include file for BOOT-51 that configures it for 9600 Baud, generated with the internal baudrate generator of a SAB80C535 or SAB80C537 that is clocked with 12.0 MHz. The required precision is 0.1 %. The bootstrap and application program start addresses are set to their default values.Addresses:----------<start>: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 0000H-7FFFH,and RAM in the range 8000H-FFFFH. However, the final application programswill usually start at address 0000H, and the 8051 interrupt addresses startat address 0003H. If application programs can be loaded into RAM at 8000H,this is normally not quite realistic for testing.Hence it would be nice to have CODE/XDATA-RAM at address 0000H to load andtest application programs. That is why some evaluation boards (e.g. the KeilMCB-517) remap the EPROM from address 0000H to 8000H, and the RAM from 8000Hto 0000H, when the first memory access to a CODE address > 7FFFH occurs.To support this, BOOT-51 starts with a long jump to its entry point, toeventually remap the memory. If you own a corresponding evaluation board,specify the <start> address of BOOT-51 to the location, where it residesafter memory remapping!<user>:In principle, BOOT-51 can load an application program at any location inthe external RAM and start it there. However, the interrupt addressesshould be redirected to the location, where application programs usuallystart, e.g. the start address of the external RAM.Hence the <user> address should point to the location, where the CODE/XDATA-RAM starts. If it starts at 8000H, interrupt 0003H is redirected to 8003H,interrupt 000BH to 800BH, and so on.If the CODE/XDATA-RAM starts at 0000H (after remapping), the <user> addresshas no practical meaning and can be left default.Example 2: customiz 19200 T2 1 11.0592 0 C000---------- will generate an include file for BOOT-51 that configures it for 19200 Baud, generated with timer 2 of an 80C52 or 80C32 that is clocked with 11.0592 MHz. The required precision is 1 %. BOOT-51 is located at address 0000H in the EPROM, and the interrupt addresses are redirected to location 0C000H.If CUSTOMIZ aborts with an error message, it returns exit code 1 on para-meter- and baudrate-errors, and exit code 2 on fatal runtime errors.When CUSTOMIZ terminates without error message, it returns exit code 0, anda customization header file boot51.inc should be present in the defaultdirectory. With this file, BOOT-51 can be assembled as usual with ASEM BOOT51 (DOS) asem boot51.a51 (Linux)Remember that BOOT-51 requires ASEM-51 V1.3 or later!Now there should be an Intel-HEX file boot51.hex, which may serve directlyas an input for the EPROM programmer. We may also convert it to a binaryimage file with the HEXBIN utility: HEXBIN BOOT51/LENGTH:4000 (DOS) hexbin -l 4000 boot51.hex (Linux)would generate a binary image file boot51.bin for a 16 kB EPROM (27C128).(Note: Only 1 kB of EPROM is required for the BOOT-51 program code.)Once in an EPROM, BOOT-51 should be ready to run on the target system.II.3 Tailoring the Cables-------------------------Application programs are uploaded to the target system over a serialinterface. The serial ports of the PC may have 9-pin or 25-pin maleD-Shell connectors. Suitable RS-232 cables for the MCS-51 board canbe tailored as follows: RS-232 cable with 25-pin female D-Shell connector: --------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -