Edward Karpicz

CodeWarrior startup routine and S12Z ECC RAM initialization

Discussion created by Edward Karpicz on Jun 19, 2019
Latest reply on Jun 21, 2019 by Daniel Martynek

Hi,

 

After migration from Freescale to NXP it became unclear were to report bugs or concerns. Is Community really right place for this?

 

ECCSTAT RDY bit explanation from S12ZVC RM:

 

ECC Ready— Shows the status of the ECC module.
0 Internal SRAM initialization is ongoing, access to the SRAM is disabled
1 Internal SRAM initialization is done, access to the SRAM is enabled

 

CW startup routine seems not waiting for RDY==1. But setting reset vector to iaprstvect() routine and power cycling board I see 0x0070 loop count @ 0x3000. :

 

void _Startup(void);

#pragma NO_RETURN

void iaprstvect(void)

{

__asm{

         CLR D2

rdlp:   INC D2

         BRCLR.B ECCSTAT, #0, rdlp

         ST D2, 0x3000  // save loop count

         JMP _Startup

}

 

Looks like it takes quite a lot at power on to initialize ECC RAM. Long enough for default startup routine to set stack pointer and jump (BSR) to DoZeroOut() routine before ECC RAM initialization completes! Are there chances for big failure like reading wrong address from stack when returning back from DoZeroOut() to _Startup()?

Outcomes