Home  Contents

os.checkFirmwareFile

OS Core4 Lua Commands

SYNOPSIS

data = os.checkFirmwareFile(filename)

DESCRIPTION

This command checks a firmware update file to see if it is properly formatted.

On success, it returns a table with information about the file contents. The table contains these fields:

app_name Given name of the application code.
app_release Version information for the application code.
app_compiled A Date/Time value indicating when the application code was compiled. Value is based on UTC.
sdk_release Version information for the base operating system.
sdk_compiled A Date/Time value indicating when the base operating system was compiled. Value is based on UTC.
machine Manufacturer name and name of the board hardware separated by a space.
cpu ID code that uniquely matches the CPU architecture.
datecode Four digit datecode of the latest board revision supported.

Some of the fields have corresponding entries in the return value of os.uname(). This can be used to verify that the file can run on the current hardware before attempting to install it.

RETURN VALUE

On success, returns a table with information about the firmware file. On error, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.

NOTES

A firmware file can be installed on a board if it matches the board hardware. Information about the board hardware can be acquired by calling os.uname().

To match, the firmware cpu and machine must match the board cpu and machine. The firmware datecode must be the same or higher than the datecode of the board revision.

The datecode is a four digit integer in the format YYWW (YY=Year of design, WW=Week of design).

When printing a datecode to a user display, it is recommended to use the format DWWYY. The order WWYY is widely used in the electronics industry.

The reason for storing the datecode as YYWW instead is because this makes comparing datecodes trivial in software.

Example: datecode=1701 should be printed as D0117, matching the format that is printed on the controller board itself.