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.

Inline assembly in CCS 5.3.0

Hello everyone,

I'm trying to enable the FPU with some assembly code from the datasheet but everytime I run the debugger, I receive the following error:

Load program Error.

Encounterd a problem loading file: C:\....

Could not open file.

This is the assembly code:

asm ( " LDR.W R0, =0xE000ED88"
" LDR R1, [R0]"
" ORR R1, R1, #(0xF << 20)"
" STR R1, [R0]"
" DSB"
" ISB");

  • Hello,

    The file that it cannot find is the actual compiled executable (*.out). Was the build successful? Check the build console to see if the build was successful. If not, then trying to debug the project will fail since there is no program to load.

    Thanks

    ki

  • Hello,

    You are indeed right, the build wasn't succesful. This is the error:

    Illegal mnemonic specified
    LDR.W R0, = 0xE000ED88LDR R1, [R0]ORR R1, R1, #(0xF << 20)STR R1, [R0]DSBISB

    How can I solve this error?

  • I will move your question to the compiler forums. The experts there can provide the answers you need.

    Thanks

    ki

  • Put newlines in your string constant:

    asm ( " LDR.W R0, =0xE000ED88\n"
    " LDR R1, [R0]\n"
    " ORR R1, R1, #(0xF << 20)\n"
    " STR R1, [R0]\n"
    " DSB\n"
    " ISB\n");
  • I already tried but still an error. This is the error for every line of the assembly:

    Illegal mnemonic specified

  • The first line uses ARM Ltd. syntax, which the TI assembler doesn't support.  Try this instead:

     MOVW R0, #0xE000
     MOVT R0, #0xED88

    If that doesn't work, please post the exact text of the error message you are seeing.

  • Btw I've just put the asm code at the top of my main. Maybe the asm must be declared somewhere else? Or is there another way to enable the FPU?

  • Still doesn't work, here is the text:


    **** Build of configuration Debug for project CAN_SEND_v6 ****

    "C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all
    'Building file: ../main.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv5/tools/compiler/arm_5.0.1/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --include_path="C:/ti/ccsv5/tools/compiler/arm_5.0.1/include" --include_path="C:/Stellarisware/boards/ek-lm4f232" --include_path="C:/Stellarisware" --include_path="C:/Stellarisware/third_party" --gcc --define=ccs="ccs" --define=PART_LM4F232H5QD --define=TARGET_IS_BLIZZARD_RA1 --diag_warning=225 --display_error_number --gen_func_subsections=on --ual --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
    "../main.c", line 281: warning #179-D: variable "temp" was declared but never referenced
    "C:\Users\Ilias\AppData\Local\Temp\0280410", ERROR! at line 1609:
    [E0002]
    Illegal mnemonic specified
    MOVW R0, #0xE000

    "C:\Users\Ilias\AppData\Local\Temp\0280410", ERROR! at line 1610:
    [E0002]
    Illegal mnemonic specified
    MOVT R0, #0xED88LDR R1, [R0]

    "C:\Users\Ilias\AppData\Local\Temp\0280410", ERROR! at line 1611:
    [E0002]
    Illegal mnemonic specified
    ORR R1, R1, #(0xF << 20)

    "C:\Users\Ilias\AppData\Local\Temp\0280410", ERROR! at line 1612:
    [E0002]
    Illegal mnemonic specified
    STR R1, [R0]

    4 Assembly Errors, No Assembly Warnings

    Errors in Source - Assembler Aborted

    >> Compilation failure
    gmake: *** [main.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

  • Make sure there is whitespace on each line before the mnemonic (MOVW, MOVT, etc)

  • Ok guys, errors reduced to 1:

    Unexpected trailing operand(s)
    MOVT R0, #0xED88 LDR R1, [R0]

    Sorry guys, its the first time that I use inline asm in CCS

  • It appears you left out the "\n" between those two instructions.  This wiki article has some pointers on multiple line asm statements.

    Thanks and regards,

    -George

  • Thanks for that,

    Now that I have the code up and running nothing happens.

    The asm is at the top of my main and after that the display should initialize but nothing happens. When I leave out the asm everything works fine. Is it stuck in a loop or something like that?

  • We who watch this forum can't help you with that.  Exactly which ARM device are you using?  Once I know that, I can refer you to the forum for that device.

    Thanks and regards,

    -George