SPRU513Y August 2001 – June 2022 SM320F28335-EP
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 that is generated by the linker. TMS320C28x cpy_tbl.h File shows the copy table header file.
/****************************************************************************/
/* cpy_tbl.h */
/* */
/* 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 src_pgid;
unsigned int dst_pgid;
unsigned long src_addr;
unsigned long dst_addr;
unsigned long size;
} COPY_RECORD;
/****************************************************************************/
/* Copy Table Data Structure */
/****************************************************************************/
typedef struct copy_table
{
unsigned int rec_size;
unsigned int num_recs;
COPY_RECORD recs[1];
} COPY_TABLE;
/****************************************************************************/
/* Prototype for general purpose copy routine. */
/****************************************************************************/
extern void copy_in(COPY_TABLE *tp);
/****************************************************************************/
/* Prototypes for utilities used by copy_in() to move code/data between */
/* program and data memory (see cpy_utils.asm for source). */
/****************************************************************************/
extern void ddcopy(unsigned long src, unsigned long dst);
extern void dpcopy(unsigned long src, unsigned long dst);
extern void pdcopy(unsigned long src, unsigned long dst);
extern void ppcopy(unsigned long src, unsigned long dst);
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 page id of .first>,
<run page id of .first>,
<load address of .first>,
<run address of .first>,
<size of .first> },
{ <load page id of .extra>,
<run page id of .extra>,
<load address of .extra>,
<run address of .extra>,
<size of .extra> } };