v2.2.0: libnxembeddedtools.tools package

Submodules

libnxembeddedtools.tools.elflib module

This module contains everything to extract needed information from elf files

class libnxembeddedtools.tools.elflib.ELFLib

Bases: object

static getLoadAddress(rawFile)

Returns the load address of the ELF File.

Parameters:

rawFile (_io.FileIO) – elfFile opened in “b” mode;

Returns:

Load Address if found, None otherwise.

Return type:

int

static getSymbolAddress(rawFile, symbol_name)

Returns the address of a specific symbol present in the provided ELF File.

Parameters:
  • rawFile (_io.FileIO) – elfFile opened in “b” mode;

  • symbol_name (str) – Symbol name to find.

Returns:

Address of the symbol if found, None otherwise.

Return type:

int

libnxembeddedtools.tools.gcov module

This module contains everything to extract gcda files from target

Usage:

First, you should get an instance of Interface by calling the get() mehod.

Then, construct the GCDAExtractor object using the object got previously.

Finally, call the GCDAExtractor.extract() method.

Example

This will show you how to extract gcov information from a program running on core 0. We assume that the __gcov_root symbol is located at 0x3001234

from libnxembeddedtools.tools.gcov import GCDAExtractor
import libnxembeddedtools.remoteapi.factory as RemoteAPIFactory


iface = RemoteAPIFactory.get()
extractor = GCDAExtractor(iface)
extractor.extract(0, 0x3001234)
class libnxembeddedtools.tools.gcov.GCDAExtractor(remoteIface)

Bases: object

This class is an helper to extract the runtime gcov information (gcda files) from the target directly from the memory.

Parameters:

remoteIface (Interface) – Interface to use to communicate with the board.

extract(core, gcov_root)

Extract gcov information from a running binary from target memory.

Parameters:
  • core (int) – Core where the binary is running

  • gcov_root (int) – Address of the __gcov_root symbol.

An helper is provided to get the address of a specific symbol:

getSymbolAddress()

This method will directly write gcda files are their path (alongside .gcno files). Be sure to run this command on a PC that have access to the binary compilation path.

libnxembeddedtools.tools.signer module

This module contains everything to build a sign a binary as a BL1 for flash or SW boot

class libnxembeddedtools.tools.signer.Signer

Bases: object

This class is dedicated to the signature of a BL1 for flash or SW boot.

sign(bl1_path, key, isSpaceWire, out_path)

Sign a bl1 binary using key.

Parameters:
  • bl1_path (str) – Path of the BL1 to sign.

  • key (str) – Path of the key used to sign.

  • isSpaceWire (Boolean) – Is the bl1 signed for spacewire boot.

  • out_path (str) – Output directory where to store the result.

Module contents

© NanoXplore 2022