AN 425: Using the Command-Line Jam™ STAPL Solution for Device Programming

ID 683089
Date 10/14/2024
Public
Document Table of Contents

1.8. Updating Devices Using Jam

To update a device in the field, download a new .jbc and run the Jam™ STAPL Byte-Code Player, in most cases, with the program action statement.
The main entry point for the Jam™ STAPL Byte-Code 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 in jbimain.c:
JBI_RETURN_TYPE jbi_execute
(
	PROGRAM_PTR program
	long program_size,
	char *workspace,
	long workspace_size,
	char *action,
	char **init_list,
	int reset_jtag
	long *error_address,
	int *exit_code,
	int *format_version
)

The code within main() in jbistub.c determines the variables that are passed to jbi_execute(). In most cases, this code is not applicable to an embedded environment. Therefore, you can remove this code and set up the jbi_execute() routine for the embedded environment.

Before calling the jbi_execute function, construct init_list with the correct arguments that correspond to the valid actions in .jbc, as specified in the JEDEC standard JESD71 specification. The init_list is a null-terminated array of pointers to strings.

An initialization list tells the Jam™ STAPL Byte-Code Player the types of functions to perform—for example, program and verify—and this list is passed to jbi_execute(). The initialization list must be passed in the correct manner. If an initialization list is not passed or the initialization list is invalid, the Jam™ STAPL Byte-Code Player simply checks the syntax of the .jbc and if there is no error, returns a successful exit code without performing the program function.

Code to Set Up init_list for Performing Program and Verify Operation

Use this code to set up init_list that instructs the Jam™ STAPL Byte-Code Player to perform a program and verify operation.
char CONSTANT_AREA init_list[][] = "DO_PROGRAM=1", "DO_VERIFY=1";

The default code in the Jam™ STAPL Byte-Code Player sets init_list differently and is used to give instructions to the Jam™ STAPL Byte-Code Player from the command prompt.

The code in this example declares the init_list variable while setting it equal to the appropriate parameters. The CONSTANT_AREA identifier instructs the compiler to store the init_list array in the program memory.

After the Jam™ STAPL Byte-Code Player completes a task, the player returns a status code of type JBI_RETURN_TYPE or integer. A return value of "0" indicates a successful action. The jbi_execute() routine can return any of the exit codes as defined in the Jam™ STAPL Specification.