Skip to main content

InFieldUpdate Class

Namespace: GHIElectronics.TinyCLR.Update · Assembly: GHIElectronics.TinyCLR.Update

In-Field Update — feed firmware and/or application bytes in chunks, verify the signatures, then flash and reboot. Supports caching the chunks in RAM (faster) or to an external StorageController (handles images larger than free RAM).

public class InFieldUpdate : IDisposable

Constructors

InFieldUpdate()

public InFieldUpdate()

Creates a RAM-cached updater.

InFieldUpdate(StorageController storageController)

public InFieldUpdate(StorageController storageController)

Creates a flash-cached updater backed by an external storage device. Use for images that don't fit in RAM.

ParameterTypeDescription
storageControllerStorageController

Properties

ActivityPin

public GpioPin ActivityPin { get; set; }

Optional pin to toggle during long-running update operations (visual progress LED).

Methods

LoadApplicationKey(byte[] key)

public void LoadApplicationKey(byte[] key)

Loads the public key used to verify the application image.

ParameterTypeDescription
keybyte[]

LoadApplicationChunk(byte[] data, int offset, int size)

public int LoadApplicationChunk(byte[] data, int offset, int size)

Appends a chunk of bytes to the buffered application image.

ParameterTypeDescription
databyte[]
offsetint
sizeint

Returns int — Number of bytes accepted.

LoadFirmwareChunk(byte[] data, int offset, int size)

public int LoadFirmwareChunk(byte[] data, int offset, int size)

Appends a chunk of bytes to the buffered firmware image.

ParameterTypeDescription
databyte[]
offsetint
sizeint

Returns int — Number of bytes accepted.

VerifyApplication()

public string VerifyApplication()

Verifies the application signature without flashing. Returns the embedded version string, or "Invalid." on failure.

Returns string

VerifyFirmware()

public string VerifyFirmware()

Verifies the firmware signature without flashing. Returns the embedded version string, or "Invalid." on failure.

Returns string

ResetChunks()

public void ResetChunks()

Discards every buffered chunk and rewinds both write indices to zero.

FlashAndReset()

public void FlashAndReset()

Verifies any buffered images, writes them to their destination regions, and resets the device. Does not return on success.

Dispose()

public void Dispose()

Releases buffered memory (the unmanaged firmware/application buffers).

VersionConvertToString(uint version)

public static string VersionConvertToString(uint version)

Formats a packed 32-bit version (major.minor.build.revision) as a dotted string.

ParameterTypeDescription
versionuint

Returns string