linker script for running code from RAM on TriCore

Forum related to ERIKA Enterprise and RT-Druid version 3

Moderator: paolo.gai

Post Reply
Alexanderv66
Newbie
Posts: 17
Joined: Sun Jun 30, 2019 6:13 pm

linker script for running code from RAM on TriCore

Post by Alexanderv66 » Mon Jul 15, 2019 8:07 am

Im using Erika 3 on Tricore TC299.
During debugging, I want to load the program not in the FLASH memory, but in the RAM. There is no ready-to-use linker script bundled with Erika 3.
For a single-core configuration, it suffices to replace

Code: Select all

SECTIONS
{
...
	.<section name> : FLAGS(...)
	{
		...
	} > PMU_PFLASH 
...
}
with

Code: Select all

SECTIONS
{
...
	.<section name> : FLAGS(...)
	{
		...
	} > PMI_PSRAM_local
...
}
But how to create multicore linker script?
Please, help me to create a script for RAM with a multi-core configuration.

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: linker script for running code from RAM on TriCore

Post by e.guidieri » Mon Jul 15, 2019 10:51 am

Start from a multicore project, and get the linker script from erika/mk folder. Copy in the root of the project and then try to customize it.

Basically you should change all the the uses of flashes with the global declaration of PSRAM, moreover you have to move cost data to DSRAMs.

You can use it changing the .OIL

Code: Select all

   CPU_DATA = TRICORE {
     COMPILER = TASKING {
          LINKER_SCRIPT = "[/]path/to/custom/linker_script";
     };
     ...
   };
Best Regards,
Errico Guidieri

Alexanderv66
Newbie
Posts: 17
Joined: Sun Jun 30, 2019 6:13 pm

Re: linker script for running code from RAM on TriCore

Post by Alexanderv66 » Thu Jul 18, 2019 8:19 am

What is the "global declaration of PSRAM"?
I have saw following RAM areas in ld script:

Code: Select all

MEMORY
{...
/* Scratch-Pad RAMs Core2 */
  DMI_DSPR2_local (w!xpc2): org = 0xD0000000, len = 240K
  DMI_DSPR2       (w!xpc2): org = 0x50000000, len = 240K
  PMI_PSPR2       (wx!pc2): org = 0x50100000, len = 32K

/* Scratch-Pad RAMs Core1 */
  DMI_DSPR1_local (w!xpc1): org = 0xD0000000, len = 240K
  DMI_DSPR1       (w!xpc1): org = 0x60000000, len = 240K
  PMI_PSPR1       (wx!pc1): org = 0x60100000, len = 32K

/* Scratch-Pad RAMs Core0 */
  DMI_DSPR0_local (w!xpc0): org = 0xD0000000, len = 120K
  DMI_DSPR0       (w!xpc0): org = 0x70000000, len = 120K
  PMI_PSPR0       (wx!pc0): org = 0x70100000, len = 32K

/* Program Scratch-Pad RAM (PSPR). Local Addressing */
  PMI_PSRAM_local (wx!p): org = 0xC0000000, len = 32K
  ...
  /* Global Data RAM (LMU) */
  LMU_SRAM        (w!xp): org = 0x90000000, len = 32K
/* Global Data RAM (LMU). Not Cached (NC)*/
  LMU_SRAM_nc     (w!xp): org = 0xB0000000, len = 32K
  ...  }
if you mean Global Data RAM "LMU_SRAM", then its length is only 32k

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: linker script for running code from RAM on TriCore

Post by e.guidieri » Thu Jul 18, 2019 12:31 pm

What is the "global declaration of PSRAM"?
Those declatations that are that are not local/self addressing

This one is the self addressing one

Code: Select all

/* Program Scratch-Pad RAM (PSPR). Local Addressing */
  PMI_PSRAM_local (wx!p): org = 0xC0000000, len = 32K
These are the global addresses space for scratch pad core2, core1 and core0 respectively

Code: Select all

...
PMI_PSPR2       (wx!pc2): org = 0x50100000, len = 32K
...
PMI_PSPR1       (wx!pc1): org = 0x60100000, len = 32K
...
PMI_PSPR0       (wx!pc0): org = 0x70100000, len = 32K
...

You really should read the TriCore TRM, at least the first 3 or 4 chapters, is enlightening.

Regards,
Errico

Post Reply