linker file and startup memory section handling S32K342

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

linker file and startup memory section handling S32K342

818 Views
krishnaraomane
Contributor II

Observed that S32K342 has following memory available

  • 64KB of SRAM
  • 128KB of DTCM

application code was working as expected when memory was with in the limit 

As integration modules increased memory in linker file has updated. application is not running as expected and observing unexpected faults. Suspect for this behavior's is increase/mismatch of memory section placements, for your reference attaching linkerfiles.

 

Let us know how we can adapt/handle the memory and resolve the issue.

 

0 Kudos
Reply
3 Replies

781 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Here you may find an example showing how to use DTCM. Apart from linker file, it is also needed to modify startup.

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-Siul2-Port-Ip-Example-S32K344-ITCM-DTCM-S32...

 

0 Kudos
Reply

770 Views
krishnaraomane
Contributor II

Hi @davidtosenovjan Startup_cm7.s has following asm code file is attached for your reference. where its taking care of  __INT_SRAM_START,__INT_SRAM_END,__INT_DTCM_END,__INT_DTCM_START which are available in linker file. 

 

RamInit:
/* check and init SRAM ECC after power-up and selftest */
ldr r1,=0x4028C000 /* MC_RGM.DES==1 */
ldr r0,[r1]
mov r1,#0x1
and r0, r0, r1
cmp r0,r1
beq RamInit_01
ldr r1,=0x4028C008 /* MC_RGM.FES==0x10 (selftest done) */
ldr r0,[r1]
mov r1,#0x10
and r0, r0, r1
cmp r0,r1
bne SRAM_LOOP_END
RamInit_01:
/* Initialize SRAM ECC */
ldr r0, =__RAM_INIT
cmp r0, 0
/* Skip if __SRAM_INIT is not set */
beq SRAM_LOOP_END
ldr r1, =__INT_SRAM_START
ldr r2, =__INT_SRAM_END

subs r2, r1
subs r2, #1
ble SRAM_LOOP_END

movs r0, 0
movs r3, 0
SRAM_LOOP:
stm r1!, {r0,r3}
subs r2, 8
bge SRAM_LOOP
SRAM_LOOP_END:

DTCM_Init:
/* Initialize DTCM ECC */
ldr r0, =__DTCM_INIT
cmp r0, 0
/* Skip if __DTCM_INIT is not set */
beq DTCM_LOOP_END
/* Enable TCM */
LDR r1, =CM7_DTCMCR
LDR r0, [r1]
LDR r2, =0x1
ORR r0, r2
STR r0, [r1]

ldr r1, =__INT_DTCM_START
ldr r2, =__INT_DTCM_END

subs r2, r1
subs r2, #1
ble DTCM_LOOP_END

movs r0, 0
movs r3, 0
DTCM_LOOP:
stm r1!, {r0,r3}
subs r2, #8
bge DTCM_LOOP
DTCM_LOOP_END:

0 Kudos
Reply

737 Views
krishnaraomane
Contributor II

Update:

 

linker file is configured properly with previous working reference, followed document as well. however, origin address changed.

safety API are not called, integrated safety plugins, generated codes, scst libraries with application code.

 

OS protection is observed during StartOS with sCheck_au8ReservedTcm_0

I also verified Map file and sCheck_au8ReservedTcm_0 is in same section as earlier 

0 Kudos
Reply