SPRUI03E June 2015 – January 2023
The linker supports extensions to the linker command file syntax that enable you to do the following:
SECTIONS
{
...
UNION
{
GROUP
{
.task1: { task1.c.obj(.text) }
.task2: { task2.c.obj(.text) }
} load = ROM, table(_task12_copy_table)
GROUP
{
.task3: { task3.c.obj(.text) }
.task4: { task4.c.obj(.text) }
} load = ROM, table(_task34_copy_table)
} run = RAM
...
}
Using the SECTIONS directive from Produce Address for Linker Generated Copy Table in the linker command file, the linker generates two copy tables named: _task12_copy_table and _task34_copy_table. Each copy table provides the load address, run address, and size of the GROUP that is associated with the copy table. This information is accessible from application source code using the linker-generated symbols, _task12_copy_table and _task34_copy_table, which provide the addresses of the two copy tables, respectively.
Using this method, you need not worry about the creation or maintenance of a copy table. You can reference the address of any copy table generated by the linker in C/C++ or assembly source code, passing that value to a general purpose copy routine, which will process the copy table and affect the actual copy.