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/TDA2EVM5777: Problems linking multiple obj: "no matching section"

Part Number: TDA2EVM5777

Tool/software: TI C/C++ Compiler

Hi *!

I have a problem during linking a small bare metal example using the C6000_7.4.2 Toolchain standalone (outside CCS): 

I need to build a section called ".resource_table", because I want to build an ELF for linux remoteproc firmware process.
After compiling the main.c with included "custom_usr_table", the main.obj file contains the needed section.
Then I try to link the main.obj to something I can use in C66x-DSP (using benefits of *.cmd files!) - the linker say: 
"no matching section" ...? Using readelf I can see the obj contains the section... so what's going wrong? 

First: Introduce small example project: 

main.c


/** * main.c */ #include "custom_rsc_table_dsp.h" void main(void) { while (1) { // Do nothing. } }


custom_rsc_table_dsp.h:


#define ..... [NOT showing the needed defines...]
/*
 * Sizes of the virtqueues (expressed in number of buffers supported,
 * and must be power of 2)
 */
#define DSP_RPMSG_VQ0_SIZE      256
#define DSP_RPMSG_VQ1_SIZE      256

/* flip up bits whose indices represent features we support */
#define RPMSG_DSP_C0_FEATURES         1

/* Number of entries in resource table */
#define RSC_NUM_ENTRIES         4

struct my_resource_table {
    struct resource_table base;

    unsigned int offset[RSC_NUM_ENTRIES];  /* Should match 'num' in actual definition */

    /* rpmsg vdev entry */
    struct fw_rsc_vdev rpmsg_vdev;
    struct fw_rsc_vdev_vring rpmsg_vring0;
    struct fw_rsc_vdev_vring rpmsg_vring1;

    /* text carveout entry */
    struct fw_rsc_carveout text_cout;

    /* data carveout entry */
    struct fw_rsc_carveout data_cout;

    /* ipcdata carveout entry */
    struct fw_rsc_carveout ipcdata_cout;

    /* devmem entry */
    struct fw_rsc_devmem devmem0;
};

#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
#pragma DATA_ALIGN  (ti_ipc_remoteproc_ResourceTable, 4096)

struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
    1,      /* we're the first version that implements this */
    RSC_NUM_ENTRIES,     /* number of entries in the table */
    0, 0,   /* reserved, must be zero */
    /* offsets to entries */
    {
        offsetof(struct my_resource_table, rpmsg_vdev),
        offsetof(struct my_resource_table, text_cout),
        offsetof(struct my_resource_table, data_cout),
        offsetof(struct my_resource_table, devmem0),
   },   
    /* rpmsg vdev entry */
    {   
        TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
        RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
        /* no config data */
    },  
    /* the two vrings */
    { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
    { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
    
    { 
        TYPE_CARVEOUT,
        DSP_MEM_TEXT, 0,
        DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
    },  
        
    {
        TYPE_CARVEOUT,
        DSP_MEM_DATA, 0,
        DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
    },  
        
    {
        TYPE_DEVMEM,
        DSP_MEM_IPC_DATA, 0,
        DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
    },  
};      
    



/****************************************************************************/ /* AM57xx_C66.cmd */ /* Copyright (c) 2015 Texas Instruments Incorporated */ /* Author: Rafael de Souza */ /* */ /* Description: This file is a sample linker command file that can be */ /* used for linking programs built with the C compiler and */ /* running the resulting .out file on the C66x DSP core of */ /* an AM57xx device. */ /* Use it as a guideline. You will want to */ /* change the memory layout to match your specific */ /* target system. You may want to change the allocation */ /* scheme according to the size of your program. */ /* */ /****************************************************************************/ MEMORY { IRAM_MEM: o = 0x00800000 l = 0x00008000 /* 32kB internal SRAM */ OCMC_RAM1: o = 0x40300000 l = 0x00080000 /* 512kB L3 OCMC SRAM1 */ OCMC_RAM2: o = 0x40400000 l = 0x00100000 /* 1MB L3 OCMC SRAM2 */ OCMC_RAM3: o = 0x40500000 l = 0x00100000 /* 1MB L3 OCMC SRAM3 */ DDR0: o = 0x80000000 l = 0x40000000 /* 1GB external DDR Bank 0 */ } SECTIONS { .text > IRAM_MEM .stack > IRAM_MEM .bss > IRAM_MEM .cio > IRAM_MEM .const > IRAM_MEM .data > IRAM_MEM .switch > IRAM_MEM .sysmem > IRAM_MEM .far > IRAM_MEM .args > IRAM_MEM .ppinfo > IRAM_MEM .ppdata > IRAM_MEM /* COFF sections */ .pinit > IRAM_MEM .cinit > IRAM_MEM /* EABI sections */ .binit > IRAM_MEM .init_array > IRAM_MEM .neardata > IRAM_MEM .fardata > IRAM_MEM .rodata > IRAM_MEM .c6xabi.exidx > IRAM_MEM .c6xabi.extab > IRAM_MEM .resource_table > IRAM_MEM { main.obj(.resource_table) }

}

INFO:
The explicit ".resource_table"stuff is just one of other tries to generate a section in the resulting firmware... without such a definition, the pragma of the includ
ed "custom_rsc_table_dsp.h"do not create the needed section.

So I tried it this way, ... without success...:-( 

Call and Options to compiler: 

cl6x --ram_model --unused_section_elimination=on --map_file=link.map --stack_size=0x1000  --abi=eabi --run_linker linker.cmd main.obj -i $(INCLUDE) -o dra7-dsp1-fw.xe66

The Problem: 

I can see a section called ".resource_table" in the obj-File BEFORE using the linker:

[ 5] .resource_table PROGBITS 00000000 001000 000144 00 WA 0 0 4096 

.resource_table ... 7: 00000000 0 SECTION LOCAL HIDDEN 5

.resource_table .resource_table 00000144 00000000 00000000 00001000 2**12 CONTENTS, ALLOC, LOAD, DATA

Error Message: 

"linker.cmd", line 54: warning: no matching section

This results to : 

.resource_table 00000000 00000000 00000000 00000000 2**0
 READONLY

.resource_table NOBITS 00000000 000000 000000 00 0 0 1 22: 00000000 0 SECTION LOCAL DEFAULT 22 

 

Any suggestions what is going wrong?