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.

TMS320F280039C: Add files from a project to another project in certain memory locations

Part Number: TMS320F280039C


Hello TI, 

I am using CCS version 12.6.

I have 2 different projects. From project1 I have the output project1.out.
In project2, in linker file, the .cmd file, I want to add the file project1.out to a memory section.

I tried the following in the linker file (.cmd file)
SECTIONS
{

    randomsection: load = MEMORY_LOCATION, PAGE = 0
    {
        project1.out(randomsection)
        endrandomsection = .;
    }
}

MEMORY_LOCATION is already defined in MEMORY part.

The error that I'm getting is that it cannot find file project1.out.

Project1 is already built and I can see the project1.out file.

What I tried is:
project2 -> Properties -> Build -> C2000 Linker -> File Search Path -> Add <dir> to library search path (--search_path, -i)
In this window I've added the location where project1.out is.
Unfortunately, the error persist. 

What am I supposed to do to add a .out file from a CCS project to a certain memory location of another CCS project?

  • I've managed to link it by 

    randomsection:
    {
        "full path to the .out file"
    } >> MEMORY_LOCATION

    I would like a way to not mention the entire path to the file, only the file itself.
    The projects are in the same workspace.

    I also have the following errors because I have both projects with same variable names:
    symbol "variable_1" redefined; first defined in "./variables.obj"; redefined in " path to my .out file".

    Is there a way to avoid this issue?

  • Hi Gesur,

    I had a discussion with our experts and i think it has to be the .lib file and not a .out file.  The .lib will only have functions that can be called from another project. However the .out will contain the startup code and memory allocations already which will conflict with the new project.

    Thanks

    Aswin

  • Hi Aswin, 

    In the Debug (*edit RELEASE) folder of my compiled project I am not able to see a .lib file. Only .out, .hex, .map files.
    Is there a setting I need to check in order to have the .lib files?

    Thanks

  • I've managed to obtain the .lib file.

    *edit

    The way I obtained the .lib file:

    Properties -> Build -> C2000 linker -> Basic options -> Specify output file name (--output_file, -o).
    In this box I set ${ProjName}.lib

    And in C2000 Compiler -> Advanced Options -> Directory specifier-> Compilation output file name , can override --obj_directory (--output_file, -fe).
    In this box, I set ${ProjName}.lib

    *end of edit

    When linking I have the following error:

    #10034-D illegal file type "..path....lib" must specify an object or archive file

    When I check the properties of the .lib file I see that the archive box is checked. What am I supposed to do in this situation?

  • I created a library file in the correct way (I think).

    I used ar2000 to transform my .out file in a .a file

    ar2000 r project.a project.out

    Unfortunately, linking the .a file still gives me the errors from the 2nd comment:

    I also have the following errors because I have both projects with same variable names:
    symbol "variable_1" redefined; first defined in "./variables.obj"; redefined in " path to my .out file".
  • Hi Gesur,

    If your project 1 is the library. Can you check the project properties to see if your output type is Static Library?

    Best,

    Ryan Ma

  • Hi Ryan,

    Unfortunately, it is an Executable. How can I modify it to be of type Static Library?

  • Hi Gesur,

    Unfortunately you'll have to create a new project and copy over the files. 

    Refer to this thread

    When creating a new project, make sure to select the output type to be static library.

    Best,

    Ryan Ma

  • Thanks Ryan,

    Before I proceed, I'd like to expand a bit more.

    First project that I need to include in my second project is the BOOT of the drive.
    I need to include it in the memory location where I know it will be executed first and it will execute it based on the instructions from the first project, the BOOT itself.

    From what I read, libraries are functions that are declared there and I can use them in different projects if they are included.

    I want to clarify that I need to include the output of my BOOT application to my main application.

    Will making the BOOT project a library accomplish this?

  • Hi Gesur,

    Yes, it sounds like the the first project will indeed be a library that you will include in your main application code.

    For example, in your main application you'll have:

    #include "boot_lib.h"

    Best,

    Ryan Ma

  • Hi Ryan,

    From what I see, .lib files work only if I do call the functions from that file and I am not sure how I can accomplish this, considering that I want to include the boot project in my main project. I dont want to go back to boot once my main project starts.

    I've read about c_int00, but I am not sure if I can modify boot28.asm to branch to boot's main.

    I've found a different project that does this via KEEP instruction in linker file.

    KEEP(*project_boot.out) > MEMORY_LOCATION
    This allocates the output of my project_boot to the specified memory location.
    When I try to do this I get the following error:

    #10030-D expecting section type (COPY, DSECT, or NOLOAD) instead of "*<<path to my project_boot.out>>"

    I've tried modifying the sections of my project_boot to be of type COPY as COPY does not allocate memory, but it is present in my output file. Unfortunately, this had no impact for my error.

    How can I use KEEP() in my main linker file to allow my project_boot output to be in the memory section that I desire?



  • Hi Gesur,

    Let me get the correct expert on providing you more information on the KEEP() function.

    Best,

    Ryan Ma

  • Hi Ryan,

    I have managed to do what I intended and I'll describe below the steps needed to do it.

    I am using COFF format.

    Having 2 different projects called Boot and Big_fw.

    Build Boot project, obtain the Boot.out file.
    Use hex2000 tool:

    hex2000 --load_image --load_image:combine_sections=true -o Boot.o boot.out


    This will output the file Boot.o

    Build Big_fw project, obtain the Big_fw.out file.
    Use hex2000 tool:
    hex2000 --load_image --load_image:combine_sections=true -o Big_fw.o Big_fw.out


    This will output the file Big_fw.o

    Having these 2 files, Boot.o and Big_fw.o, I use hex2000 tool to combine them.

    hex2000 --load_image -o combined.out Boot.o Big_fw.o


    This will output the file combined.out.

    If you load this file via code composer and check the memory browser, you will see that the 2 projects are properly merged and loaded on the processor.