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.

Compiler/LAUNCHCC3220MODASF: Using a Makefile with CCS and assembly files

Part Number: LAUNCHCC3220MODASF

Tool/software: TI C/C++ Compiler

Hey guys,

I'm currently trying to compile some code using Code Composer Studio and a Makefile. It's currently working fine with .c and .cpp files, but I'm trying to include the PowerCC32XX_asm.asm file in the makefile and I've been having issues. I assume the tool I want to use to compile assembly files is armcl.exe? Or do I want to use armar.exe or armasm.exe? Also, what is the format for compiling using any of these. I've been using gcc and g++ for the c and c++ files, so I don't have much experience with these executables yet.

Thank you in advance!

Charles

  • Charles Fleck1 said:
    I've been using gcc and g++ for the c and c++ files

    Are you using those precise names for the compiler?  Those tools don't build code for the ARM CPU in your system, but for your host system (a laptop, or something similar).  Use the GCC ARM compiler named arm-none-eabi-g++.  It uses the file extension to know how to build a source file.  The file extension .c means C, .cpp means C++, and .s means assembly.  Lots of other extensions are recognized, but these are the usual ones.

    Charles Fleck1 said:
    I assume the tool I want to use to compile assembly files is armcl.exe?

    That's the TI ARM compiler.  Use either the GCC ARM compiler, or the TI ARM compiler.  Not both in the same project.  Not because it impossible to mix these compilers.  Just because, as a practical matter, it is hard to organize a project that uses more than one compiler.

    All that said, it is practical for one ARM compiler to link in a library that is built using the other ARM compiler.

    Thanks and regards,

    -George

  • Hey George,

    We are currently using arm-eabi-gcc for .c files and arm-eabi-g++ for .cpp files. The TI assembly files have an extension .asm, not .s, and it doesn't seem like any of the arm-eabi compilers are able to compile them. I would prefer not to rewrite our entier Makefile to use the TI ARM compiler, is it possible to use the GCC ARM compiler to compile .asm files?

    I did try using the armasm.exe compiler, but it is giving me a bunch of assembly errors that I've pasted at the end of this message.

    Thanks again!

    Charles

    11:57:22 **** Incremental Build of configuration Default for project new_sensor ****
    make Build_CCS/Makefile all
    make: Nothing to be done for '../Build_CCS/Makefile'.
    C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armasm --cpu=list ../ti/drivers/power/PowerCC32XX_asm.asm
    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 35: [E0002]
    Illegal mnemonic specified
    PRESERVE8

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 37: [E0002]
    Illegal mnemonic specified
    PUBLIC PowerCC32XX_enterLPDS

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 38: [E0002]
    Illegal mnemonic specified
    PUBLIC PowerCC32XX_resumeLPDS

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 40: [E0002]
    Illegal mnemonic specified
    EXTERN PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 41: [E0002]
    Illegal mnemonic specified
    EXTERN PRCMLPDSRestoreInfoSet

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 50: [E0002]
    Illegal mnemonic specified
    SECTION CODE:CODE:NOROOT

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 51: [E0002]
    Illegal mnemonic specified
    THUMB

    "../ti/drivers/power/PowerCC32XX_asm.asm", WARNING! at line 55: [W0004]
    Invalid instruction modifier(s) ignored
    mov32 r1, PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 55: [E0001]
    Undefined symbol
    mov32 r1, PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 55: [E0004]
    Illegal operand
    mov32 r1, PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 56: [E0004]
    Status register unsupported by this architecture.
    mrs r0,msp

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 58: [E0004]
    Status register unsupported by this architecture.
    mrs r0,psp

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 60: [E0004]
    Status register unsupported by this architecture.
    mrs r0,primask

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 62: [E0004]
    Status register unsupported by this architecture.
    mrs r0,faultmask

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 64: [E0004]
    Status register unsupported by this architecture.
    mrs r0,basepri

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 66: [E0004]
    Status register unsupported by this architecture.
    mrs r0,control

    "../ti/drivers/power/PowerCC32XX_asm.asm", WARNING! at line 69: [W0004]
    Invalid instruction modifier(s) ignored
    mov32 r1, PowerCC32XX_resumeLPDS

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 69: [E0004]
    Illegal operand
    mov32 r1, PowerCC32XX_resumeLPDS

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 70: [E0001]
    Undefined symbol
    bl PRCMLPDSRestoreInfoSet

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 79: [E0002]
    Illegal mnemonic specified
    SECTION CODE:CODE:NOROOT

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 80: [E0002]
    Illegal mnemonic specified
    THUMB

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 82: [E0001]
    Undefined symbol
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 82: [E0003]
    Unexpected trailing operand(s)
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 83: [E0001]
    Undefined symbol
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 83: [E0003]
    Unexpected trailing operand(s)
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 84: [E0001]
    Undefined symbol
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 84: [E0003]
    Unexpected trailing operand(s)
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 85: [E0001]
    Undefined symbol
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 85: [E0003]
    Unexpected trailing operand(s)
    nop.w

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 86: [E0002]
    Instruction only available in V6M0 and V7 and higher
    dsb

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 87: [E0002]
    Instruction only available in V6M0 and V7 and higher
    isb

    "../ti/drivers/power/PowerCC32XX_asm.asm", WARNING! at line 88: [W0004]
    Invalid instruction modifier(s) ignored
    mov32 r1, PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 88: [E0001]
    Undefined symbol
    mov32 r1, PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 88: [E0004]
    Illegal operand
    mov32 r1, PowerCC32XX_contextSave

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 90: [E0004]
    Status register unsupported by this architecture.
    msr control,r0

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 92: [E0004]
    Status register unsupported by this architecture.
    msr msp,r0

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 94: [E0004]
    Status register unsupported by this architecture.
    msr psp,r0

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 96: [E0004]
    Status register unsupported by this architecture.
    msr primask,r0

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 98: [E0004]
    Status register unsupported by this architecture.
    msr faultmask,r0

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 100: [E0004]
    Status register unsupported by this architecture.
    msr basepri,r0

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 102: [E0002]
    Instruction only available in V6M0 and V7 and higher
    dsb

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 103: [E0002]
    Instruction only available in V6M0 and V7 and higher
    isb

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at line 106: [E0002]
    Illegal mnemonic specified
    END

    "../ti/drivers/power/PowerCC32XX_asm.asm", ERROR! at EOF: [E0300]
    The following symbols are undefined:
    41 Assembly Errors, 3 Assembly Warnings
    PRCMLPDSRestoreInfoSet
    .w
    PowerCC32XX_contextSave

    Errors in Source - Assembler Aborted
    Makefile:401: recipe for target 'dbg/PowerCC32XX_asm.o' failed
    make: *** [dbg/PowerCC32XX_asm.o] Error 1

  • Charles Fleck1 said:
    We are currently using arm-eabi-gcc for .c files and arm-eabi-g++ for .cpp files.

    You can simplify that.  Just use arm-eabi-g++ for both C files and C++ files.  

    I don't recognize those names.  You must be using a GCC ARM compiler that is not released by TI.  Strictly speaking, this forum only supports compilers released by TI.  However, it is a good guess all GCC ARM compilers have the same interface, so my answers are probably correct.

    Charles Fleck1 said:
    is it possible to use the GCC ARM compiler to compile .asm files?

    Apparently, you don't want to rename the files from .asm to .s . So, yes.  When building a .asm file, add this option: -x assembler

    Charles Fleck1 said:
    I did try using the armasm.exe compiler, but it is giving me a bunch of assembly errors

    There are differences in assembly syntax between the GCC ARM tools and TI ARM tools.  The instructions are the same.  But the assembler directives are different.  It is likely your assembly files use the directives expected by the GCC ARM tools.

    Thanks and regards,

    -George

  • Hey George,

    I have confirmed that I can use arm-eabi-g++ to compile both .c and .cpp files, but I'm still having trouble with the assembly file. I tried arm-eabi-g++ -x assembler PowerCC32XX_asm.asm, but it spit out a bunch of errors. It looks like it's trying to compile a .s file, not a .asm file, as it doesn't recognize ; as a comment. I confirmed this by changing ; to @ and it then recognizes them as comments. I've attached the errors to the bottoms of this message.

    Thanks!

    Charles

    make Build_CCS/Makefile all
    make: Nothing to be done for '../Build_CCS/Makefile'.
    C:\qp\qtools\gnu_arm-eabi/bin/arm-eabi-g++ -x assembler ../ti/drivers/power/PowerCC32XX_asm.asm
    ../ti/drivers/power/PowerCC32XX_asm.asm: Assembler messages:
    ../ti/drivers/power/PowerCC32XX_asm.asm:2: Error: bad instruction `copyright (c)2015-2016,Texas Instruments Incorporated'
    ../ti/drivers/power/PowerCC32XX_asm.asm:3: Error: bad instruction `all rights reserved.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:5: Error: bad instruction `redistribution and use in source and binary forms,with or without'
    ../ti/drivers/power/PowerCC32XX_asm.asm:6: Error: bad instruction `modification, are permitted provided that the following conditions'
    ../ti/drivers/power/PowerCC32XX_asm.asm:7: Error: bad instruction `are met:'
    ../ti/drivers/power/PowerCC32XX_asm.asm:9: Error: junk at end of line, first unrecognized character is `*'
    ../ti/drivers/power/PowerCC32XX_asm.asm:10: Error: bad instruction `notice, this list of conditions and the following disclaimer.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:12: Error: junk at end of line, first unrecognized character is `*'
    ../ti/drivers/power/PowerCC32XX_asm.asm:13: Error: bad instruction `notice, this list of conditions and the following disclaimer in the'
    ../ti/drivers/power/PowerCC32XX_asm.asm:14: Error: bad instruction `documentation and/or other materials provided with the distribution.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:16: Error: junk at end of line, first unrecognized character is `*'
    ../ti/drivers/power/PowerCC32XX_asm.asm:17: Error: bad instruction `its contributors may be used to endorse or promote products derived'
    ../ti/drivers/power/PowerCC32XX_asm.asm:18: Error: bad instruction `from this software without specific prior written permission.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:20: Error: bad instruction `this SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"'
    ../ti/drivers/power/PowerCC32XX_asm.asm:21: Error: ARM register expected -- `and ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT LIMITED TO,'
    ../ti/drivers/power/PowerCC32XX_asm.asm:22: Error: bad instruction `the IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR'
    ../ti/drivers/power/PowerCC32XX_asm.asm:23: Error: bad instruction `purpose ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR'
    ../ti/drivers/power/PowerCC32XX_asm.asm:24: Error: bad instruction `contributors BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,'
    ../ti/drivers/power/PowerCC32XX_asm.asm:25: Error: bad instruction `exemplary, OR CONSEQUENTIAL DAMAGES(INCLUDING,BUT NOT LIMITED TO,'
    ../ti/drivers/power/PowerCC32XX_asm.asm:26: Error: bad instruction `procurement OF SUBSTITUTE GOODS OR SERVICES'
    ../ti/drivers/power/PowerCC32XX_asm.asm:26: Error: bad instruction `loss OF USE,DATA,OR PROFITS'
    ../ti/drivers/power/PowerCC32XX_asm.asm:27: Error: bad instruction `or BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,'
    ../ti/drivers/power/PowerCC32XX_asm.asm:28: Error: bad instruction `whether IN CONTRACT,STRICT LIABILITY,OR TORT(INCLUDING NEGLIGENCE OR'
    ../ti/drivers/power/PowerCC32XX_asm.asm:29: Error: bad instruction `otherwise) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,'
    ../ti/drivers/power/PowerCC32XX_asm.asm:30: Error: bad instruction `even IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:33: Error: junk at end of line, first unrecognized character is `='
    ../ti/drivers/power/PowerCC32XX_asm.asm:35: Error: bad instruction `preserve8'
    ../ti/drivers/power/PowerCC32XX_asm.asm:37: Error: bad instruction `public PowerCC32XX_enterLPDS'
    ../ti/drivers/power/PowerCC32XX_asm.asm:38: Error: bad instruction `public PowerCC32XX_resumeLPDS'
    ../ti/drivers/power/PowerCC32XX_asm.asm:40: Error: bad instruction `extern PowerCC32XX_contextSave'
    ../ti/drivers/power/PowerCC32XX_asm.asm:41: Error: bad instruction `extern PRCMLPDSRestoreInfoSet'
    ../ti/drivers/power/PowerCC32XX_asm.asm:44: Error: junk at end of line, first unrecognized character is `='
    ../ti/drivers/power/PowerCC32XX_asm.asm:45: Error: bad instruction `function saves the ARM registers in the contextSave structure.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:46: Error: condition required -- `it calls PRCMLPDSRestoreInfoSet with the resume SP and the'
    ../ti/drivers/power/PowerCC32XX_asm.asm:47: Error: bad instruction `powercc32xx_resumelpds function.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:48: Error: bad instruction `finally, it calls the LPDS entry function to go to LPDS.'
    ../ti/drivers/power/PowerCC32XX_asm.asm:50: Error: bad instruction `section CODE:CODE:NOROOT'
    ../ti/drivers/power/PowerCC32XX_asm.asm:51: Error: bad instruction `thumb'
    ../ti/drivers/power/PowerCC32XX_asm.asm:55: Error: bad instruction `mov32 r1,PowerCC32XX_contextSave'
    ../ti/drivers/power/PowerCC32XX_asm.asm:56: Error: selected processor does not support requested special purpose register -- `mrs r0,msp'
    ../ti/drivers/power/PowerCC32XX_asm.asm:58: Error: selected processor does not support requested special purpose register -- `mrs r0,psp'
    ../ti/drivers/power/PowerCC32XX_asm.asm:60: Error: selected processor does not support requested special purpose register -- `mrs r0,primask'
    ../ti/drivers/power/PowerCC32XX_asm.asm:62: Error: selected processor does not support requested special purpose register -- `mrs r0,faultmask'
    ../ti/drivers/power/PowerCC32XX_asm.asm:64: Error: selected processor does not support requested special purpose register -- `mrs r0,basepri'
    ../ti/drivers/power/PowerCC32XX_asm.asm:66: Error: selected processor does not support requested special purpose register -- `mrs r0,control'
    ../ti/drivers/power/PowerCC32XX_asm.asm:69: Error: bad instruction `mov32 r1,PowerCC32XX_resumeLPDS'
    ../ti/drivers/power/PowerCC32XX_asm.asm:71: Error: bad instruction `branch to stashed enter LPDS function pointer'
    ../ti/drivers/power/PowerCC32XX_asm.asm:74: Error: bad instruction `should never get here!'
    ../ti/drivers/power/PowerCC32XX_asm.asm:77: Error: junk at end of line, first unrecognized character is `='
    ../ti/drivers/power/PowerCC32XX_asm.asm:79: Error: bad instruction `section CODE:CODE:NOROOT'
    ../ti/drivers/power/PowerCC32XX_asm.asm:80: Error: bad instruction `thumb'
    ../ti/drivers/power/PowerCC32XX_asm.asm:82: Error: unexpected character `w' in type specifier
    ../ti/drivers/power/PowerCC32XX_asm.asm:82: Error: bad instruction `nop.w'
    ../ti/drivers/power/PowerCC32XX_asm.asm:83: Error: unexpected character `w' in type specifier
    ../ti/drivers/power/PowerCC32XX_asm.asm:83: Error: bad instruction `nop.w'
    ../ti/drivers/power/PowerCC32XX_asm.asm:84: Error: unexpected character `w' in type specifier
    ../ti/drivers/power/PowerCC32XX_asm.asm:84: Error: bad instruction `nop.w'
    ../ti/drivers/power/PowerCC32XX_asm.asm:85: Error: unexpected character `w' in type specifier
    ../ti/drivers/power/PowerCC32XX_asm.asm:85: Error: bad instruction `nop.w'
    ../ti/drivers/power/PowerCC32XX_asm.asm:88: Error: bad instruction `mov32 r1,PowerCC32XX_contextSave'
    ../ti/drivers/power/PowerCC32XX_asm.asm:90: Error: selected processor does not support requested special purpose register -- `msr control,r0'
    ../ti/drivers/power/PowerCC32XX_asm.asm:92: Error: selected processor does not support requested special purpose register -- `msr msp,r0'
    ../ti/drivers/power/PowerCC32XX_asm.asm:94: Error: selected processor does not support requested special purpose register -- `msr psp,r0'
    ../ti/drivers/power/PowerCC32XX_asm.asm:96: Error: selected processor does not support requested special purpose register -- `msr primask,r0'
    ../ti/drivers/power/PowerCC32XX_asm.asm:98: Error: selected processor does not support requested special purpose register -- `msr faultmask,r0'
    ../ti/drivers/power/PowerCC32XX_asm.asm:100: Error: selected processor does not support requested special purpose register -- `msr basepri,r0'
    ../ti/drivers/power/PowerCC32XX_asm.asm:106: Error: bad instruction `end'
    Makefile:401: recipe for target 'dbg/PowerCC32XX_asm.o' failed
    make: *** [dbg/PowerCC32XX_asm.o] Error 1

  • This file PowerCC32XX_asm.asm has been rejected by the TI ARM assembler and the GCC ARM assembler.  You need to get with whoever supplies that file.  Ask them which assembler and build options to use.

    Thanks and regards,

    -George

  • Hey George,

    The PowerCC32XX_asm.asm file actually is a TI file. It is part of the Simplelink library that you guys make, which is why I assumed I should be able to compile it with the TI compiler somehow. It's used in the power management example you guys have. Do you have any hints on how you guys compile this file in that example? I tried checking the compiler output and it looks like it may be being built as part of one of your libraries. Am I supposed to build the Simplelink library using my Makefile? And if so, how do I do that?

    Edit: I have discovered that the arm-eabi-g++ -x assembler -mcpu=cortex-m4 -mfloat-abi=soft PowerCC32XX_asm.sm4g does a lot better at compiling, so I think the .sm4g file may be the correct one to use for g++. The issues it has now are with some variables that are defined in a .c file.

    I think either being able to compile the library or being able to get the .sm4g file compiling with g++ should resolve my issue, so any help with either of those would be apprecitated.

    Thank you!

    Charles

  • Hey George,

    I got it figured out. The PowerCC32XX_asm.sm4g file actually contains the same assembler code as PowerCC32XX_asm.asm, but it's formatted for arm-eabi-g++ (and I assume arm-eabi-gcc as well, but I didn't test this). To compile the file you just need to do:

    arm-eabi-g++ -c -x assembler -mcpu=cortex-m4 -mfloat-abi=soft PowerCC32XX_asm.sm4g

    Thanks for the help!

    Charles