Using Union And Group Statements - Texas Instruments TMS320C54x User Manual

Digital signal processors
Hide thumbs Also See for TMS320C54x:
Table of Contents

Advertisement

7.10 Using UNION and GROUP Statements

7.10.1 Overlaying Sections With the UNION Statement
Example 7–7. The UNION Statement
Example 7–8. Separate Load Addresses for UNION Sections
Two SECTIONS statements allow you to conserve memory: GROUP and
UNION. Unioning sections causes the linker to allocate them to the same run
address. Grouping sections causes the linker to allocate them contiguously in
memory.
For some applications, you may want to allocate more than one section to run
at the same address. For example, you may have several routines you want
in on-chip RAM at various stages of execution. Or you may want several data
objects that will not be active at the same time to share a block of memory. The
UNION statement within the SECTIONS directive provides a way to allocate
several sections at the same runtime address.
In Example 7–7, the .bss sections from file1.obj and file2.obj are allocated at
the same address in RAM. In the memory map, the union occupies as much
space as its largest component. The components of a union remain
independent sections; they are simply allocated together as a unit.
SECTIONS
{
.text: load = ROM
UNION: run = RAM
{
.bss1: { file1.obj(.bss) }
.bss2: { file2.obj(.bss) }
}
.bss3: run = RAM { globals.obj(.bss) }
Allocation of a section as part of a union affects only its run address. Under no
circumstances can sections be overlaid for loading. If an initialized section is
a union member (an initialized section has raw data, such as .text), its load
allocation must be separately specified. For example:
UNION: run = RAM
{
.text1: load = ROM, { file1.obj(.text) }
.text2: load = ROM, { file2.obj(.text) }
}
Using UNION and GROUP Statements
Linker Description
7-45

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C54x and is the answer not in the manual?

Table of Contents