14–14
Chapter 14: Using Jam STAPL for ISP via an Embedded Processor
Updating Devices Using Jam
Calculate the total DRAM usage as follows:
Equation 14–8.
RAM Size = 33 Kbytes + (8 Kbytes + 12 Kbytes) = 53 Kbytes
In general, Jam Files use more RAM than ROM, which is desirable because RAM is
cheaper and the overhead associated with easy upgrades becomes less of a factor as a
larger number of devices are programmed. In most applications, easy upgrades
outweigh the memory costs.
Updating Devices Using Jam
Updating a device in the field means downloading a new JBC file and running the
Jam STAPL Byte-Code Player with what in most cases is the “program” action.
The main entry point for execution of the Player is jbi_execute(). This routine
passes specific information to the Player. When the Player finishes, it returns an exit
code and detailed error information for any run-time errors. The interface is defined
by the routine’s prototype definition.
JBI_RETURN_TYPE jbi_execute
(
PROGRAM_PTR program
long program_size,
char *workspace,
long workspace_size,
*action,
char **init_list,
long *error_line,
init *exit_code
)
The code within main(), in jbistub.c, determines the variables that will be passed to
jbi_execute(). In most cases, this code is not applicable to an embedded
environment; therefore, this code can be removed and the jbi_execute() routine
can be set up for the embedded environment. Table 14–5 describes each parameter.
Table 14–5. Parameters (Note 1) (Part 1 of 2)
Parameter Status
program
Description
Mandatory A pointer to the JBC file. For most embedded systems, setting up this parameter is as
easy as assigning an address to the pointer before calling jbi_execute().
program_size
workspace
Mandatory Amount of memory (in bytes) that the JBC file occupies.
Optional
A pointer to dynamic memory that can be used by the JBC Player to perform its
necessary functions. The purpose of this parameter is to restrict Player memory
usage to a pre-defined memory space. This memory should be allocated before
calling jbi_execute(). If maximum dynamic memory usage is not a concern,
set this parameter to null, which allows the Player to dynamically allocate the
necessary memory to perform the specified action.
workspace_size
Optional
A scalar representing the amount of memory (in bytes) to which workspacepoints.
MAX II Device Handbook
© October 2008 Altera Corporation