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.

Need help for mixing assembly language and C in CCE

Other Parts Discussed in Thread: MSP430F435

Hi

I am working on a small task for optimizing processing time for MSP430F435. I want to follow the method with application report SLAA329  "Efficient Multiplication and Division Using MSP430". It provides the source code for IAR workbench, which is mixing C and assembly language. However, I am working on Code Compser Essentials, which cannot work (with errors). I found it is not only the file extension's problem (I have changed from ".43" to ".asm"). Then I have tried another document SLAA140,"Mixing C and Assembler With the MSP430". Unlucky, it is also for IAR workbench, i cannot use same way it descirbed in CCE. Is anyone familiar with CCE assembly rules? Maybe some documents particularly for CCE assembly language? or how to transform from .43 for AVR to .asm for CCE? It is strange CCE and IAR's assembly can not compatible. 

Thanks for advance

Kebin

  • Check out section D of the FET User's Guide, which discusses migration from IAR assembly to CCE assembly: http://www.ti.com/litv/pdf/slau157h

    Unfortunately some app notes only have code for the IAR platform.

  • Thanks for your quick reply. I will look into it [:)]

  • Hi, I am using CCE as well.

    I also have a file ended with .43 which I want to compile it together with my other C code.

     It always pop up illegal message : ellegal mnemonic specified?

    Did you get that work?

  • Hi

    I don't meet this error before, but I think you can try to generate map file to see how it looks like. please see this to get map file hope it helps :)

    http://e2e.ti.com/forums/p/5478/20444.aspx#20444 

  • I have been using CCE for few months and have done several projects in it. I always write them in assembler and sometimes need to call c functions or use c structures. Maybe this could help you: Choose project properties -> TI Build Settings -> and check Configure as an assembly project only

     

    No matter if I use c in my project or not, if I do not check this option and have asm code in my project, I am not able to build it.  

    Note: If you use some "native" functions in your c code like division or conversion between various data types or something like this, you will need to add path to rts430.lib into your project. This can be done in Project Properties -> C/C++ Build -> Tool Settings -> MSP430 Linker -> File Search Path -> Include Library file or command file as input (--library) -> and find rts430.lib

  • Just FYI, the MSP430 Assembly Lanaguage Tools Users Guide, http://www-s.ti.com/sc/techlit/slau131, contains the assembler directives recognized by CCE. Although the MSP430 assembly instructions are the same, the directives are different for IAR and CCE, so you would need to refer to the above Users Guide as well as Appendix D of the FET Users Guide for use with CCE, http://www-s.ti.com/sc/techlit/slau157

    Another common situation that works with IAR but not CCE is when using inline assembly statements within C code. For example, the code

    void func(void){
      asm("mov.w #0001h,R10");
      asm("L1:  NOP");
    }
    will generates "Illegal mnemonic specified" error for the mov.w instruction.

    This is because the TI assembler expects the first character of an assembly statement to either be a label or blank, (ie) the mnemonic cannot appear in the first column. This is documented in the MSP430 Assembly Lanaguage Tools Users Guide, Pg 41.

    So the above code should be modified to:

    void func(void)
    {
    asm(" mov.w #0001h,R10");
    asm("L1: NOP");
    }

    Hope this helps.

**Attention** This is a public forum