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.

converting IAR into TI

Other Parts Discussed in Thread: MSP430F2274

Hi,

I need some help with moving IAR sources for eZ430-RF2480 ZASA project into CCS v4 and rebuilding.

First problem is: IAR has a file sample_app.cfg, where some variables are defined like for example -DZACCEL_BUF_LEN=128 and a few more

Under CCS I did Project->Properties->C/C++Build and then Environment tab, where I define a new User Variable.

It doesn't work. If anyone knows how to do it, please share.

Jan

  • You can either define variables directly in the code using #define or add them to the Project Build otions by going to:

    Project Build Properties->MSP430 Compiler->Predefined Symbols, and add them under the -D option.

    The compiler option is further documented in the MSP430 Compiler Users Guide, http://www.ti.com/lit/slau132, Page 25

  • Aarti,

    Thanks for your answer, much appreciate it. 

    I know about #define, but wanted to do as little changes to IAR source code as possible.

    And I regret that they didn't use #define instead of a hidden IAR specific configuration file making it more incompatible with other compilers.

    I use the Predefined Symbols and it works.

    Now I have a problem with ISR

    IAR has:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    #define

     

     

    #define

     

     

    #define

     

     

    #define

     

     

    HAL_ISR_FUNCTION(f,v) HAL_ISR_FUNC_PROTOTYPE(f,v); HAL_ISR_FUNC_DECLARATION(f,v)
    HAL_ISR_FUNC_PROTOTYPE(f,v) _PRAGMA(vector=v) __interrupt void f(void)
    HAL_ISR_FUNC_DECLARATION(f,v) _PRAGMA(vector=v) __interrupt void f(void)
    _PRAGMA(x) _Pragma(#x)

    then

     

     

     

    #define

     

     

    and

     INTERRUPT_PORT1()  HAL_ISR_FUNCTION(isrPort1, PORT1_VECTOR)

    INTERRUPT_PORT1()

    and it gives an error

    "../target/cc2480/hal_board.c", line 636: warning: pragma vector can only be applied to a function definition, not "isrPort1" (declared at line 636)

    Looks like they like very high level of abstraction, but I had to replace INTERRUPT_PORT1(1) with

     

     

     

     

    // was INTERRUPT_PORT1()

    // J.Sz.

    #pragma

     

     

    void PORT1_ISR(void)

    vector = PORT1_VECTOR

    __interrupt

    // end of J.Sz.

    As the documentation (slau157k.pdf page 26) says the ISR are compatible for both CCS and IAR, can you kindly advice how to make it compatible without major changes to the source code.

    Thank you and Best Regards

    Jan

     

  • Aarti,

    (Sorry for the strange formatting in previous link, but it's not me) 

    I manage to rebuild the project under CCS.

    Under IAR I had

     4 274 bytes of CODE  memory
       875 bytes of DATA  memory (+ 60 absolute )
        22 bytes of CONST memory

    The CCS gives:

    Code Size-Text:5820 bytes

    Data: 37 bytes

    I can load the code into dongle but it doesn't work 100%. (I think that variables are not initialized)

    Now I need to debug it. As I am new to CCS I have more questions:

    1) I have a message File /SampleApp-CC2420/Default/boot.c doesn't exist (as the debugger is trying to open it) ???

    Is it still OK and if not how to fix it?

    I have checked the Linker->Runtime Environment  I have selected Link Using ROM autoini... 

    The map file says .cinit 0 00008000 00000000 UNINITIALIZED

    What am I doing wrong here and have to make global variables autoinitialized?

    Thanks again

    Jan

     

     

  • Aarti,

    One more strange error

    I have the processor MSP430F2274 defined while creating the project, but still have an error

    "C:/Texas Instruments/ccsv4/msp430/include/msp430.h", line 251: fatal error: #error "Failed to match a default include file"

    To fix it I need to put __MSP430F2274__ under Predifined Symbols. Why??? What am I doing wrong again?

    Jan

  • jan said:

    To fix it I need to put __MSP430F2274__ under Predifined Symbols. Why??? What am I doing wrong again?

    You are not doing anything wrong.

    The requirement to define the __MSP430F2274__ in the project options pre-defined variables allows some portability of the source code.
    As you observed, your source code simply includes <msp430.h>.  If you look at this file, you will see the use of the __MSP430F2274__ define to pull in the specific device varient header file.  But your source code that you implement does need to change if you target a different device varient.

    Your target specific information would be at the project build level, not buried into source code.  This allows you to make device varient specific changes in one location, rather than potentially across many source files.

  • Brandon,

    Thanks for that answer.

    Now I need to figure out how to make data auto-initialize (see my previous email) and the C startup

    environment on CCS mysteries to be on track.

    Regards

    Jan

  • jan said:

    I can load the code into dongle but it doesn't work 100%. (I think that variables are not initialized)

    Now I need to debug it. As I am new to CCS I have more questions:

    1) I have a message File /SampleApp-CC2420/Default/boot.c doesn't exist (as the debugger is trying to open it) ???

    Is it still OK and if not how to fix it?

    I have checked the Linker->Runtime Environment  I have selected Link Using ROM autoini... 

     

    The map file says .cinit 0 00008000 00000000 UNINITIALIZED

    What am I doing wrong here and have to make global variables autoinitialized?

    The MSP430 Optimizing C/C++ Compiler User's Guide (SLAU132) is a reference I would suggest looking at regarding the C run-time environment.

    The boot.c file mentioned from CCS is a file that is part of the RTS (Run-Time Support) library.  Section 6.8 talks about the System Initialization, which includes the routines to perform initialization of the C-Run time environment.

  • Jan,

    FYI, one difference between IAR and CCS is that IAR compiler auto initializes static variables to zero while CCS compiler does not. Please take a look at this post for more information: https://community.ti.com/forums/p/6976/26940.aspx#26940

  • Hi,

    Thank you for the answers.

    Personally I would prefer easily visible crt0.s file like with many other IDEs, but have to accept the things as they are,

    even if it is IMHO unnecessary overcomplex. (An extra time studying another options, not working exactly as described, etc.)

    But, it's me and my feedback, other people might love it.

    Regards

    Jan