11.12.2012 Views

Using Jam STAPL for ISP via an Embedded Processor - Altera

Using Jam STAPL for ISP via an Embedded Processor - Altera

Using Jam STAPL for ISP via an Embedded Processor - Altera

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

14–14 Chapter 14: <strong>Using</strong> <strong>Jam</strong> <strong>STAPL</strong> <strong>for</strong> <strong>ISP</strong> <strong>via</strong> <strong>an</strong> <strong>Embedded</strong> <strong>Processor</strong><br />

Updating Devices <strong>Using</strong> <strong>Jam</strong><br />

Calculate the total DRAM usage as follows:<br />

Equation 14–8.<br />

In general, <strong>Jam</strong> Files use more RAM th<strong>an</strong> ROM, which is desirable because RAM is<br />

cheaper <strong>an</strong>d the overhead associated with easy upgrades becomes less of a factor as a<br />

larger number of devices are programmed. In most applications, easy upgrades<br />

outweigh the memory costs.<br />

Updating Devices <strong>Using</strong> <strong>Jam</strong><br />

RAM Size = 33 Kbytes + (8 Kbytes + 12 Kbytes) = 53 Kbytes<br />

Updating a device in the field me<strong>an</strong>s downloading a new JBC file <strong>an</strong>d running the<br />

<strong>Jam</strong> <strong>STAPL</strong> Byte-Code Player with what in most cases is the “program” action.<br />

The main entry point <strong>for</strong> execution of the Player is jbi_execute(). This routine<br />

passes specific in<strong>for</strong>mation to the Player. When the Player finishes, it returns <strong>an</strong> exit<br />

code <strong>an</strong>d detailed error in<strong>for</strong>mation <strong>for</strong> <strong>an</strong>y run-time errors. The interface is defined<br />

by the routine’s prototype definition.<br />

JBI_RETURN_TYPE jbi_execute<br />

(<br />

PROGRAM_PTR program<br />

long program_size,<br />

char *workspace,<br />

long workspace_size,<br />

*action,<br />

char **init_list,<br />

long *error_line,<br />

init *exit_code<br />

)<br />

The code within main(), in jbistub.c, determines the variables that will be passed to<br />

jbi_execute(). In most cases, this code is not applicable to <strong>an</strong> embedded<br />

environment; there<strong>for</strong>e, this code c<strong>an</strong> be removed <strong>an</strong>d the jbi_execute() routine<br />

c<strong>an</strong> be set up <strong>for</strong> the embedded environment. Table 14–5 describes each parameter.<br />

Table 14–5. Parameters (Note 1) (Part 1 of 2)<br />

Parameter Status Description<br />

program M<strong>an</strong>datory A pointer to the JBC file. For most embedded systems, setting up this parameter is as<br />

easy as assigning <strong>an</strong> address to the pointer be<strong>for</strong>e calling jbi_execute().<br />

program_size M<strong>an</strong>datory Amount of memory (in bytes) that the JBC file occupies.<br />

workspace Optional A pointer to dynamic memory that c<strong>an</strong> be used by the JBC Player to per<strong>for</strong>m its<br />

necessary functions. The purpose of this parameter is to restrict Player memory<br />

usage to a pre-defined memory space. This memory should be allocated be<strong>for</strong>e<br />

calling jbi_execute(). If maximum dynamic memory usage is not a concern,<br />

set this parameter to null, which allows the Player to dynamically allocate the<br />

necessary memory to per<strong>for</strong>m the specified action.<br />

workspace_size Optional A scalar representing the amount of memory (in bytes) to which workspace points.<br />

MAX II Device H<strong>an</strong>dbook © October 2008 <strong>Altera</strong> Corporation

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!