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.

CCS Assembly Errors in C code



Hi I have a working project which was developed in KEIL uVision. I Copied the source and want to use it using the Code Composer Studio (v6 beta 4) using Tivaware v2.xxx

I Do not have any Errors shown in the 'Problems' tab, however i see the following errors in the console:

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 345: [E0200] Bad term in expression
ldr r0, =_bss

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 345: [E0001] Illegal symbol
ldr r0, =_bss

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 345: [E0003] Unexpected trailing operand(s)
ldr r0, =_bss

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 346: [E0200] Bad term in expression
ldr r1, =_ebss

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 346: [E0001] Illegal symbol
ldr r1, =_ebss

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 346: [E0003] Unexpected trailing operand(s)
ldr r1, =_ebss

8 Assembly Errors, 1 Assembly Warning
"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 348: [E0002] Illegal mnemonic specified
.thumb_func

"C:\Users\ae0053\AppData\Local\Temp\8080810", ERROR! at line 351: [E0003] Empty or Invalid condition code

>> Compilation failure
it lt

"C:\Users\ae0053\AppData\Local\Temp\8080810", WARNING! at line 352: [W0004] Incorrect condition code inside of IT block
strlt r2, [r0], #4

8 Assembly Errors, 1 Assembly Warning


Errors in Source - Assembler Aborted

 

