The available on-chip memory of an Infineon AURIX family derivative is distributed across various memory areas.
You need to be aware of the extent to which the application code and data use individual memory ranges. This can indicate potential bottlenecks that may require you to adjust the application code or linker LSL file in terms of section placement.
The Infineon User Manual for a TriCore derivative includes a description of the memory map where the ranges of all available on-chip memories are specified. This information is used to create the <derivative name>.lsl file for our TriCore tools. An example of the definition of the DSPR0 memory extracted from the file named tc39xb.lsl:
memory dspr0 // Data Scratch Pad Ram CPU0
{
mau = 8;
size = 240k;
type = ram;
priority = 1;
exec_priority = 0;
map (dest=bus:tc0:fpi_bus, dest_offset=0xd0000000, size=240k, priority=1, exec_priority=0);
map (dest=bus:sri, dest_offset=0x70000000, size=240k);
}
This defines the size of the memory (240kB) and the memory ranges to which it is mapped. For the core local memories like the DSPR and PSPR memories, the CPU supports linear address space mapping using the SRI bus, and a core local address space mapping using the FPI bus. Physically the two address ranges fully overlap. In other words, if TriCore core 0 writes to address 0x70000000, it is equal to writing to address 0xD0000000 and vice versa.
If core 1 writes to address 0xD0000000, this is equal to writing to the SRI bus address 0x60000000.
The DSPR1 memory definition is included in the tc39xb.lsl file shows the following mapping:
map (dest=bus:tc1:fpi_bus, dest_offset=0xd0000000, size=240k, priority=1, exec_priority=0);
map (dest=bus:sri, dest_offset=0x60000000, size=240k);
The linker-generated map file includes a
Used Resources section which
contains the
Memory usage in bytes table.
In case you cannot locate this section in your map file, you can review the
--map-file-format (-m)option
used in the linker invocation. The memory usage information is only included
if the following sub-option is enabled.
+/-memory m/M Include memory usage information
Suppose the
--map-file-format linker
option is not used at all in the invocation, and the default map file format
setting is active, which contains the
Memory usage
section.
Let’s have a closer look at an example snippet of
a Memory usage in bytes
section included in a map file for a TC39xB application.
* Memory usage in bytes
========================
+-----------------------------------------------------------------------------+
| Memory | Code | Data | Reserved | Free | Total |
|=============================================================================|
| mpe:dflash0 | 0x0 | 0x0 | 0x0100000 | 0x0 | 0x0100000 |
...
| mpe:dlmucpu0 | 0x0 | 0x00000c0 | 0x0 | 0x000ff40 | 0x0010000 |
...
| mpe:dspr0 | 0x0 | 0x0000100 | 0x0005400 | 0x0036b00 | 0x003c000 |
...
| mpe:pflash0 | 0x0001698 | 0x000283b | 0x0 | 0x02fc12d | 0x0300000 |
...
| mpe:pspr1 | 0x0000032 | 0x0 | 0x0 | 0x000ffce | 0x0010000 |
...
|-----------------------------------------------------------------------------|
| Total | 0x00016ca | 0x0003243 | 0x05f2400 | 0x12692f3 | 0x1860000 |
+-----------------------------------------------------------------------------+
type = reserved nvram;
group MY_RESERVE ( ordered, run_addr = mem:mpe:dspr0[0x4000] )
{
reserved "RESERVED_DSPR0_RANGE" ( size = 2k );
}
group MY_GROUP ( ordered, run_addr = mem:mpe:dspr0 )
{
section "MY_OUTPUT_SECTION" ( attributes=rw, blocksize = 4 )
{
select ".bss.my_section_name";
}
}
If the section(s) with the name .bss.my_section_name exists in the application data, they will be assigned to this output group. If they do not exist, the output group will have a size of 4 bytes and this size will be counted as reserved memory.
The reference number for the issue logged to document this behavior is:
TCVX-43538 Linker counts scratch sections as reserved sections under
'Memory usage in bytes'
Suppose you need to figure out how many of those scratch sections are erroneously counted as reserved sections. In that case, you can invoke the elfdump tool included in our TriCore product which processes the ELF file of the application. The Section Headers part of the elfdump content includes a column named Flags. An N entry is added under Flags when the section is a noclear section. This allows you to locate the scratch sections which are counted as reserved but should be counted as data.
An example of the elfdump snippet:
[ Nr] Name Type Addr Off Size ES Flags Lk Inf Al Addr.spc
...
[ 6] .bss.file_1.var NOBITS 90000000 000000 000800 00 WA sN 00 000 02
...
Here the section named .bss.file_1.var with a size of 0x800 bytes is a scratch section.
mpe:pflash0 [.data.file_1.f_arr_2] (585)| 0x00000080 | 0x800000f8 | 0x000000f8 | 0x00000002The first entry is a simplified line extracted from the Locate Result part of a map file which provides information about the placement of the ROM copy of an initialized data section and the second entry shows the RAM location of the data section itself.
mpe:lmuram0 .data.file_1.f_arr_2 (8) | 0x00000080 | 0x900401d4 | 0x000001d4 | 0x00000002
The tc39xb.lsl file used for this example defines an overall of 4MB of emulation RAM memory. If a production type version of the derivative is used, this memory is not available.