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.

running assembly code on tiva c series launchpad evaluation kit using CCSv5 IDE

I am using CCSv5 IDE with tiva c series launchpad evaluation kit and recently need to run assembly code. I want to use it by the function asm(); but there is a error which is can't open .out file while debugging.

the code i'm executing is simple : 

#include <stdint.h>
#include <stdbool.h>


int main(void)
{

while(1)
{
asm("ADD r0 r1 r0\n" );
}
}

and the vector table and cmd file are OK since I have tried other code and it ran successfully.

here is my project : https://www.dropbox.com/s/720oa64o04k2bvn/Copy%20of%20fibbonacci%2BCRC.rar?dl=0

help, thanks

Chin-po

  • The error "Could not open file" is likely because the .out file was not created. Take a close look at the CCS build console to see if there were any build errors. I suspect there was an error in the line with the asm() statement.

    Assembly statement require the first column to be a label or otherwise be blank. See this related post.

    So you should write it as:

    asm("  ADD r0 r1 r0\n" );

    with one or more spaces after the quote.

    Give that a try and verify first that the build completes without errors and that the .out file is being generated.

  • Thanks AartiG, it is the error exactly what you said, but after adding blank in front of the asm() statements , another error occur:

    INTERNAL ERROR: C:\ti\ccsv5\tools\compiler\arm_5.1.1\bin\armasm.exe experienced a segmentation fault
    while processing section .text file C:\Users\ADMIN\AppData\Local\Temp\1163610 line 60

    This is a serious problem. Please contact Customer
    Support with this message and a copy of the input file
    and help us to continue to make the tools more robust.

    Thanks 

    chin-po

  • chinpo chen said:
    Thanks AartiG, it is the error exactly what you said, but after adding blank in front of the asm() statements , another error occur:

    Can you confirm what line of inline assembler you use in the program?

    I found commas were necessary between the registers. E.g. the following is valid:

    	asm(" ADD r0,r1,r0\n" );
    

    What I found with the version without commas is that:

    1) TI ARM compiler version 5.1.1 reports the following (i.e. crashes):

    INTERNAL ERROR: /opt/ti/ti_ccs6_0/ccsv6/tools/compiler/arm_5.1.1/bin/armasm experienced a segmentation fault
    while processing section .text file /tmp/10155fnt0Hb line 60

    This is a serious problem. Please contact Customer

    2) TI ARM compiler version 5.1.7 reports the following (i.e. reports an invalid assembler line without crashing):

    "/tmp/106386ykfnC", ERROR! at line 59: [E0003] Unexpected trailing operand(s)
    ADD r0 r1 r0


    Errors in Source - Assembler Aborted
    1 Assembly Error, No Assembly Warnings

    Therefore, I think you need to correct the inline assembler line to use commas between the operands. Upgrading to the later TI ARM compiler 5.1.7 would help, as its handling of error in inline assembler appears to have been improved (i.e. points at the line with the error rather than crashing).