Memory Allocation problem

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

cross mob
User21756
Level 1
Level 1
Hi,
i am using Tasking Compiler V6,3 for the TC367 and i am trying to move my application to another memory location.
I read the manuals how to control the tasking linker via lsl-script, but all attempts to move my application to other address fails (ignored).
The code is always linked to the standard flash address.

To figure out, how it works i created a test application (hello world) with the eclipse IDE and try to manipulate the generated lsl-file.
This is my last try:

derivative my_tc36x extends tc36x
{
section_layout mpe:vtc:linear
{
group MY_CODE ( ordered, run_addr = 0x80001000 )
{
select ".text.*";
}
}
}

can somebody help me to figure out, why my main() is linked to the standard address 0x80000010 and not to 0x80001000 ???

My target goal is to link my application to any code-flash area or finally into the RAM area
0 Likes
3 Replies
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
A better question for Tasking, perhaps. Have you exhausted Tasking's resources on the web?

https://resources.tasking.com/sites/default/files/2021-02/TASKING%20TriCore%20tools%20Linker%20tips%...

https://www.tasking.com/sites/default/files/LSL-using-Control-Program.pdf

support@tasking.com

Can you post a zip with your LSL file and map file?
0 Likes
User21756
Level 1
Level 1
Thanks for the reply.
The lsl file is contained in my original post.
Only the include of the original standard lsl files is missing, so here the complete lsl:

And yes: I read all documents regarding linking (including the documents you mentioned).
But NO of the given examples works (in my case) !!!

I already contacted the tasking support, and the problem was included in a support case database.
But no reply for a solution until now, so i thought: lets have a try here 😉

#if defined(__PROC_TC36X__)
#include "tc36x.lsl"
derivative my_tc36x extends tc36x
{
section_layout mpe:vtc:linear
{
group HPM_CODE ( ordered, run_addr = 0x80001000 )
{
select ".text.HPM_CODE.*";
}
}
}



and my c-file:
#include

#pragma section code "HPM_CODE"
int main(void)
{
printf( "Hello world\n" );
}
#pragma section code restore


And the parts (snippets) of the map-file for the main function:
* Symbols (sorted on name)
| main | 0x8000000e | |



********************************** Locate Rules *************
...
| mpe:vtc:linear | unrestricted | | 1 | .text._Exit.libc (493) , table (529) , .text..cocofun_1.libcs_fpu (417) , .text.HPM_CODE (129) , |
...



And the sections list of the map file:
* Sections
===========

+ Space mpe:vtc:linear (MAU = 8bit)

+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Chip | Group | Section | Size (MAU) | Space addr | Chip addr | Alignment |
|======================================================================================================================================================|
| mpe:pflash0 | | .text._Exit.libc (493) | 0x00000004 | 0x80000000 | 0x0 | 0x00000008 |
| mpe:pflash0 | | .text..cocofun_1.libcs_fpu (417) | 0x0000000a | 0x80000004 | 0x00000004 | 0x00000002 |
| mpe:pflash0 | | .text.HPM_CODE (129) | 0x00000010 | 0x8000000e | 0x0000000e | 0x00000002 |
0 Likes
lock attach
Attachments are accessible only for community members.
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins
There are two issues I noticed:

1) The section_layout entry should be outside of the derivative definition. Please use:

#if defined(__PROC_TC36X__)
#include "tc36x.lsl"
#else
#include
#endif

section_layout mpe:vtc:linear
{
group MY_CODE ( ordered, run_addr = 0x80001000 )
{
select ".text.HPM_CODE";
}
}

instead of:

...derivative my_tc36x extends tc36x
{
section_layout mpe:vtc:linear
{
group HPM_CODE ( ordered, run_addr = 0x80001000 )
{
select ".text.HPM_CODE.*";
}
}
}

2) The select does not match. Using:

select ".text.HPM_CODE.*";

will select all sections starting with .text.HPM_CODE. But the section name does not include a tailing dot. So the select needs to be changed to:

select ".text.HPM_CODE";

for this use case.

I enclosed a small example which works as expected.

Best regards,
Ulrich

TASKING tools support