Embedded Programming With Jam STAPL

Jam Standard Test and Programming Language (STAPL) meets the necessary system requirements of in-system programming via an embedded processor, as it offers small file sizes, ease of use, and platform independence. Using Jam STAPL for in-system programming via an embedded processor permits convenient in-field upgrades, easy design prototyping, and fast production. These benefits lengthen the life and enhance the quality and flexibility of end-products. It can also reduce device inventories by eliminating the need to stock and track programmed devices.

How It Works

Using Jam STAPL for in-system programming via an embedded processor takes place in two stages (as shown in Figure 1). First, the Altera® Quartus® II development tool generates the Jam STAPL source code, or Jam File (.jam), then stores it in the system memory. The Jam File contains all information required to program the in-system programmability (ISP)-capable device(s), including the programming algorithm and data needed to upgrade one or more devices.

Second, the Jam Player runs on the embedded processor, interprets the information in the Jam File, and generates the binary data stream for device programming. Because upgrades are confined to the Jam File, the Jam Player can be used to program any vendor's device without requiring upgrades.

Figure 1. In-System Programming Using the Jam File & Jam Player via an Embedded Processor

About the Jam File (.jam)

To program Altera devices using Jam STAPL, designers must first create a Jam File with the Quartus II development software. It is not necessary to recompile existing designs, because the Quartus II software can create a Jam File from a Programmer Object File (.pof). To store a Jam File in erasable programmable read-only memory (EPROM) or Flash memory, it must be converted first to a Hexadecimal (Intel-format) File (.hex) or a similar programming file. Embedded processor software packages or other utilities can automatically convert a Jam File for EPROM or Flash programming. Similarly, some EPROM programmers support "raw binary" or "absolute binary" formats, which allow the Jam File to be read directly by the programmer without conversion.

Figure 2 describes how to generate a Jam File for in-system programming.

Figure 2. Generating a Jam File

About the Jam Player

The Jam Player is a C program that parses the Jam File, interprets each Jam STAPL instruction, and reads and writes data to and from the JTAG chain. The variables processed by the Jam Player depend on the initialization list variables present at the time of execution. Because each application has unique requirements, the Jam Player source code can be modified easily.

Figure 3 illustrates the Jam Player source code structure.

Figure 3. Jam Player Source Code Structure (1)

Note:
1. TCK, TMS, TDI, and TDO are the JTAG I/O pins.

The main program performs all of the basic functions of the Jam Player without modification. Only the I/O functions must be modified. They are contained in the jamstub.c file, as shown in Figure 3, and include functions which specify addresses to I/O pins, delay routines, operating system-specific functions, and routines for file I/O pins. These functions can be customized by simply editing the jamstub.c file to then compile the source code for use on any platform.

The Jam Player resides permanently in system memory, where it interprets the commands given in the Jam File and generates a binary data stream for device programming. This structure confines all upgrades to the Jam File, and it allows the Jam Player to adapt to any system architecture.

Downloads

Related Documents

Frequently Asked Questions