When you use an LSL group to select sections, for example, for a dedicated
placement in memory, a section might not be assigned as expected. This may
be due to the wrong space selection in the
section_layout in the LSL
file.
Although group names are optional, consider using them as a best practice, since the group name is displayed in the .map file when the assignment is successful. Consider the section_layout example:
section_layout :vtc:linear
{
// group entry to place a non-initialized far addressed data section in LMURAM memory
group MY_DATA ( ordered, run_addr=mem:mpe:lmuram )
{
select ".bss.file_1.my_var_2";
}
}
The generated .map file
displays the sections as shown below.
+ Space mpe:vtc:linear (MAU = 8bit)
+----------------------------------------------------------------------------------------------------------------------------+
| Chip | Group | Section | Size (MAU) | Space addr | Chip addr | Alignment |
|============================================================================================================================|
|
...
| mpe:lmuram | MY_DATA | .bss.file_1.my_var_2 (170) | 0x00000004 | 0x90000000 | 0x0 | 0x00000002 |
If you do not specify a group name, the section might be placed in the group’s range by accident and this will most likely change after you have made modifications to the project’s C source files. It is important to keep in mind that the section_layout entry determines which sections will be selected.
Consider the example:
section_layout :vtc:linear
{
group MY_DATA ( ordered, run_addr=mem:mpe:lmuram )
{
select ".zbss.file_1.my_var_1";
}
}
This will not work because the
.zbss section is
near-addressable (abs18) whereas the
section_layout entry is for
the linear (far-addressable) range. See
Chapter 7.9.5. The Architecture Definition in the
TriCore Toolset User Guide
which includes a table about the address space relations.
To
correct this error, you need to adapt the
section_layout entry as shown
below:
section_layout :vtc:abs18
{
// group entry to place a non-initialized near addressable data section
// in LMURAM memory
group MY_NEAR_DATA ( ordered, run_addr=mem:mpe:lmuram )
{
select ".zbss.file_1.my_var_1";
}
}
The generated .map file presents the sections as follows:
+ Space mpe:vtc:abs18 (MAU = 8bit)
+----------------------------------------------------------------------------------------------------------------------------+
| Chip | Group | Section | Size (MAU) | Space addr | Chip addr | Alignment |
|============================================================================================================================|
|
| mpe:lmuram | MY_NEAR_DATA | .zbss.file_1.my_var_1 (169) | 0x00000004 | 0x90000000 | 0x0 | 0x00000002 |
The zip file section_placement_failure_example includes a buildable example using a command line invocation.