Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Adding a new DSPLink DSP Executable loader

From Texas Instruments Wiki
Jump to: navigation, search

END OF LIFE

DSP Link is still available for download, but no further releases or updates are planned. Please see IPC Software Options for details and alternatives.

DSP/BIOSTM LINK allows the user to create and add a new DSP executable loader into the system.

Default loader support

By default, the following loaders are supported:

  1. COFF loader
  2. Static loader (On PrOS and Davinci-like platforms having same memory map on GPP and DSP)
  3. Binary loader (On PrOS only)

Adding a new loader

In addition to these, if the user wishes to use a special kind of loader, it can be added in DSPLink. The steps to add a new loader are documented below.

1. Use an existing loader implementation for reference. An implementation of the defined loader interface needs to be created:

typedef struct LOADER_Interface_tag {
    FnLoaderInit        init;
    FnLoaderExit        exit;
    FnLoad              load;
    FnLoadSection       loadSection;
    FnGetSymbolAddress  getSymbolAddress;
} LOADER_Interface;

Of these, the loadSection API can simply return DSP_ENOTIMPL and does not need to have any specific implementation.

2. If the loader requires specific parameters to be passed to PROC_load() instead of the base image, the structure can be defined in $(DSPLINK)/gpp/inc/loaderdefs.h

3. The file $(DSPLINK)/gpp/src/ldrv/[PLATFORM]/CFG_map.c needs to be modified to add support for this new loader into DSPLink. For example, add the following into the CFGMAP_LoaderObjects object.

{
    "NEWLOADER",                // NAME           : Name of the loader
    &NEWLOADER_Interface        // INTERFACE      : Loader interface table
}

4. Change the $(DSPLINK)/config/all/CFG_[PLATFORM].c to use the NEWLOADER instead of the COFF loader, which is default. This is indicated by the following field in the LINKCFG_dspObjects object:

    "MYLOADER",                 // LOADERNAME     : Name of the DSP executable loader

This configures DSPLink to use this new loader.

Example

As an example, consider a new loader MYLOADER to be added.

Loader requirements

The requirements of this new type of loader are:

  1. A DSP executable is to be pre-loaded by the GPP operating system boot-loader into the DSP memory.
  2. The information about the DSP executable required by DSPLink is provided to DSPLink through the PROC_load() API, but the API must not perform any actual load into DSP memory, and must assume that the DSP is already loaded and ready to run.
  3. PROC_start()
    starts the DSP running as always.

Steps to add the loader

1. Copy-paste an existing loader:

  • Copy files $(DSPLINK)/gpp/src/gen/PrOS/Davinci/static_loader.* into $(DSPLINK)/gpp/src/gen folder.
  • Rename these files as myloader.c and myloader.h
  • Update SOURCES file within the $(DSPLINK)/gpp/src/gen folder to include myloader.c for build.
  • Now, modify file $(DSPLINK)/gpp/src/ldrv/Jacinto/CFG_map.c to add support for this new loader into DSPLink. Add the following into the CFGMAP_LoaderObjects object.
  • Modify the file $(DSPLINK)/gpp/src/ldrv/[PLATFORM]/CFG_map.c to add support for this new loader into DSPLink. Add the following into the CFGMAP_LoaderObjects object.
{
    "MYLOADER",                // NAME           : Name of the loader <br>
    &MYLOADER_Interface        // INTERFACE      : Loader interface table <br>
}

2. Change the $(DSPLINK)/config/all/CFG_[PLATFORM].c to use the MYLOADER instead of the COFF loader, which is default. This is indicated by the following field in the LINKCFG_dspObjects object:

    "MYLOADER",                 // LOADERNAME     : Name of the DSP executable loader

This configures DSPLink to use this new loader.

3. Now the loader must be written. For this, the following functions need to be implemented:

  • MYLOADER_init()
  • MYLOADER_exit()
  • MYLOADER_load()
  • MYLOADER_getSymbolAddress()
  • MYLOADER_loadSection(): This function can be implemented to directly return DSP_ENOTIMPL error code, as this functionality is not currently supported within DSPLink.

4. Open the file myloader.h. Search-replace all instances of STATICLOADER -> MYLOADER

5. Open the file myloader.c. Search-replace all instances of STATICLOADER -> MYLOADER

6. Now the structure must be defined, which is used to pass information to PROC_load about the pre-loaded DSP executable file. This structure must contain at least the following information, which is required by DSPLink:

  • dspRunAddr: DSP address from where the binary file execution is to be started.
  • argsAddr: Address of the .args section within the DSP executable.
  • argsSize: Size of the .args section within the DSP executable.
  • shmBaseAddr: Address of the symbol where the DSPLink shared memory base address is stored.

This structure can be defined within the $(DSPLINK)/gpp/inc/loaderdefs.h file. For example, refer to the STATICLOADER_ImageInfo structure within this file. The information in this structure can be filled by the application by parsing the DSP COFF executable. Tools/utilities are available for getting this information from a COFF file.

7. Implement MYLOADER_load() function to use the provided parameters with PROC_load() and:

  • Fill the .args section in required format with user specified arguments. The information needed for this is argsAddr and argsSize received from PROC_load() parameters.
  • Store the address of the symbol where the DSPLink shared memory base address is stored, within a local array (similar to how it is done currently in the static loader). This information shmBaseAddr is also received from PROC_load() parameters. This is the address of the DSPLINK_shmBaseAddress symbol within the DSP COFF file.
  • Return the entryPt of the DSP executable. This information dspRunAddr is also received from PROC_load() parameters.

8. Build the DSPLink GPP-side after these changes.

9. Make any required changes to the operating system bootloader to pre-load the DSP executable.