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.

Add assembly code to Code Composer Studio

Other Parts Discussed in Thread: MSP430F2274

I generated assembly code with Code Composer Studio to check its output and understand how it works.

However, when I try to add the compiled file into the project, it is full of errors. Am I missing something ?

What is the correct way to add ASM code ?

I attached the generated ASM file. I tried erasing everything but the function called function, but errors remain there.

2018.main.asm

It has .asm extension, isn't it recognizing it ?

Thank you.

  • That webpage is about creating Makefiles. I only found 3 entries on keyword asm, and they were not related.

    Any other site ? A guide on ASM syntaxis would be also helpful.

    Thank you.

  • Try this

        • File -> New -> CCS Project
        • Enter Project name
        • Choose Family: MSP430
        • Choose Variant: MSP430Fx2xx Family / MSP430F2274
        • Under Project templates and examples, select Empty Project -> Empty Assembly-only Project
        • Finally, click on Finish
        • Now left-click on your project on the left and go to properties. We need to set the output format to "legacy COFF". If it says "eabi (ELF)", change it. Then click OK.

    1. Right click on main.asm and delete from the file system.
    2. Using Project -> Add Files..., Copy the assembly code you want to add into your project.
    3. Compile by hitting the green bug button (the debug button), and hit 'F8' to run the program on your LaunchPad development tool.
    4. Start working your project and remember not to break your code!

    This solutuion is referenced from https://students.cs.byu.edu/~cs224ta/references/HowTos/HowTo_SetupAsmProject.php

    Hope this helps

    Kishen

  • Looks like this is a full ASM project. I don't need that.

    I need to add asm code, but I have C code too. What I really need is to create callable subroutines in ASM.

    Also, I need the output to be ELF format.

    Thanks.

  • So are you trying to execute C and assembly in the same project and you want to know how to reference the assembly code through C ?
    See this e2e thread. This may help solve your issue.
    e2e.ti.com/.../99048
    Most of these kind of problems will be addresed in the CCS forumThanksKishen
  • Yes, I want both C and ASM subroutines, however,  the problem is not how to call the subroutines.

    I think I clearly explained it on the first post:

    Jon Zarate said:
    hen I try to add the compiled file into the project, it is full of errors

    The compiler is not accepting the ASM file that itself generated.

    My ASM file is in the first post. You can try to use it in your own project and tell me if you get any errors.

    Thank you.

  • I solved it. The problem was I was using same file names: main.c and main.asm.

    Once changed them, all errors are gone. Here is the code that switches on the green led (4.7) on a MSP430-5529.

    main.c

    #include <msp430.h>
    
    extern int function ();
    
    int main(void) {
        WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
    	
        function ();
    
    	return 0;
    }

    subroutines.asm

    	.sect	".text:function"
    	.clink
    	.global	function
    
    
    function:
    ;* --------------------------------------------------------------------------*
            OR.B      #128,&PBDIR_H+0       ; []
            OR.B      #128,&PBOUT_H+0
            RETA      ; [] 
            ; [] 
    
    
    
    	.global	PBOUT_H
    	.global	PBDIR_H

    Thanks.

**Attention** This is a public forum