This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TM4C1233H6PM: DMA error when setup control table

Part Number: TM4C1233H6PM

Tool/software: TI C/C++ Compiler

Hello everyone, I'm new to the TivaC programming

I'm using DMA to transfer UART FIFO to buffer and it has the following error when I want to setup  uDMA control table aligned to 1024-byte boundary.

.

#pragma DATA_ALIGN(ucControlTable, 1024)

error:

expression must be an integral constant expression

Anyone could help me, thanks in advance

  • Hi Tien,
    Did you try the udma_demo example that comes with the TivaWare library? In it, it uses the same pragma to align the DMA control table to 1024 bytes. If you compile that example do you have the same error? I just tried myself and I don't have the problem. Which version of the CCS and compiler versions are you using?
  • when I build the uDMA_demo it said 


    cannot open source file "drivers/cfal96x64x16.h" cfal96x64x16.c /udma_demo/drivers line 43 C/C++ Problem

    , I use CSS7 and TI v16.9.3.LTS compiler

    Thank you.

  • Hi,

      Normally the example should be ready to compile without user making any changes. Not sure why your include path is not up to date. You need to have your include path to include <TivaWare_Installation>/examples/boards/ek_tm4c123gxl. The drivers folder will be found there.

  • Hi,

    Thanks, I can successfully build the udma_demo.  But when I return to my project, it still have the same error.:

    Description Resource Path Location Type
    #159 expression must be an integral constant expression DMA.cpp /DMA line 27 C/C++ Problem

    I use c++ for my whole project? is this the problem?

    Please help me

    regards.

  • Hi,
    Ok, please see below for using DATA_ALIGN in c++.

    5.10.7 The DATA_ALIGN Pragma
    The DATA_ALIGN pragma aligns the symbol in C, or the next symbol declared in C++, to an alignment
    boundary. The alignment boundary is the maximum of the symbol's default alignment value or the value of
    the constant in bytes. The constant must be a power of 2. The maximum alignment is 32768.
    The DATA_ALIGN pragma cannot be used to reduce an object's natural alignment.
    The syntax of the pragma in C is:
    #pragma DATA_ALIGN ( symbol , constant )
    The syntax of the pragma in C++ is:
    #pragma DATA_ALIGN ( constant )
  • Hello,

    Thank you very much sir, this solved my problems


    Regards.