v2.2.1:libnxembeddedtools.ngultra package

Submodules

libnxembeddedtools.ngultra.address module

This module contains all the addresses of memories of NGUltra.

class libnxembeddedtools.ngultra.address.NGUltraAddress

Bases: object

DDR_ba = 2147483648
ERAM_ba = 50331648

libnxembeddedtools.ngultra.bl1 module

This module contains all the needed to generate a BL1 descriptorused by the BL1.

class libnxembeddedtools.ngultra.bl1.DescriptorGenerator(desc_path, section_name)

Bases: object

This class is dedicated to the descriptor generation.

Parameters:
  • desc_path (str) – Final path of the BL1 descriptor.

  • section_name (str) – Name of the section from yaml configuration file.

alignBinarySize(binary, align_to)

Add padding to binary to align it size to the need of BL1. BL1 retrieve the size of the binary in word (4 bytes) and then convert it back to bytes internally. If the size of the binary is not a multiple of 4 the final computed size will be incorrect.

Parameters:
  • binary() – Binary we want to align the size.

  • align_to (int) – Value to align to.

buildPacketHeader(itemType, packetLength)

Create the header for the spacewire packets

Parameters:
  • itemType (int) – Type of packet

  • packetLength (int) – Size of the packet in bytes

generateFlashBootDescriptor()

Generate the final descriptor for boot from flash.

generateSpwPackets()

Generate packets according to the spacewire BL1 protocol.

packetAsw(packets_list)

Create the application software (ASW) first packet containing information about the ASW binary. The created packet is added to the packets_list passed as parameter.

Parameters:

packets_list (list) – List to which to add the created packet.

packetBitstream(packets_list)

Create the bitstream first packet containing information about the bitstream binary. The created packet is added to the packets_list passed as parameter.

Parameters:

packets_list (list) – List to which to add the created packet.

packetData(binary)

Create one or more packets containing raw binary data of the bitstream or ASW passed as parameter. The created packets are added to the packets_list passed as parameter.

Parameters:

binary() – Bitstream or ASW binary.

packetStartAddr(packets_list)
zlibComputeCRC32(source, previousCRC)

libnxembeddedtools.ngultra.bsm module

This module contains everything to program the BSM of NGUltra

class libnxembeddedtools.ngultra.bsm.Loader(iface)

Bases: object

Class used to program the BSM.

Parameters:

iface (Interface) – interface used to communicate with the board.

bsmReset()

Reset the BSM

The reset sequence is:
  • Assert SOFT_RSTN

  • Wait for 100 cycles of BSM

  • Deassert SOFT_RSTN

  • Assert HARD_RSTN

  • Wait for 3 us

  • Deassert HARD_RSTN

  • Wait for 128 cycles if BSM

Since we are using a python over USB interface (either Lauterbach or openOCD), the minimum delay is at least 1ms. So no wait is required.

isReady()

Checks if the ready flag is set

program(nxbFile, address=None)

Program the BSM with the provided nxbFile:

Parameters:
  • nxbFile (str) – NXB to program.

  • address (int) – Address where the NXB is stored. If None, it uses the default loader address in the eRAM.

libnxembeddedtools.ngultra.fastcommands module

This module contains the tools to use the fast commands. Fast commands are a set a commands that use a running programm on the SoCto speed up the transfer of files. With fast commands you can read/write the flash and program the BSM.

When using fast commands, you will interrupt and replace the running program on core 0.

class libnxembeddedtools.ngultra.fastcommands.FastCommands(iface)

Bases: object

ngultraInit()

Initialise NGUltra (PLLs and DDR).

programBSM(nxbFile, address=None)

Program the BSM with a given NXB file.

Parameters:
  • nxbFile (str) – Path of the NXB file.

  • address (int) – Address where the NXB is stored. If None, it uses the default loader address in the eRAM.

readFlash(flashId, outputFile, base_address, size)

Read the flash and write the result in a file

Parameters:
  • flashId (int) – flash to read;

  • outputFile (str) – Path of the file where to write the result.

  • base_address (int) – Address in the flash where to read the file.

  • size (int) – Number of 256 bytes to read.

writeFlash(flashId, inputFile, base_address, byteorder='little')

Write the flash with the given file.

