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.

Assembly Compile Errors using Code Composer Studio

Other Parts Discussed in Thread: MSP430F1610

Hi,

I'm compiling assembly code on Code Composer Studio with MSP430F1610 as the target...

The first line of code is

>> .equ DCOCTL,    0x0056

and it generates the error

>> error: expected a declaration

Does the compiler expect a directive or something like that at the start of an assembly file? The code examples have .cdecls C,LIST, "msp430x16xx.h" at the head of each file, but adding that still produced the error.

Also the line of code

>> mov.w   #10000, r11

generates the error
>> error: "#" not expected here
I'm not sure whats wrong with the syntax.

Again in another file,

The line

>> DCOCTL    .equ  0x0056

generates 2 errors...

>> error: this declaration has no storage class or type specifier
>> error: expected a ";"

and again the line

>> mov.w   #10000, r11

generates

>> error: expected a ";"

Any help would be appreciated,

Karan.

 

  • Karan,

    could it be that you are trying to compile your assembler file? From the error messages it looks like that the C compiler is trying to digest your source code. You will need to give your file the .asm extension so that the assembler will get invoked.

    Regards,
    Andreas

  • Hi,

    That fixed the problem. The code is originally from freemodbus and the files had a .S extension. After renaming, the assembler was invoked and it threw up errors such as

    "../dco-rowley.asm", ERROR!   at line 119: [E0200] Bad term in expression
            bit.w   #CCIFG, &TACCTL2    /* Test capture flag */

    "../dco-rowley.asm", REMARK   at line 119: [R0001] After symbol substitution the line became:
            bit.w   #(0x0001), &TACCTL2    /* Test capture flag */

    "../dco-rowley.asm", ERROR!   at line 119: [E0004] Immediate/Absolute/Symbolic expression expected
            bit.w   #CCIFG, &TACCTL2    /* Test capture flag */

    The code looks legal to me, It was originally written on Rowley Crossworks, and that could be the reason its compiling with errors on CCS. With some more research I hope to fix these errors...any pointers would be helpful.

    Thanks,

    Karan.

  • It looks like TACCTL2 is unknown to the assembler.

    Or the brackets in the definition of CCIFG (you see them in the second message) are not allowed.

    For a test, replace the TACCTL2 by a number and try. If the error persists, the assembler does not like the brackets in CCIFG, else the declaration for TACCTL2 is missing. It is also possible that the compiler does not like the 0x00 hex file notation and rather needs the 00h notation. Maybe the way you include the header files makes a difference too. Check your header files and the include statements. Also, some processors (such as the 5438) do not have a TACCTL2 but rather a TA0CCTL2 and TA1CCTL2, but on the 1610, TACCTL2 is correct.

    As you said, the code example is from a different compiler suite. So the header files in this environment are different too as well as some assembler directives. There might be incompatible differences.

  • Hi,

     

    The errors were due to a stupid mistake of mine. The program had all the registers defined in the beginning, so since I added the header file, everything was defined twice.

    I commented out all the definitions and it helped. Also, all the comments were in C format /* */ , placed a ';' in front of them and the program suddenly compiled cleanly.

    Thanks for taking the time off to help :) If I do run into any other errors, I'll post back.

     

    Regards,

    Karan.

  • Hi, did you get the modbus working?

    I'm trying to do the same, with the freemodbus and ccs, but i don't understand what you did.

    1. I renamed the .S to .asm

    2. Put ; in instead of * and /* */

    3. Comment the definitions

    ;.equ TACTL, 0x0160 /* Timer A 0 Control */
    ;.equ TACCTL2, 0x0166 /* Timer A 0 Capture/Compare Control 2 */

    ...

    But I keep getting the error E0000x mnemonic Ilegal.

    Could you give some help?

    Thanks

**Attention** This is a public forum