SPRUI03E June 2015 – January 2023
To use a copy table generated by the linker, you must know the contents of the copy table. This information is included in a run-time-support library header file, cpy_tbl.h, which contains a C source representation of the copy table data structure generated by the linker. TMS320C6000 cpy_tbl.h File shows the copy table header file.
/****************************************************************************/
/* cpy_tbl.h */
/* */
/* Copyright (c) 2011 Texas Instruments Incorporated */
/* */
/* Specification of copy table data structures which can be automatically */
/* generated by the linker (using the table() operator in the LCF). */
/* */
/****************************************************************************/
/* Copy Record Data Structure */
/****************************************************************************/
typedef struct copy_record
{
unsigned int load_addr;
unsigned int run_addr;
unsigned int size;
} COPY_RECORD;
/****************************************************************************/
/* Copy Table Data Structure */
/****************************************************************************/
typedef struct copy_table
{
unsigned short rec_size;
unsigned short num_recs;
COPY_RECORD recs[1];
} COPY_TABLE;
/****************************************************************************/
/* Prototype for general purpose copy routine. */
/****************************************************************************/
extern void copy_in(COPY_TABLE *tp);
#ifdef __cplusplus
} /* extern "C" namespace std */
#ifndef _CPP_STYLE_HEADER
using std::COPY_RECORD;
using std::COPY_TABLE;
using std::copy_in;
#endif /* _CPP_STYLE_HEADER */
#endif /* __cplusplus */
#endif /* !_CPY_TBL */
For each object component that is marked for a copy, the linker creates a COPY_RECORD object for it. Each COPY_RECORD contains at least the following information for the object component:
The linker collects all COPY_RECORDs that are associated with the same copy table into a COPY_TABLE object. The COPY_TABLE object contains the size of a given COPY_RECORD, the number of COPY_RECORDs in the table, and the array of COPY_RECORDs in the table. For instance, in the BINIT example in Section 9.9.4.2, the .first and .extra output sections will each have their own COPY_RECORD entries in the BINIT copy table. The BINIT copy table will then look like this:
COPY_TABLE __binit__ = { 12, 2,
{ <load address of .first>,
<run address of .first>,
<size of .first> },
{ <load address of .extra>,
<run address of .extra>,
<size of .extra> } };