Parameters:
  • flashId (int) – flash to write;

  • inputFile (str) – Path of the file to write.

  • base_address (int) – Address in the flash where to write the file.

  • byteorder (str) – Byteorder of the file. Must be “little” or “big”.

libnxembeddedtools.ngultra.flash module

This module contains everything to read/write data from/into the flash memory.

class libnxembeddedtools.ngultra.flash.Controller

Bases: object

This class is dedicated to the management of the flash controller.

erase(flashId)

Totally erase the specified flash.

Parameters:

flashId (int) – The flash to erase.

Flash id goes from 0 to 3.

eraseSector(flashId, address)

Erase a sector of the specified flash.

Parameters:
  • flashId (int) – The flash to erase.

  • address (int) – Begining of the sector to erase.

Flash id goes from 0 to 3.

Sector size depends of the flash. For the “S25FL512S” (used on the bringup board) the sector size is 256KB.

fastReadData(flashId, outputFile, address, size)

Dump the content of the specified flash to a file using fast commands API.

Parameters:
  • flashId (int) – The flash to read.

  • outputFile (str) – Path of the file of the dump.

  • address (int) – Address where to write the data.

  • size (str) – Number of 256B block to read.

Flash id goes from 0 to 3.

fastWriteData(flashId, inputFile, address, byteorder='little')

Write a file to the specified flash using fast commands API.

Parameters:
  • flashId (int) – The flash to write.

  • inputFile (str) – Path of the file to write

  • address (int) – Address where to write the data.

  • byteorder (str) – Byteorder of the file. Must be “big” or “little”.

Flash id goes from 0 to 3.

fastWriteDataPadded(flashId, inputFile, address, byteorder='little', modulo=64)

Write a file to the specified flash using fast commands API. This file will be padded before writing it.

Parameters:
  • flashId (int) – The flash to write.

  • inputFile (str) – Path of the file to write

  • address (int) – Address where to write the data.

  • byteorder (str) – Byteorder of the file. Must be “big” or “little”.

  • modulo (int) – Used to compute the size of the padding.

Flash id goes from 0 to 3.

readToFile(flashId, outputFile, address, size)

Dump the content of the specified flash to a file.

Parameters:
  • flashId (int) – The flash to read.

  • outputFile (str) – Path of the file of the dump.

  • address (int) – Address where to write the data.

  • size (str) – Number of 256B block to read.

Flash id goes from 0 to 3.

writeBL1(flashId, inputFile, key)

Write the specified file on the specified flash considering it as a BL1. This file will be signed and written at address 0.

Parameters:
  • flashId (int) – The flash to write.

  • inputFile (str) – Path of the file to write.

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

Flash id goes from 0 to 3.

writeData(flashId, address, data)

Write the specified flash with provided data.

Parameters:
  • flashId (int) – The flash to write.

  • address (int) – Address where to write the data.

  • data (list) – Data to write;

Flash id goes from 0 to 3.

writeFromFile(flashId, inputFile, address, byteorder='little')

Write a file to the specified flash.

Parameters:
  • flashId (int) – The flash to write.

  • inputFile (str) – Path of the file to write

  • address (int) – Address where to write the data.

  • byteorder (str) – Byteorder of the file. Must be “big” or “little”.

Flash id goes from 0 to 3.

libnxembeddedtools.ngultra.memory module

This module contains usefull commands for the memory of NGUltra

class libnxembeddedtools.ngultra.memory.Memory(iface=None)

Bases: object

Class representing the Memory of the SoC.

loadImage(image, core, address)

Load a binary file for the specified core. If the load address is contained on the eRAM, the eRAM will be scrubbed first.

Parameters:
  • image (str) – Path of the binary file to load.

  • core (int) – Core where to load the image.

  • address (int) – Core where to load the image.

This will not set the PC of the core.

scrubEram()

Totally erase the eRAM.

libnxembeddedtools.ngultra.reset module

This module contains everything to send reset to the target.

class libnxembeddedtools.ngultra.reset.Reset(remoteAPI)

Bases: object

This class contains everything to send all types of reset to the target.

postMortemReset()

Perform a Post Mortem reset

powerOnReset()

Perform a System reset

systemReset()

Perform a System reset

Module contents

© NanoXplore 2022