jtag_programmer

A simple microprocessor memory programmer. Reads in an ELF file, parses its program data to [address data] colums, and generates a programming sequence of writes to appropriate JTAG Test Data Registers to transfer the program data to the device. The address and data values are simply written to corresponding TDRs. An additional write enable signal write_en is also generated to coordinate the writes to the target memory.

Example

See jtag_programmer/__init__.py self-test for an example.

class jtag_programmer.jtag_programmer(driver, config, namemap)

The jtag_programmer is a helper class for uploading program data to systems over the JTAG serial interface. This class uses the jtag_driver entity to generate a simulation excitation for a control sequence that uploads the program data to the design over a simple address, data, write_enable interface.

Parameters

driver: jtag_driver

An instance of jtag_driver used to generate the programming waveform.

config: dict

YAML based JTAG configuration

namemap: dict

A dict that maps “address”, “data”, and “write_en” to the corresponding TDR names in the JTAG config YAML.

Attributes

driver: jtag_driver

An instance of jtag_driver used to generate the programming waveform.

init()

Re-initialize the structure if the attribute values are changed after creation.

main()

Writes the program data of the read elf-file to JTAG UpdateChains

read_elf(filepath, use_sh_addr=False, word_width=1, sections=['.text', '.data', '.sdata', '.rodata'])

Load program data to memory from the ELF file located at filepath. The loaded data is stored as an numpy array with adderss and data columns in self.elf_data.

Parameters

filepathstr

Path to program ELF file to be loaded.

use_sh_addrbool

Use sh_addr (section header - address) field from ELF to tag the data with an address

word_widthint

How many bytes are in one word in the result

sections: list(str)

Which ELF sections to read and store to self.elf_data. Default: [‘.text’, ‘.data’, ‘.sdata’, ‘.rodata’]

read_instruction_bytes(filepath, sections)

Load program data to memory from the ELF file located at filepath. The loaded data is stored as an numpy array with one byte per item

Parameters

filepathstr

Path to program ELF file to be loaded.

sections: list(str)

Which ELF sections to read and store to self.elf_data.

run()

Main entity runner.