DMA Example

This guide contains instructions for how to successfully compile the DMA_Mem_to_Mem_1_KIT_TC499_COM_TRB project using the HighTec LLVM toolchain version 8.0.0. It assumes that the project has been imported into the current workspace.

The following changes are required before the first project build attempt:

  • Wait until the indexer finishes.

  • Right-click on the project, then Project updater  Update iLLD  Finish.

  • Right-click on the project and click on Refresh.

  • Wait until the indexer finishes.

  • Add Lcf_Hightec_Tricore_Dma.lsl linker script adapted specifically for the DMA use case.

The following changes are required to build the project:

  • Right-click on the project, then Build Configurations  Manage  New

    • Give any name

    • Select the option Import predefined, then TriCore Application  External  LLVM  Debug and click OK.

  • Set the newly created configuration to active by clicking on Set Active.

  • Wait until the indexer finishes.

  • Edit the build settings: right-click on the project Properties  C/C++ Build  Settings

    • Click on Settings and Update Path to the LLVM bin directory even though it is not used later on, i.e., "C:\HighTec\toolchains\tricore\v8.0.0\bin" and click on Apply.

    • Under the options for LLVM C Compiler, click on "Miscellaneous" and add -merrata=cpu141, click on Apply.

    • Click on LLVM Linker, extend the command string with -merrata=cpu141 to clang -merrata=cpu141 and click on Apply.

    • Click on LLVM Linker  General and change Linker Script name to ../Lcf_Hightec_Tricore_Dma.lsl and click on Apply and close.

  • Update the file DMA_Mem_to_Mem.c:
    From:

    /* DMA Source buffer for DMA transfer stored inside DSPR0: 0x70000000 */
    uint32 g_dataForDmaTransfer[DATA_ARRAY_LENGTH] __at(0x70000000);
    
    /* DMA Destination buffer stored inside DLMU RAM (of CPU0): 0xB0000000 */
    uint32 g_dmaLmuDestination[DATA_ARRAY_LENGTH]  __at(0xB0000000);

    To:

    #if defined(__TASKING__)
    /* DMA Source buffer for DMA transfer stored inside DSPR0: 0x70000000 */
    uint32 g_dataForDmaTransfer[DATA_ARRAY_LENGTH] __at(0x70000000);
    /* DMA Destination buffer stored inside DLMU RAM (of CPU0): 0xB0000000 */
    uint32 g_dmaLmuDestination[DATA_ARRAY_LENGTH]  __at(0xB0000000);
    
    #elif defined(__HIGHTEC__) && defined(__clang__)
    #pragma clang section bss=".dma.dspr0bss"
    /* DMA Source buffer stored inside .dma.dspr0bss section */
    uint32 g_dataForDmaTransfer[DATA_ARRAY_LENGTH];
    #pragma clang section bss=".dma.dlmu0bss"
    /* DMA Destination buffer stored inside .dma.dlmu0bss */
    uint32 g_dmaLmuDestination[DATA_ARRAY_LENGTH];
    #pragma clang section bss=""
    
    #else
    #error "Unknown compiler"
    #endif
  • Build the project.