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.

MSP430FG437: Assembly Language in C file.

Part Number: MSP430FG437
Other Parts Discussed in Thread: MSP430FR2433

Hi, 

I have questions about using assembly language in C.

I made and compiled two projects using CCS and IAR

source code is only below.

#include <msp430.h> 

void main(void)
{
      WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer

      asm("mov.w #0x80,R4");
      asm("bic.w R4,&0920h");
      asm("bic.w R4,&0922h");

}

The project created in CCS has compile error, compiling of the project created in IAR is complete.

**** Build of configuration Debug for project test ****

"C:\\ti\\ccs1020\\ccs\\utils\\bin\\gmake" -k -j 8 all -O

Building file: "../main.c"
Invoking: MSP430 Compiler
"C:/ti/ccs1020/ccs/tools/compiler/ti-cgt-msp430_20.2.2.LTS/bin/cl430" -vmspx --use_hw_mpy=F5 --include_path="C:/ti/ccs1020/ccs/ccs_base/msp430/include" --include_path="C:/Work/Project/Inbody/test" --include_path="C:/ti/ccs1020/ccs/tools/compiler/ti-cgt-msp430_20.2.2.LTS/include" --advice:power=all --advice:hw_config=all --define=__MSP430FR2433__ -g --printf_support=minimal --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
4 Assembly Errors, No Assembly Warnings

>> Compilation failure
subdir_rules.mk:9: recipe for target 'main.obj' failed
warning: "../main.c", line 11: Assembly statement "mov.w #0x80,R4" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.
warning: "../main.c", line 12: Assembly statement "bic.w R4,&0920h" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.
warning: "../main.c", line 13: Assembly statement "bic.w R4,&0922h" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.
warning: "../main.c", line 11: Assembly statement "mov.w #0x80,R4" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.
warning: "../main.c", line 12: Assembly statement "bic.w R4,&0920h" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.
warning: "../main.c", line 13: Assembly statement "bic.w R4,&0922h" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.
"C:\Users\137657\AppData\Local\Temp\{95297413-E402-454D-80EC-C757EADDB698}", ERROR! at line 59: [E0002] Illegal mnemonic specified
mov.w #0x80,R4

"C:\Users\137657\AppData\Local\Temp\{95297413-E402-454D-80EC-C757EADDB698}", ERROR! at line 61: [E0002] Illegal mnemonic specified
bic.w R4,&0920h

"C:\Users\137657\AppData\Local\Temp\{95297413-E402-454D-80EC-C757EADDB698}", ERROR! at line 63: [E0300] Symbol bic has already been defined
bic.w R4,&0922h

"C:\Users\137657\AppData\Local\Temp\{95297413-E402-454D-80EC-C757EADDB698}", ERROR! at line 63: [E0002] Illegal mnemonic specified
bic.w R4,&0922h


Errors in Source - Assembler Aborted
gmake: *** [main.obj] Error 1
gmake: Target 'all' not remade because of errors.

But the code below has no error.

asm(" ; This is test line" ) ;

I think depending on the code in asm statement, an error occurs.

**Attention** This is a public forum