| |
Datasheet Home \ Datasheet Details
Download
PDF Abstract Text:
Embedded Programming Using the 8051 & Jam Byte-Code
February 1999, ver. 1
Embedded Programming Using the 8051 & Jam Byte-Code
Application Note 111
February 1999, ver. 1
Introduction
The 8051 family of microprocessors is relatively inexpensive, easy to use, and is a proven platform for managing simple processing tasks. This application note outlines Altera® support for embedded programming and configuration using the 8051 family of microprocessors and a Jam Byte-Code File (.jbc). Instructions to port the 8051 Jam Byte-Code Player are also provided. See Application Note 88 (Using the Jam Language for ISP & ICR via an Embedded Processor) for more information on supported processors and using Jam Byte-Code. The 8051 architecture consists of separate ROM and RAM addressing. Figure 1 illustrates the 8051 interface as it applies to memory.
f 8051 Architecture
Figure 1. 8051 Memory Interface
Up to 64 Kbytes FFFFh
ROM Program Memory
0000h
8051 Up to 64 Kbytes
FFFFh
RAM Data Memory
To JTAG Chain
0000h
Altera Corporation
A-AN-111-01
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Jam Byte-Code Software
The Jam Byte-Code Player and a JBC File are needed to program or configure Altera devices using the 8051 processor. This source code can be customized for the target 8051. For more information on how to customize source code, see "Porting the Jam Byte-Code Player". JBC Files can be generated using the MAX+PLUS® II software, or by compiling an existing ASCII-based Jam File (.jam) into a Jam Byte-Code equivalent using the stand-alone Jam Byte-Code Compiler.
You can download the compiler at http://www.jamisp.com. The Jam Byte-Code Player source code can be obtained by contacting Altera Applications at 1 (800) 800-EPLD, or sending an e-mail to sos@altera.com. Figure 2 shows one way to store the Jam software in an 8051 embedded system.
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Figure 2. 8051 Architecture
ROM Up to 64 Kbytes FFFFh
Jam Byte-Code File (.jbc)
ROM Size
Jam Byte-Code Player Binary
0000h Up to 64 Kbytes
FFFFh
RAM Size
Scratch Area 0000h
To JTAG Chain
Although Figure 2 shows the JBC File stored in ROM, the file could also be stored and executed in RAM. In either case, the Jam Byte-Code Player must be executed by the 8051 processor, and must have access to the JBC File.
Porting the Jam Byte-Code Player
Table 1. 8051 Jam Byte-Code Player Configuration Options
Configuration
Default Other
Processor
Dallas DS87C520 Any 8051 Variant Keil
Compiler
Any 8051 C Compiler
JBC File Storage
ROM ROM, RAM, Or Serial Port (1)
Note:
(1) Programming can be accomplished by downloading the JBC File from remote storage to local RAM via the serial port.
Altera Corporation 3
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Step 1: Edit Compiler-Specific Keywords
If a compiler other than the Keil compiler is used, the keywords in Figure 3 must be changed at the beginning of the jbi51.c file:
Figure 3. Compiler-Specific Keywords
external external internal internal internal
RAM RAM RAM RAM RAM
accessed by 16-bit pointer / accessed by 8-bit pointer / accessed by 8-bit pointer / registers with direct access / single bit data type /
The Keil keywords are code, xdata, pdata, idata, data, and bit. The code keyword refers to program memory where the Jam Byte-Code Player binary is stored. All other keywords refer to specific internal and external RAM spaces. These memory spaces are specific to the 8051 architecture. Change these keywords to map to the compiler you are using.
Step 2: Customize the Memory Map
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Step 3: Customize the I / O Routines
The 8051 Jam Byte-Code Player source code was written so that all I / O functions are confined to a few routines. These routines may require customization based upon the system-level hardware. Table 2 shows each routine and the corresponding I / O function.
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Table 2. Routines & Corresponding I / O Functions
Routine Function
Table 3. JTAG Mapping Hardware Ports
Signal
TDI TMS TCK TDO
Hardware Port
P1.0 P1.1 P1.7 P3.5
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Executing the Jam Player
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
0 1 2 3 4 5 6 7 Success Illegal flags are specified in the initialization list Unrecognized device ID Device version is not supported Programming failure Blank-check failure Verify failure SRAM configuration failure
Description
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Variable
Description
Action
Contact vendor for Jam Player that supports the VECTOR command. None.
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Memory Resources
See Application Note 88 (Using the Jam Language for ISP & ICR via an Embedded Processor) for more information on compressed and uncompressed JBC file sizes.
Programming Times
As PLDs increase in density, performance, and complexity, so do the software tools and algorithms that support them. As a result, the file sizes and algorithms for EEPROM, FLASH, and SRAM-based architectures have increased in complexity. At the same time, the complexity and performance of the 8051 has not changed. Programming and configuration times are sub-standard when compared to other families of processors. You should consider this factor when designing a system that relies on timely in-field upgrades of programmable logic. Densities and complexity of the target logic makes 8051 programming times unsuitable for certain applications. Performance can vary widely as a function of the density of the target logic device and the speed and efficiency of the 8051. Programming times can vary from two minutes, for a 64-macrocell device, to more than 10 minutes for a 256-macrocell device. Altera recommends using the 8051 for in-field upgrades only when reasons for employing an 8051 outweigh the costs associated with long programming times. In these cases, the 8051 variant with the highest performance should be chosen. Altera also recommends using an 8051 for programming product-term device densities below 256 macrocells.
10 Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Conclusion
Easy in-field upgrades can be made using the 8051 family of microprocessors and the Jam Byte-Code Player. Porting the Jam ByteCode player can be accomplished in three steps. Source code is provided to make porting simple and to support the ability to upgrade to a variety of device densities. This source code is specific to the 8051 family of microprocessors and is compatible with any 8051 device variant. You can generate program files easily using the MAX+PLUS II software, which provides control over programming times and memory utilization. The 8051 microprocessor is the ideal tool for programming low-density devices.
Altera Corporation
AN 111: Embedded Programming Using the 8051 & Jam Byte-Code
Printed on Recycled Paper.
Altera Corporation
|