Skip to main content

ElfImage Class

Namespace: GHIElectronics.TinyCLR.RuntimeLoadableProcedures · Assembly: GHIElectronics.TinyCLR.RuntimeLoadableProcedures

A loaded ELF binary. Construct with the ELF bytes, look up symbols by name, then build a NativeFunction from a function-symbol's address to call it.

public sealed class ElfImage : IDisposable

Constructors

ElfImage(byte[] elfImageData)

public ElfImage(byte[] elfImageData)

Loads an ELF image into device memory.

ParameterTypeDescription
elfImageDatabyte[]ELF binary bytes.

Properties

Size

public uint Size { get; }

Total size of the loaded image.

RegionCount

public uint RegionCount { get; }

Number of distinct ELF regions loaded.

Methods

Dispose()

public void Dispose()

Unloads the image from device memory.

FindSymbolAddress(string name, SymbolType type)

public uint FindSymbolAddress(string name, SymbolType type)

Looks up a symbol by name and type.

ParameterTypeDescription
namestringSymbol name.
typeSymbolTypeSymbol classification.

Returns uint — Symbol's runtime address, or 0 if not found.

FindFunction(string name)

public NativeFunction FindFunction(string name)

Locates a function symbol and wraps it in a NativeFunction.

ParameterTypeDescription
namestring

Returns NativeFunction

InitializeBssRegion()

public void InitializeBssRegion()

Zero-initializes the loaded image's BSS region using the standard __bss_start__/__bss_end__ symbols.

InitializeBssRegion(string startSymbolName, string endSymbolName)

public void InitializeBssRegion(string startSymbolName, string endSymbolName)

Zero-initializes the region delimited by two symbols.

ParameterTypeDescription
startSymbolNamestringSymbol marking the start of the region.
endSymbolNamestringSymbol marking the end of the region.

ZeroRegion(uint address, uint length)

public void ZeroRegion(uint address, uint length)

Zero-fills a span of length bytes starting at address.

ParameterTypeDescription
addressuint
lengthuint