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.

Link files

Other Parts Discussed in Thread: CCSTUDIO

I am a new TI FAE for Arrow and have a customer question;

I noticed in the CC Quick Start Guide (under the section "To add files to a project"), that we can use "Link Files to Project" instead of "Add Files to Project".
 
They indicate that "Link Files to Project" creates a reference to the file and "Add Files to Project" makes a physical copy of the file and adds it to the project folder.
 
I tried  "Add Files to Project" last night and it works as indicated.  It creates a copy of the file in the main directory.  When I edit the file the copy in the main directory changes but the original file in the sub-directory does not change.
 
Today I tried "Link Files to Project" but it does not seem to work as indicated.  When I move the mouse over the file name it indicates the file is in the main project directory, but it is not there and the Build generates an error indicating it can not find the file.
 
I tried adding the path using the Projects -> Options but that did not make any difference.

Comments.........

  • Tom,

    Tom Smith said:

    (...) When I move the mouse over the file name it indicates the file is in the main project directory, but it is not there and the Build generates an error indicating it can not find the file.

    Do you mean in the C/C++ Projects view? I don't see anything when I do a mouse over a file, only if I click on it and the bottom of the screen shows the <project_name>/<file_name>. Just for testing, what do you see when you right-click on the file --> select Properties? Check the screen attached that shows the logical and physical location of the file. If the file does not exist then it will say "file not found".

    If can't find the file I imagine there are problems with the destination source file - it may have been moved or a drive was disconnected/removed, etc. Also, if the file was added using a relative path to an environment variable (when creating a portable project), then you have to be sure the variable is properly defined (not sure if this is the case, though). 

    Apart from these scenarios I can't think of any other issue - the link file usually works without trouble.

    Regards,

    Rafael

  • Rafael,

    Here is the reponse from my customer;

    I am running CC 4.1. 
    I followed the procedures for adding the variable path name to the Windows -> Preferences -> ... -> Linked Resources.
    I then added a simple main.c to the project and it compiled OK 
    I next linked to a simple prog.c (using Method 2) and got the following error:
     
    "C:Program Files\Texas Instruments\CCSV4\gmake\gmake *** No program to make target /prog.c needed by prog.obj"
     
    I only get this message when I use "Link To" instead of "Add"  Everything else seems to work as indicated in the app note.
    Sorry to make such a production of this.

    -Tom-

  • Tom,

    Sorry, I am a bit confused. Your first post shows that your customer is trying to simply link a file to a project by selecting the Link Files to Project and pointing to the destination source file. If this is what he wants, he does not need to set the Linked Resources or link the files using the method for Portable Projects. Did he succeed to simply link a file this way?

    Tom Smith said:

    "C:Program Files\Texas Instruments\CCSV4\gmake\gmake *** No program to make target /prog.c needed by prog.obj"

    It seems that now he wants to create portable projects based on this page, therefore the error shown in your post indicates the variable is not being properly set. The message mentions /prog.c, therefore indicating the variable is resolving to NULL. Can you confirm the following topics? 

    - Does the linked file have an exclamation point (!) close to its filename in the C/C++ Projects View? If so, this is a confirmation the file is not being found.

    - If he right-clicks on the file, what does he see? Check the attached screen that shows a file that is tied to a linked resource (MY_DOCUMENTS) and its resolved location in the filesystem.

    Apart from this, I am not aware of any problems in the method depicted in the Portable Projects page. I would need additional details about his project (maybe even the project itself) to have a clearer idea.

    Hope this helps,

    Rafael

  • Rafael,

    Here is the latest from my customer;

    I may have made things more complicated then they have to be.
    My original intent was to create projects with source code in multiple directories.  I thought I needed to follow the guidelines in the "Portable Projects" app note to implement this.
    I deleted the project I had been working with and created an new project.  The directory structure is as follows:
    All my MSP430 projects will be inside the main directory C:\Projects\CC4_MSP430
    All my video transmitter projects will be in C:\Projects\CC4_MSP430\VideoTx
    The new project is C:\Projects\CC4_MSP430\VideoTx\VideoTx_01
    Inside VideoTx_01 is a directory named "Source" and there is a simple program main.c in Source.  C:\Projects\CC4_MSP430\VideoTx\VideoTx_01\Source
    When I used "Add file to Project" the build worked OK.  When I used "Link file to project" I got the following error message:
     
    "C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: *** No rule to make target `../main.c', needed by `main.obj'."
     
    When I open the .project file everything looks correct.  I have attached a Notepad version of the file.
    I must be doing something fundamentally wrong, but can not figure out what it is.  Thanks for the help.

    Here is the text he attached;

    <?xml version="1.0" encoding="UTF-8"?>
    <projectDescription>
     <name>VideoTx_01</name>
     <comment></comment>
     <projects>
     </projects>
     <buildSpec>
      <buildCommand>
       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
       <arguments>
       </arguments>
      </buildCommand>
     </buildSpec>
     <natures>
      <nature>org.eclipse.cdt.core.cnature</nature>
      <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
      <nature>org.eclipse.cdt.core.ccnature</nature>
      <nature>com.ti.ccstudio.managedbuild.core.ccsNature</nature>
     </natures>
     <linkedResources>
      <link>
       <name>main.c</name>
       <type>1</type>
       <location>C:/Projects/CC4_MSP430/VideoTx/VideoTx_01/Source/main.c</location>
      </link>
     </linkedResources>
    </projectDescription>

    -Tom-

  • Tom,

    I see what's going on now. The source files that are inside the directory structure of the main project are automatically included in the project, therefore they do not require being manually linked or added to the project - doing this can create a convoluted reference to the source files that seem to be confusing CCS (I could reproduce the same message he is seeing).

    Just as a reference, please check the attached screen: I created an identical directory structure as reported but did not add or link any files from the "Source" directory. The project builds fine as it automatically scans the subdirectory Sources.

    What I don't understand is that adding <main.c> to the project should fail because the function main() (or other functions, variables, etc.) would be duplicated, causing the linker to throw an error. However this does not seem to be the case.

    Anyways, if your customer still has problems please let me know, ok?

    Best regards,

    Rafael

    P.S. In the future your customer may create a portable project, since the directory structure he created is perfect for this; I would simply follow the steps at the page he mentioned.

  • Rafael,

    THANKS that answered his question.

    However he has another question;

    The last thing I need to figure out is how to relocate the vector tables.  I have a bootloader running in upper memory, where the vector table resides.  Using the IAR IDE I was able to use PRAGMA statements to generate pointers to a secondary table down where the application program resides.
    I got on the WIKI site but so far have not found an app note on how to do this in CC4.  I will work on this over the weekend, but if you already know how to do this it would save me some time.  I have attached the two IAR modules that work with that IDE.
    Thanks again for the help with the linking problem and please also thank the TI applications guy.

    -Tom-

  • Rafael,

    Can I attach files??

    Here is one of the files mentioned above;

    /**************************************************
     *
     *
     *
     **************************************************/


    #include <msp430x14x.h>
    #include "types.h"
    #include "timer_pgms.h"
    #include "uart0_rxpg.h"
    #include "uart0_txpg.h"
    #include "uart1_rxpg.h"
    #include "uart1_txpg.h"
    #include "vector_table.h"

    void FunctNop (void);
    //
    void (*tmrA_interrupt_handler)(void);
    //

    const int alias_bffc @ 0xbffc = (int)(&FunctNop);
    const int alias_bffa @ 0xbffa = (int)(&FunctNop);
    const int alias_bff8 @ 0xbff8 = (int)(&FunctNop);
    const int alias_bff6 @ 0xbff6 = (int)(&FunctNop);
    const int alias_bff4 @ 0xbff4 = (int)(&FunctNop);
    const int alias_bff2 @ 0xbff2 = (int)(&sci0_rx);
    const int alias_bff0 @ 0xbff0 = (int)(&sci0_tx);
    const int alias_bfee @ 0xbfee = (int)(&FunctNop);
    const int alias_bfec @ 0xbfec = (int)(&TimerA0_Handler);
    const int alias_bfea @ 0xbfea = (int)(&FunctNop);
    const int alias_bfe8 @ 0xbfe8 = (int)(&FunctNop);
    const int alias_bfe6 @ 0xbfe6 = (int)(&sci1_rx);
    const int alias_bfe4 @ 0xbfe4 = (int)(&sci1_tx);
    const int alias_bfe2 @ 0xbfe2 = (int)(&FunctNop);

    #pragma required = alias_bffc
    #pragma required = alias_bffa
    #pragma required = alias_bff8
    #pragma required = alias_bff6
    #pragma required = alias_bff4
    #pragma required = alias_bff2
    #pragma required = alias_bff0
    #pragma required = alias_bfee
    #pragma required = alias_bfec
    #pragma required = alias_bfea
    #pragma required = alias_bfe8
    #pragma required = alias_bfe6
    #pragma required = alias_bfe4
    #pragma required = alias_bfe2


    //
    //    Prototypes
    //

    //void (*tmrA_interrupt_handler)(void);
    //
    //    Local Prototypes
    //

    //
    //
    //
    //#pragma segment = "VECT_TABLE"
    //#pragma location = "VECT_TABLE"


    void FunctNop (void){}
    //
    //
    //
    void TimerA0_Handler (void)
    {
       (*tmrA_interrupt_handler)();
    }
    //
    //
    //
    void set_tmrA_handler( uint8_t fn )
    {
     if( fn == HIGH_F )
      tmrA_interrupt_handler = high_tmr_handler;

     else
      tmrA_interrupt_handler = low_tmr_handler;
    }  
    //

    File #2

    /**************************************************
     *
     *
     *
     **************************************************/


    #include  <msp430x14x.h>
    __interrupt void PORT2_Handler( void );
    __interrupt void USART1TX_Handler( void );
    __interrupt void USART1RX_Handler( void );
    __interrupt void PORT1_Handler( void );
    __interrupt void TIMERA1_Handler( void );
    __interrupt void TIMERA0_Handler( void );
    __interrupt void ADC_Handler( void );
    __interrupt void USART0TX_Handler( void );
    __interrupt void USART0RX_Handler( void );
    __interrupt void WDT_Handler( void );
    __interrupt void COMPARATORA_Handler( void );
    __interrupt void TIMERB1_Handler( void );
    __interrupt void TIMERB0_Handler( void );
    __interrupt void NMI_Handler( void );

    void TimerIntHandler (void);

    //#define PORT2_VECTOR        (1 * 2u)  /* 0xFFE2 Port 2 */
    //#define USART1TX_VECTOR     (2 * 2u)  /* 0xFFE4 USART 1 Transmit */
    //#define USART1RX_VECTOR     (3 * 2u)  /* 0xFFE6 USART 1 Receive */
    //#define PORT1_VECTOR        (4 * 2u)  /* 0xFFE8 Port 1 */
    //#define TIMERA1_VECTOR      (5 * 2u)  /* 0xFFEA Timer A CC1-2, TA */
    //#define TIMERA0_VECTOR      (6 * 2u)  /* 0xFFEC Timer A CC0 */
    //#define ADC_VECTOR          (7 * 2u)  /* 0xFFEE ADC */
    //#define USART0TX_VECTOR     (8 * 2u)  /* 0xFFF0 USART 0 Transmit */
    //#define USART0RX_VECTOR     (9 * 2u)  /* 0xFFF2 USART 0 Receive */
    //#define WDT_VECTOR          (10 * 2u) /* 0xFFF4 Watchdog Timer */
    //#define COMPARATORA_VECTOR  (11 * 2u) /* 0xFFF6 Comparator A */
    //#define TIMERB1_VECTOR      (12 * 2u) /* 0xFFF8 Timer B CC1-6, TB */
    //#define TIMERB0_VECTOR      (13 * 2u) /* 0xFFFA Timer B CC0 */
    //#define NMI_VECTOR          (14 * 2u) /* 0xFFFC Non-maskable */
    //#define RESET_VECTOR        (15 * 2u) /* 0xFFFE Reset [Highest Priority] */

    //#define UART1TX_VECTOR      USART1TX_VECTOR
    //#define UART1RX_VECTOR      USART1RX_VECTOR
    //#define UART0TX_VECTOR      USART0TX_VECTOR
    //#define UART0RX_VECTOR      USART0RX_VECTOR

    void (** const ptrtovect_PORT2)(void) =         ( void (**)() ) 0xbfe2;
    void (** const ptrtovect_USART1TX)(void) =      ( void (**)() ) 0xbfe4;
    void (** const ptrtovect_USART1RX)(void) =      ( void (**)() ) 0xbfe6;
    void (** const ptrtovect_PORT1)(void) =         ( void (**)() ) 0xbfe8;
    void (** const ptrtovect_TIMERA1)(void) =       ( void (**)() ) 0xbfea;
    void (** const ptrtovect_TIMERA0)(void) =       ( void (**)() ) 0xbfec;
    void (** const ptrtovect_ADC)(void) =           ( void (**)() ) 0xbfee;
    void (** const ptrtovect_USART0TX)(void) =      ( void (**)() ) 0xbff0;
    void (** const ptrtovect_USART0RX)(void) =      ( void (**)() ) 0xbff2;
    void (** const ptrtovect_WDT)(void) =           ( void (**)() ) 0xbff4;
    void (** const ptrtovect_COMPARATORA)(void) =   ( void (**)() ) 0xbff6;
    void (** const ptrtovect_TIMERB1)(void) =       ( void (**)() ) 0xbff8;
    void (** const ptrtovect_TIMERB0)(void) =       ( void (**)() ) 0xbffa;
    void (** const ptrtovect_NMI)(void) =           ( void (**)() ) 0xbffc;

    #pragma required = ptrtovect_PORT2
    #pragma required = ptrtovect_USART1TX
    #pragma required = ptrtovect_PORT2
    #pragma required = ptrtovect_PORT1
    #pragma required = ptrtovect_TIMERA1
    #pragma required = ptrtovect_TIMERA0
    #pragma required = ptrtovect_ADC
    #pragma required = ptrtovect_USART0TX
    #pragma required = ptrtovect_USART0RX
    #pragma required = ptrtovect_WDT
    #pragma required = ptrtovect_COMPARATORA
    #pragma required = ptrtovect_TIMERB1
    #pragma required = ptrtovect_TIMERB0
    #pragma required = ptrtovect_NMI

    #pragma segment = "INTVEC_PGMS"

    #pragma vector=PORT2_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void PORT2_Handler( void )
    {
      (*(*ptrtovect_PORT2))();
    }

    #pragma vector= USART1TX_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void USART1TX_Handler( void )
    {
      (*(*ptrtovect_USART1TX))();
    }

    #pragma vector= USART1RX_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void USART1RX_Handler( void )
    {
      (*(*ptrtovect_USART1RX))();
    }

    #pragma vector=PORT1_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void PORT1_Handler( void )
    {
      (*(*ptrtovect_PORT1))();
    }

    #pragma vector=TIMERA1_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void TIMERA1_Handler( void )
    {
      (*(*ptrtovect_TIMERA1))();
    }
    #pragma vector=TIMERA0_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void TIMERA0_Handler( void )
    {
      (*(*ptrtovect_TIMERA0))();
    }
    #pragma vector=ADC_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void ADC_Handler( void )
    {
      (*(*ptrtovect_ADC))();
    }
    #pragma vector= USART0TX_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void USART0TX_Handler( void )
    {
      (*(*ptrtovect_USART0TX))();
    }
    #pragma vector= USART0RX_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void USART0RX_Handler( void )
    {
      (*(*ptrtovect_USART0RX))();
    }
    #pragma vector=WDT_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void WDT_Handler( void )
    {
      (*(*ptrtovect_WDT))();
    }
    #pragma vector=COMPARATORA_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void COMPARATORA_Handler( void )
    {
      (*(*ptrtovect_COMPARATORA))();
    }
    #pragma vector=TIMERB1_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void TIMERB1_Handler( void )
    {
      (*(*ptrtovect_TIMERB1))();
    }
    #pragma vector=TIMERB0_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void TIMERB0_Handler( void )
    {
      (*(*ptrtovect_TIMERB1))();
    }
    #pragma vector=NMI_VECTOR
    #pragma location = "INTVEC_PGMS"
    __interrupt void NMI_Handler( void )
    {
      (*(*ptrtovect_NMI))();
    }

  • Rafael,

    Here is the latest from the customer;

    I got onto the forum and found a couple links to secondary vector tables.  There is a sample file for a different variant of the MSP430 family but it is OK as a starting point.
     
    This is different from the IAR code.  IAR has pragmas that allow you to do this all in C, Code Composer uses an assembly language file to do the same thing.  I had the same issue with the FreeScale MC9S12 and Code Warrior also uses an assembly language file instead of pragmas.
     
    Anyway I am close to having this working.  One question that came up along the way is the startup code.  In both IAR and Code Warrior the linker ties in to the startup code.  I didn't see this in CC4 but probably just haven't looked hard enough.  Do you know if there is a startup section and how to link to it? 
    Comments....
    -Tom-