Apr 26, 2021
09:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 26, 2021
09:56 AM
Hi,
I have been trying to execute some of my codes to PRSR (program scratch pad RAM).
In the linker script, I did the following:
group (contiguous, ordered, run_addr = mem:int_ram_core0_P, copy)
{
select ".text.MyModule.SampleFunction";
}
But here the actual instruction code are missing (see only nop).

How do I actually do this?
Note: mem:int_ram_core0_P points the PRSR address.
I have been trying to execute some of my codes to PRSR (program scratch pad RAM).
In the linker script, I did the following:
group (contiguous, ordered, run_addr = mem:int_ram_core0_P, copy)
{
select ".text.MyModule.SampleFunction";
}
But here the actual instruction code are missing (see only nop).
How do I actually do this?
Note: mem:int_ram_core0_P points the PRSR address.
10 Replies
Apr 27, 2021
02:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2021
02:17 AM
Hello,
did you altready take a look at the RAM_RUN_Function_1 trainings?
They also come with a detailed tutorial here: RAM_RUN_Function_1 tutorial
Note: I linked the training for the Lite Kit featuring AURIX TC375, but the same training is also available for TFT kits featuring AURIX TC297 and TC397
hope it helps,
teoBits
did you altready take a look at the RAM_RUN_Function_1 trainings?
They also come with a detailed tutorial here: RAM_RUN_Function_1 tutorial
Note: I linked the training for the Lite Kit featuring AURIX TC375, but the same training is also available for TFT kits featuring AURIX TC297 and TC397
hope it helps,
teoBits
Apr 27, 2021
06:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2021
06:21 AM
Hello,
Thanks for your reply.
I did similar to the one mentioned in the training slide / git.
Like this in my lsl:
group (ordered, attributes=rwx, copy, run_addr = mem:int_ram_core0_P)
{
select "(.text.*.cpu0_psram|.text.*.cpu0_psram.*)";
}
In my code:
#pragma section code cpu0_psram
void MySampleFunction(uint8* u8X)
{
*u8X = 50;
}
#pragma section code restore
However I still see the following generated assembly (without the actual instruction code):

Is there some code/instruction where the actual code is copied to program scratch pad? I thought the copy attribute is doing that?
Thanks for your reply.
I did similar to the one mentioned in the training slide / git.
Like this in my lsl:
group (ordered, attributes=rwx, copy, run_addr = mem:int_ram_core0_P)
{
select "(.text.*.cpu0_psram|.text.*.cpu0_psram.*)";
}
In my code:
#pragma section code cpu0_psram
void MySampleFunction(uint8* u8X)
{
*u8X = 50;
}
#pragma section code restore
However I still see the following generated assembly (without the actual instruction code):
Is there some code/instruction where the actual code is copied to program scratch pad? I thought the copy attribute is doing that?
Apr 27, 2021
06:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2021
06:29 AM
Did you try adding some more code instructions inside the function? maybe the compiler is optimizing your code because the function is really simple.
teoBits
teoBits
Apr 27, 2021
05:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2021
05:03 PM
Yes, I did add some more codes. Actually, I initially added an existing function in my project, but then I noticed only "nop" all over (e.g. memset, memcpy functions).
Also I made a similar function like posted above (setting different value) and place it in segment 8 (where most of our codes are located), there I see a correct assembly instructions.
Also I made a similar function like posted above (setting different value) and place it in segment 8 (where most of our codes are located), there I see a correct assembly instructions.
Apr 27, 2021
05:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2021
05:13 PM
Does the problem persist if you declare u8X as volatile? I.e.:
Edit: This should help with the nops. Note that the function itself is already in CPU0 PSPR.
void MySampleFunction(volatile uint8* u8X)
Edit: This should help with the nops. Note that the function itself is already in CPU0 PSPR.
Apr 28, 2021
02:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 28, 2021
02:11 PM
Hello,
I tried just now putting a volatile and I still see nop in the assembly.
Here is the screenshot:

Could you explain a bit more how the code data are being copied to the program scratchpad at the beginning? Is there something else I should be checking?
Update:
I also checked the content of the address and I only see 0x00 (corresponding to nop):

Btw: I really appreciate the support I am getting from this forum. Especially to the infineon colleagues.
I tried just now putting a volatile and I still see nop in the assembly.
Here is the screenshot:
Could you explain a bit more how the code data are being copied to the program scratchpad at the beginning? Is there something else I should be checking?
Update:
I also checked the content of the address and I only see 0x00 (corresponding to nop):
Btw: I really appreciate the support I am getting from this forum. Especially to the infineon colleagues.
Apr 29, 2021
04:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 29, 2021
04:36 PM
Hi again,
I found out in the project I am working on the following link option is active:
--user-provided-initialization-code
I also check our code of boardStart, we are not calling _c_init because we are doing custom initialization.
This means I think that the copytable is not used to initialize RAM from ROM (including the program scratchpad).
My question now is:
How can copy the code to program scratchpad while using custom initialization? Our project already kind of rely on this custom initialization therefore I cannot revert to _c_init...
Thanks in advance!
I found out in the project I am working on the following link option is active:
--user-provided-initialization-code
I also check our code of boardStart, we are not calling _c_init because we are doing custom initialization.
This means I think that the copytable is not used to initialize RAM from ROM (including the program scratchpad).
My question now is:
How can copy the code to program scratchpad while using custom initialization? Our project already kind of rely on this custom initialization therefore I cannot revert to _c_init...
Thanks in advance!
Apr 29, 2021
08:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 29, 2021
08:22 PM
That's a good question for your compiler maker. But every compiler's copytable has tricky business, so re-inventing that wheel is fraught with danger.
Apr 30, 2021
07:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 30, 2021
07:30 AM
As UC_wrangler mentioned, you probably won't want to use the copytable directly.
You could remove the PSPR directive so the function is placed in flash. If you then reserve an area of PSPR, you could copy the function from the known location in flash to the reserved location in PSPR and execute it from there. This does have potential issues from a maintenance perspective: it's important to make sure that the reserved space is always large enough to hold the function as compiled.
You could remove the PSPR directive so the function is placed in flash. If you then reserve an area of PSPR, you could copy the function from the known location in flash to the reserved location in PSPR and execute it from there. This does have potential issues from a maintenance perspective: it's important to make sure that the reserved space is always large enough to hold the function as compiled.
May 05, 2021
11:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 05, 2021
11:35 AM
Hello,
I am not sure if this will work out because even if I copy my code from flash to PSPR, any code that calls my code will still jump to original location address in the flash and not in location address in the PSPR because was known location address at link time.
Or did I understand it differently?
I am not sure if this will work out because even if I copy my code from flash to PSPR, any code that calls my code will still jump to original location address in the flash and not in location address in the PSPR because was known location address at link time.
Or did I understand it differently?
This widget could not be displayed.