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.

_IER undefined?

Other Parts Discussed in Thread: TMS320F2812

Hello,

I have a .cpp file that uses IER. When trying to compile it, it gives:

ERROR!   at EOF: [E0300]
1 Assembly Error, No Assembly Warnings
         The following symbols are undefined:
  _IER

Errors in Source - Assembler Aborted

According to the "TMS320C28x Assembly Language Tools v6.0", section 3.9.5, CPU control registers are predefined, especially IER.

What's going on?

Many thanks for your help,

  Fabrice



  • In C/C++ code, you have to explicitly declare the control registers like this ...

    extern cregister volatile unsigned int IFR;
    extern cregister volatile unsigned int IER;
    Thanks and regards,
    -George
  • Dear George,

    These are already defined in "DSP281x_Device.h" as far as I can see, and I include "DSP281x_Device.h" in my source file.

    I however found out that there is a problem only when I use "IER" directly as an argument of a function call. If I don't use it as an argument, it complies properly?!?!?!

    Strange...

    Thank you anyway,

      Fabrice

  • I cannot reproduce this problem.  Please double-check that the cregister declaration really is present when you compile your file by adding the --preproc_only command-line argument and inspecting the resulting .pp file.  If it is present, and you still get that error message, please post a compilable test case which reproduces the problem.

  • Dear Archeologist,

    To reproduce the problem, create a new project in CCS4 with a target of TMS320F2812. I use CGT 6.0.1.

    Then add a "main.cpp" file and populate it thus:

    #include "DSP281x_Device.h"

    void fn(volatile Uint16& reg)
    {
        reg = 0;
    }

    int main()
    {
        fn(IER);
    }

    Then try to build, and you should get the error.

    Best regards,

      Fabrice

  • The issue here is that you are attempting to create a C++ reference to IER, which is not supported by the TI compiler.  Taking the address of a cregister is also not supported.  The parser ought to have rejected this with an error, and the fact that it did not is a bug (now SDSCM00043533).

    Here's a cutdown test case:

    extern cregister volatile unsigned int IER;
    void fn(volatile unsigned & reg);
    int main() { fn(IER); }

    You'll need to write this code like this:

    void clear_IER(void) { IER = 0; }