AURIX™ Development Studio outputs HEX file included RAM address?

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

cross mob
Ada
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

HI, All 

I  put the function int the  PSRAM address, I check the map ,it works.

But the HEX file is not included the PSRAM address.

How can I config the lsl or the tools to get the PSRAM address in HEX file?

0 Likes
1 Solution
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins

For a stand-along running application, the program code which is executed in RAM will have to be initialized. This is typically done by the C startup code. The hexfile of the application does include a ROM copy section of the function code and the C starcup code will copy this function to its address in RAM memory. After this event the function may be called.

If your goal is to skip the initialization stage but use a debugger to download the function code directly into RAM memory instead, you can achieve this e.g. selecting the section in question within a LSL group without a copy entry. The copy entry forces the linker to create a ROM copy of the function code section which will be placed in flash memory and an entry to the copy table which includes all the information about data that needs to be initialized by the startup code. This can look like:

#pragma section code "PSRAM_FUNC"
void func(void)
{
    // function code
}
#pragma section code restore

Within the Lcf_Tasking_Tricore_Tc.lsl file you can add the following entry at the beginning of the PSRAM code selections block. If the function shall be placed in PSPR0 RAM without initialization this can look like:

    /* PSRAM Code selections*/
    section_layout :vtc:linear
    {
        /*Code Sections, selectable with patterns and user defined sections*/
        group
        {
            /*Program Scratchpad Sections*/
            group
            {
//added entry start
                group PSRAM_FUNC (ordered, attributes=rwx, run_addr=mem:psram0)
                {
                    select ".text.PSRAM_FUNC";
                }
//added entry end
                group code_psram0 (ordered, attributes=rwx, copy, run_addr=mem:psram0)
                {
                    select "(.text.cpu0_psram|.text.cpu0_psram.*)";
                    select "(.text.psram_text_cpu0|.text.psram_text_cpu0.*)";
                }
...

 

Best regards,

Ulrich Kloidt
TASKING tools support

View solution in original post

5 Replies
Jeremy_Z
Moderator
Moderator
Moderator
1000 replies posted 250 sign-ins 100 likes received

Hi @Ada ,

1) How can I config the lsl or the tools to get the PSRAM address in HEX file?

-- Actually, I'm not clear with your question, to validate the relocating function works, please debug the demo code to check the pointer of the function.
BR,
Jeremy

0 Likes
Ada
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Hi , 

I mean the Hex file, it contains the Flash address, I  want to the ram address in Hex file,  how can  I do it?

Ada_0-1701935601105.png

 

 

0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins

For a stand-along running application, the program code which is executed in RAM will have to be initialized. This is typically done by the C startup code. The hexfile of the application does include a ROM copy section of the function code and the C starcup code will copy this function to its address in RAM memory. After this event the function may be called.

If your goal is to skip the initialization stage but use a debugger to download the function code directly into RAM memory instead, you can achieve this e.g. selecting the section in question within a LSL group without a copy entry. The copy entry forces the linker to create a ROM copy of the function code section which will be placed in flash memory and an entry to the copy table which includes all the information about data that needs to be initialized by the startup code. This can look like:

#pragma section code "PSRAM_FUNC"
void func(void)
{
    // function code
}
#pragma section code restore

Within the Lcf_Tasking_Tricore_Tc.lsl file you can add the following entry at the beginning of the PSRAM code selections block. If the function shall be placed in PSPR0 RAM without initialization this can look like:

    /* PSRAM Code selections*/
    section_layout :vtc:linear
    {
        /*Code Sections, selectable with patterns and user defined sections*/
        group
        {
            /*Program Scratchpad Sections*/
            group
            {
//added entry start
                group PSRAM_FUNC (ordered, attributes=rwx, run_addr=mem:psram0)
                {
                    select ".text.PSRAM_FUNC";
                }
//added entry end
                group code_psram0 (ordered, attributes=rwx, copy, run_addr=mem:psram0)
                {
                    select "(.text.cpu0_psram|.text.cpu0_psram.*)";
                    select "(.text.psram_text_cpu0|.text.psram_text_cpu0.*)";
                }
...

 

Best regards,

Ulrich Kloidt
TASKING tools support

Ada
Level 1
Level 1
5 replies posted 10 sign-ins 5 sign-ins

Hi, 

I use the code you put, it works,

I have some questions, I put the function such as "flash erase or wirte", It can execute directly in RAM address? 

Is there anything that needs special attention in Flash code in RAM address?

0 Likes
Jeremy_Z
Moderator
Moderator
Moderator
1000 replies posted 250 sign-ins 100 likes received

Hi @Ada 
1) I have some questions, I put the function such as "flash erase or wirte", It can execute directly in RAM address?
-- Yes.
2) Is there anything that needs special attention in Flash code in RAM address?
-- Please ensure the beginning address of the RAM is 32-bit alignment if you want to follow the above way to implement relocation.
BR,
Jeremy

0 Likes