RAM and ROM user sections

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User16347
Level 1
Level 1
I'm (still) using the Aurix Development Studio, Tasking build-tools are used in the background.

How can I define a new section "MyRam" in RAM, f.e. at the beginning of area "psram0" or "dsram0" ?
- What is the syntax in the lsl-file ?
- What is the pragma-syntax in the src-files to declare variable into this section?

Thanks in advance for any hints!

Peter
0 Likes
4 Replies
cwunder
Employee
Employee
5 likes given 50 likes received 50 solutions authored
I have not created new sections in the LSL file however you can use the existing sections to locate your data if this helps you. This example is for the TC27x but should work for other devices.
uint32_t __attribute__((section (".data.data_lmu"))) daisyChain_1_cmd[DASIY_CHAIN_1_BUF_SIZE]; /**/
uint32_t __attribute__((section (".data.data_lmu"))) daisyChain_1_rslt[DASIY_CHAIN_1_BUF_SIZE]; /**/
volatile uint8_t __attribute__((section (".data.data_cpu1"))) daisyChain_1_activeBank;


In the map file
| daisyChain_1_activeBank             | 0x60000000 |                                                   |
| daisyChain_1_cmd | 0x90000000 | |
| daisyChain_1_rslt | 0x90000640 | |
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
If you want to change the name of all sections in a file you can consider to use pragma section. E.g. to change the name of the section including all far addressed, initialized variables you can use:

#pragma section fardata "MyRam"

__far int var_1 = 10;
__far int var_2 = 20;
...

Then those variables will end up in section .data.MyRam

Hint: The __far qualifier is not needed if you use the C compiler option -N0 to prevent any default near allocation of variables, if they are not defined using __near.

If you would like to locate those section in a certain RAM you can use an LSL file entry like:

section_layout mpe:vtc:linear
{
group MY_Ram (ordered, contiguous, run_addr = mem:mpe:dspr0[0])
{
select ".data.MyRam";
}
}

A LSL FAQ for the TASKING TriCore tools which includes some small examples for various locate tasks is available at:

https://resources.tasking.com/tasking-whitepapers/linker-script-language-lsl-tips-tricks-for-tasking...

Best regards,
Ulrich Kloidt

TASKING tools support
0 Likes
User16347
Level 1
Level 1
Hello Ulrich,

thanks for your support so far, unfortunatelly I was not yet successful. What I did:

In my src-file:
#pragma section fardata "MyRam"
__far uint8 MySectRam_au8[20];
#pragma section fardata restore

In the lsl-file:
memory dma_ram0 // DMA Ram
{
mau = 8;
size = 4k;
type = ram;
map (dest=bus:tc0:fpi_bus, dest_offset=0xd0000000, size=4k, priority=8);
map (dest=bus:sri, dest_offset=0x70000000, size=4k);
}

section_layout mpe:vtc:linear
{
group (ordered, contiguous, run_addr=mem:dma_ram0)
{
select ".data.MyRam";
select ".bss.MyRam";
}
}

But in the map-file my variable is still placed in dsram0:
mpe:dsram0 | data | .bss.MQ_RTC_LLD.MySectRam_au8 (13) | 0x00000014 | 0x7000148c | 0x0000048c | 0x00000004 |

Do you have an idea what is missing ?

Regards
Peter
0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
Hello Peter,

thanks for providing the details. The map file shows a different section name. This should explain why the LSL select did not work. The map file shows the section name:

.bss.MQ_RTC_LLD.MySectRam_au8

whereas the LSL file select you use is:

select ".bss.MyRam";

The reason why the section renaming did fail is that you used a not matching section type in the pragma section. A not initialized far addressed RAM variable is included in a section type with the name farbss. The section type names are listed in chapter

1.12. Compiler Generated Sections

of the TriCore tools user guide. Please use:

#pragma section farbss "MyRam"
__far uint8 MySectRam_au8[20];
#pragma section farbss restore

to change the section name for this not initialized far accessed char array.

Best regards,
Ulrich Kloidt

TASKING tools support
0 Likes