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.

CCS - mixin C and ASM for MSP430

Other Parts Discussed in Thread: MSP430FG4618

There was a document before for IAR's release on how to mix C and ASM for MSP430 series. Is there such a turorial for CCS too? Please link if there is

  • Istvan,

    The two manuals for the MSP430 code generation tools contain useful information about mixing assembly and C.

    - Section 6.5 of MSP430 C/C++ Optimizing Compiler User's guide

    - Chapter 12 of MSP430 Assembly Language Tools User's guide

    Links to both books can be found at the page below:

    http://processors.wiki.ti.com/index.php/Before_asking_for_CGT_support

    Hope this helps,

    Rafael

     

  • Yeah I think this is the help I needed. Thanks

  • Hello,

    I am experience a problem wiht the inline assembler in a CCS v.4.2.1.00004. The code is as follows:

    ______________________________________

    #pragma

     

     

    vector=TIMERA0_VECTOR

    __interrupt

    void Timer_A (void)

    {

     

    //asm("mov #10, R15");

     

    unsigned int i=0;

     

    asm("MOV.W #1,R12");

    ....

    ______________________________________

     

    I obtain the the following problem:

    C:\Texas\ccsv4\utils\gmake\gmake -k all

    'Building file: ../main.c'

    'Invoking: Compiler'

    "C:/Texas/ccsv4/tools/compiler/msp430/bin/cl430" -vmspx --define=__MSP430FG4618__ --include_path="C:/Texas/ccsv4/msp430/include" --include_path="C:/Texas/ccsv4/tools/compiler/msp430/include" --diag_warning=225 --printf_support=minimal --preproc_with_compile --preproc_dependency="main.pp" "../main.c"

    "C:\Users\Janiex\AppData\Local\Temp\0516411", ERROR! at line 330:

    [E0002]

    Illegal mnemonic specified

    MOV.W #1,R12

     

    1 Assembly Error, No Assembly Warnings

     

    Errors in Source - Assembler Aborted

     

    >> Compilation failure

    gmake: *** [main.obj] Error 1

    gmake: Target `all' not remade because of errors.

    Build complete for project ASM

    _____________________

    Can someone help?

     TIA

     

  • Hello again,

    I found out what is the problem! It is in the way the inline assembler statement is composed. The inline assembler does not accept instruction starts from the first row:"

     

     

     

     

     

    asm

     

    ("PUSHM.A #1,R15");

     

    This is possible only for labels. For instruction it is necessary to have on space in the statement between " and first letter of the instruction. The correct one is:

    asm

     

    (" PUSHM.A #1,R15");

     

     

    I hope it will be helpful for someone!

    Now I have another problem. Does someone one know how to prevent the epilog in ISR - not to have stored any registers on the stack?

     

    Regards

  • Hello Kristian,

    Kristian Dilov said:
    Now I have another problem. Does someone one know how to prevent the epilog in ISR - not to have stored any registers on the stack?

    I'd suggest starting a new thread in the Compiler forum.

    Thanks

    ki

  • Thank you for your post Kristian. It helped me