I have no Idea what to do. Please Help me 

  • Hello Feroze,

    I believe these errors are coming from the startup.c file. In CCS you need to use __c_init00 symbol

    Regards

    Amit

  • Hi,

    The document attached below shows up how to convert projects from Keil to CCS.

    0640.ConvertKeilCCS.pdf

    Petrei

  • Amit Ashara said:

    I believe these errors are coming from the startup.c file. In CCS you need to use __c_init00 symbol

    We bough CANOpen stack from a vendor and they provided a working project example in KEIL uVision. I am not able to make it work in CCS due to the mentioned errors in the First post.

    Ok so this is the comment from the code vendor :

    "Please note that the original startup codes from TI (assembler code) do not define the interrupt vectors (like other chip manufacturers do when using CMSIS). TI is a little bit strange in that field, they have 3 different header files on their homepage, including an old CMSIS version. The header files we used for the project are included in the libs directory."

    I couldnt really make out what he meant by that. Can you guys guide me please.

  • Hi,

    I think you need to specify if your example project is built with CMSIS or with peripheral driver library. Amit has right if you have the project based on peripheral driver library; in this case the usual startup file used by TI is written entirely in C and no use of _bss, _ess sections is needed. Look for startup_ccs.c file in Tiva (I am sure you used such file).

    Petrei

  • Petrei said:

    Hi,

    I think you need to specify if your example project is built with CMSIS or with peripheral driver library. Amit has right if you have the project based on peripheral driver library; in this case the usual startup file used by TI is written entirely in C and no use of _bss, _ess sections is needed. Look for startup_ccs.c file in Tiva (I am sure you used such file).

    Petrei

    This is the Code part in the Startup.c that is having errors. Can i comment it out ?

    void
    ResetISR(void)
    {
        uint32_t *pui32Src, *pui32Dest;
    
        //
        // Copy the data segment initializers from flash to SRAM.
        //
        pui32Src = &_etext;
        for(pui32Dest = &_data; pui32Dest < &_edata; )
        {
            *pui32Dest++ = *pui32Src++;
        }
    
        //
        // Zero fill the bss segment.
        //
        __asm("    ldr     r0, =_bss\n"
              "    ldr     r1, =_ebss\n"
              "    mov     r2, #0\n"
              "    .thumb_func\n"
              "zero_loop:\n"
              "        cmp     r0, r1\n"
              "        it      lt\n"
              "        strlt   r2, [r0], #4\n"
              "        blt     zero_loop");
    
        //
        // Enable the floating-point unit.  This must be done here to handle the
        // case where main() uses floating-point and the function prologue saves
        // floating-point registers (which will fault if floating-point is not
        // enabled).  Any configuration of the floating-point unit using DriverLib
        // APIs must be done here prior to the floating-point unit being enabled.
        //
        // Note that this does not use DriverLib since it might not be included in
        // this project.
        //
        HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) &
                             ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) |
                            NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL);
    
        //
        // Call the application's entry point.
        //
        main();
    }

  • Hello Feroze,

    And this is for CCS

    void
    ResetISR(void)
    {
        //
        // Jump to the CCS C initialization routine.  This will enable the
        // floating-point unit as well, so that does not need to be done here.
        //
        __asm("    .global _c_int00\n"
              "    b.w     _c_int00");
    }

    Regards

    Amit

  • Amit Ashara said:

    Hello Feroze,

    And this is for CCS

    void
    ResetISR(void)
    {
        //
        // Jump to the CCS C initialization routine.  This will enable the
        // floating-point unit as well, so that does not need to be done here.
        //
        __asm("    .global _c_int00\n"
              "    b.w     _c_int00");
    }

    Regards

    Amit

    Thank you , 

    But I am still unable to port it successfully:

    "tsCos418_ObjsG" is defined in cos418.h which is called in the source. and when clicked it goes to right path, but still i am getting this error.

     undefined                     first referenced                      
      symbol                                 in file                           
     ---------                               ----------------                      
     tsCos418_ObjsG     ./Application/cos_user_dk_tm4c123g.obj
    
    error #10234-D: unresolved symbols remain
    
    error #10010: errors encountered during linking; "CANOpen_CCS_130514_Fz.out" not built
    gmake: *** [CANOpen_CCS_130514_Fz.out] Error 1
    gmake: Target `all' not remade because of errors.



  • Hi,

    Seems that tsCos418_ObjsG is either a library either an module/object file which you need to add to project - if it is a library that must be added at the linker phase, if it is a module and you have the source you must add it to your project and compile/link it. Check the settings/configurations in Keil and do similar to CCS.

    Petrei

  • 'tsCos418_ObjsG' is a structure.

    Defined in a header file as :

    extern Cos418_Objects_ts tsCos418_ObjsG;

    And the header file is called in the source file.

     

     

  • These are the final errors i am getting after trying multiple times.

    1. As mentioned above the 'tsCos418_ObjsG' is a structure which is well defined and i dont think its related to the source file. Its says .obj file. So its the liner issue. I dont see Why the linker is unable to find the structure defined.

    Here is the exact definition of the tsCos418_ObjsG in the header file:

    struct Cos418_Objects_s {
    
       uint8_t  AAA;
    
       uint8_t  BBB;
    
       int16_t  CCC;
    
    };
    
    
    /*!
    ** \brief typedef of Cos410_Param_s
    */
    typedef struct Cos418_Objects_s Cos418_Objects_ts;

    2. As to the warning i have no idea what it means :( searching in google took me to this thread 

    http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/245329.aspx  but still no idea.

    This is the actual file :

    SECTIONS
    {
        .intvecs:   > 0x00000000
        .text   :   > FLASH
        .const  :   > FLASH
        .cinit  :   > FLASH
        .pinit  :   > FLASH
        .init_array : > FLASH
    
        .vtable :   > 0x20000000
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM
    }
    
    __STACK_TOP = __stack + 512;
    

    CAn i Change to this :

    SECTIONS
    {
    .intvecs: > 0x00000000
    .text : > FLASH
    .const : > FLASH
    .cinit : > FLASH
    .pinit : > FLASH
    .init_array : > FLASH
    i.* : > FLASH
    .constdata : > FLASH

    .vtable : > 0x20000000
    .data : > SRAM
    .bss : > SRAM
    .sysmem : > SRAM
    .stack : > SRAM
    }

    __STACK_TOP = __stack + 512;

     

  • Hi, 

    Starting with the last question: yes, you can do that - but what does it means "i.*" - is it your declaration or not? If yours could be OK, otherwise remove it.

    About the error - is the .h file containing the declaration used by the cos_user_dk_tm4c123g.c file? Since this module complain first, should be checked there. I do not have any knowledge of your project... Is that structure used/modified in that file? .obj file is the result of compilation of .c file - means "object" code which is combined with other .obj files and linked to .elf file (absolute) 

    Petrei

  • Hi

    Frankly this is a bought out CANOpen stack which was written using KEIL uVision. But we are using CCS so i am struggling with this.

    Petrei said:
    what does it means "i.*" - is it your declaration or not? If yours could be OK, otherwise remove it.

    He did the same here , so i did it too. I seriously have no idea.

    http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/245329.aspx  

    Petrei said:
     is the .h file containing the declaration used by the cos_user_dk_tm4c123g.c file?

    This is the structure in the HEADER FIle:

    struct Cos418_Objects_s {

       uint8_t  AAA;
       uint8_t  BBB;
       int16_t  CCC;
    };
    And this is the Typedef of the structure :
    typedef struct Cos418_Objects_s Cos418_Objects_ts;

    So i will be using 'Cos418_Objects_ts' in my code which will not modify the actual structure 'Cos418_Objects_s'.

  • Hi,

    First remove that i.* section, you do not need it.

    Second, do you have the two declarations in two separate .h files? something like this:

    #include "x.h" // this contains extern ... Cos.. G declaration

    #include "y.h" // this contains the structure declaration  

    this is wrong - should be first y.h and then x.h Check your case.

    Petrei

  • I understood your point .

    You mean to say the the Extern TypeDef should be called AFTER the actual Structure is being Declared.

    And the answer is NO, that is not the case here, both Declaration and the Extern Typedef are in the SAME header like this :

    struct Cos418_Objects_s {
       uint8_t  AAA;
       uint8_t  BBB;
       int16_t  CCC;
    };
    
    typedef struct Cos418_Objects_s Cos418_Objects_ts;

    And also this is the unaltered source file which is working fine in the KEIL uVision.

  • Hi,

    And this one where is declared?

    extern Cos418_Objects_ts tsCos418_ObjsG; // this is missing, giving errors - is it before Cos418_Objects_s?

    Open your .c file cos_user_dk_tm4c123.c and on the right side you will see a small red rectangle - click on it and you will be moved to the line where this is first encountered and generate error. Highlight it and press F2 - see if it is found and described as a structure - press also F3 - if not try to compile again your Keil project and examine its structure and settings. Check also paths - should not be so difficult to track down the mistake...

    Petrei

  • Petrei said:

    Hi,

    And this one where is declared?

    extern Cos418_Objects_ts tsCos418_ObjsG; // this is missing, giving errors - is it before Cos418_Objects_s?

    Open your .c file cos_user_dk_tm4c123.c and on the right side you will see a small red rectangle - click on it and you will be moved to the line where this is first encountered and generate error. Highlight it and press F2 - see if it is found and described as a structure - press also F3 - if not try to compile again your Keil project and examine its structure and settings. Check also paths - should not be so difficult to track down the mistake...

    Petrei

    Dear Petrei,

    There is no "small red rectangle" on the file.

    Pressing F2 is equal to CTRL+CLICK and both take me to the Header file (with extern declaration) but it doesnt point me to the actual declaration in any C file.

    Thank you for pointing me in the right direction. I will find the cause to this missing declaration and update here.

  • Dear Petrie, Thank you very much for the information shared.

    The problem was that there was a #ifdef in the C SOURCE file which enabled the entire C code. I enabled that code and it generated the BIN file.

    I kept looking at the Header file but it never occured me that there should be an ACTUAL delcaration for the typedef.

    Code is compiled now and am able to debug using the Development board.

    Thank you very much for the patience Petrei.