| aiengine Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List

xaiesim_elfload.c File Reference

## Overview

This file contains the API for ELF loading.

Applicable only for the AIE simulation environment execution on linux.

    MODIFICATION HISTORY:

    Ver   Who     Date     Changes

    1.0  Naresh  04/06/2018  Initial creation
    1.1  Naresh  05/07/2018  Fixed CR#1001944, CR#1002101
    1.2  Naresh  06/13/2018  Fixed CR#1003905
    1.3  Naresh  07/11/2018  Updated copyright info
    1.4  Naresh  07/26/2018  Fixed CR#1007367
    1.5  Hyun    08/27/2018  Fixed the incorrect remaining bytes, CR-1009665
    1.6  Nishad  12/05/2018  Renamed ME attributes to AIE
    1.7  Hyun    09/13/2019  Used global IO accessors and added more AIESIM
    1.8  Hyun    09/13/2019  Added XAieSim_LoadElfMem()
    1.9  Tejus   12/04/2019  Support for new .bss/.data section prefixes in elf
    2.0  Nishad  02/03/2020  Added support for non-standard ELF sections

XAieGbl_Config | XAieGbl_ConfigTable []
| The configuration table for each AIE device. More...
uint32 | XAieSim_LoadElfMem (XAieSim_Tile *TileInstPtr, uint8 *ElfPtr, uint8 LoadSym)
| This is the API to load the specified ELF to the target AIE Tile program memory followed by clearing of the BSS sections. More...
uint32 | XAieSim_LoadElf (XAieSim_Tile *TileInstPtr, uint8 *ElfPtr, uint8 LoadSym)
| This is the API to load the specified ELF to the target AIE Tile program memory followed by clearing of the BSS sections. More...
uint32 | XAieSim_GetStackRange (uint8 *MapPtr, XAieSim_StackSz *StackSzPtr)
| This is the routine to derive the stack start and end addresses from the specified map file. More...
void | XAieSim_LoadSymbols (XAieSim_Tile *TileInstPtr, uint8 *ElfPtr)
| This routine sends the out of bound command to the sim to load symbols. More...
void | XAieSim_WriteSection (XAieSim_Tile *TileInstPtr, uint8 *SectName, Elf32_Shdr *SectPtr, FILE *Fd)
| This routine is used to write to the specified section by reading the corresponding data from the ELF file. More...
uint64_t | XAieSim_GetTargetTileAddr (XAieSim_Tile *TileInstPtr, uint32 ShAddr)
| This routine is used to get the actual tile data memory address based on the section's loadable address. More...

## Function Documentation

uint32 XAieSim_GetStackRange | ( | uint8 * | MapPtr,
|  | XAieSim_StackSz * | StackSzPtr
| ) |  |

This is the routine to derive the stack start and end addresses from the specified map file.

This function basically looks for the line <init_address>..<final_address> ( <num> items) : Stack in the map file to derive the stack address range.

Parameters

  MapPtr,: | Path to the Map file.
  StackSzPtr,: | Pointer to the stack range structure.

Returns
  XAIESIM_SUCCESS on success, else XAIESIM_FAILURE.

Note
  None.

References XAieSim_StackSz::end, and XAieSim_StackSz::start.

Referenced by XAieSim_LoadElf().

uint64_t XAieSim_GetTargetTileAddr | ( | XAieSim_Tile * | TileInstPtr,
|  | uint32 | ShAddr
| ) |  |

This routine is used to get the actual tile data memory address based on the section's loadable address.

The actual tile address is derived from the cardinal direction the secton's loadable address points to.

Parameters

  TileInstPtr | - Pointer to the Tile instance structure.
  ShAddr,: | Section's loadable address.

Returns
  32-bit target tile address.

Note
  None.

References XAieGbl_Config::NumCols, and XAieGbl_Config::NumRows.

Referenced by XAieSim_LoadElf(), XAieSim_LoadElfMem(), and XAieSim_WriteSection().

uint32 XAieSim_LoadElf | ( | XAieSim_Tile * | TileInstPtr,
|  | uint8 * | ElfPtr,
|  | uint8 | LoadSym
| ) |  |

This is the API to load the specified ELF to the target AIE Tile program memory followed by clearing of the BSS sections.

Parameters

  TileInstPtr | - Pointer to the Tile instance structure.
  ElfPtr,: | Path to the ELF file to be loaded into memory.

Returns
  XAIESIM_SUCCESS on success, else XAIESIM_FAILURE.

Note
  None.

References XAieSim_StackSz::end, XAieSim_StackSz::start, XAieSim_GetStackRange(), XAieSim_GetTargetTileAddr(), XAieSim_LoadSymbols(), XAieSim_WriteCmd(), and XAieSim_WriteSection().

Referenced by XAieLib_LoadElf().

uint32 XAieSim_LoadElfMem | ( | XAieSim_Tile * | TileInstPtr,
|  | uint8 * | ElfPtr,
|  | uint8 | LoadSym
| ) |  |

This is the API to load the specified ELF to the target AIE Tile program memory followed by clearing of the BSS sections.

Parameters

  TileInstPtr | - Pointer to the Tile instance structure.
  ElfPtr,: | Path to the ELF memory

Returns
  XAIESIM_SUCCESS on success, else XAIESIM_FAILURE.

Note
  None.

References XAieSim_GetTargetTileAddr().

Referenced by XAieLib_LoadElfMem().

void XAieSim_LoadSymbols | ( | XAieSim_Tile * | TileInstPtr,
|  | uint8 * | ElfPtr
| ) |  |

This routine sends the out of bound command to the sim to load symbols.

Parameters

  TileInstPtr | - Pointer to the Tile instance structure.
  ElfPtr,: | Path to the ELF file.

Returns
  None.

Note
  None.

References XAieSim_WriteCmd().

Referenced by XAieSim_LoadElf().

void XAieSim_WriteSection | ( | XAieSim_Tile * | TileInstPtr,
|  | uint8 * | SectName,
|  | Elf32_Shdr * | SectPtr,
|  | FILE * | Fd
| ) |  |

This routine is used to write to the specified section by reading the corresponding data from the ELF file.

Parameters

  TileInstPtr,: | Pointer to the Tile instance structure.
  SectName,: | Name of the section.
  SectPtr,: | Poiner to the section entry in the ELF file.
  Fd,: | Pointer to the ELF file.

Returns
  None.

Note
  None.

References XAieSim_GetTargetTileAddr().

Referenced by XAieSim_LoadElf().

## Variable Documentation

XAieGbl_Config XAieGbl_ConfigTable[]

The configuration table for each AIE device.

XAIE_BASE_ARRAY_ADDR_OFFSET macro defines the AI Engine's base address offset value.