COP trigger S12XEP100 reset, can RAM keep the data

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

COP trigger S12XEP100 reset, can RAM keep the data

769 Views
dannydeng
Contributor III

Dears,

If COP trigger S12XEP100 reset, can RAM keep the data stable?

BRs,

Ray

Tags (1)
0 Kudos
5 Replies

639 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

RAM content is not influenced by COP reset.

What you have to keep in mind is where you will continue leaving the COP service routine and what you are doing in this routine.

Some more in the main.c of the attached project. (Created in a past in the CodeWarrior v.4.7)

best regards,

Ladislav

0 Kudos

639 Views
RadekS
NXP Employee
NXP Employee

Hi Ray,
Yes, RAM is not affected by COP reset.

However, _Startup() code initialize/erase RAM by default prior main() function execution.

If you would like to skip this RAM initialization for specific part of RAM, please update your prm linker file and use NO_INIT qualifier. For example:

 

SEGMENTS

/* non-paged RAM */

//      RAM           = READ_WRITE    0x2000 TO   0x3FFF;

      RAM           = READ_WRITE    0x2000 TO   0x3EFF;

      RAM           = READ_WRITE    0x3F00 TO   0x3FFF NO_INIT;     /*not affected by _Startup() code*/

END

For more details about linker file, please check Build_Tools_Utilities.pdf document in CW Help folder.


I hope it helps you.

Have a great day,
Radek

0 Kudos

639 Views
lama
NXP TechSupport
NXP TechSupport

Yes Radek is right.

It the same what I wrote: "What you have to keep in mind is where you will continue leaving the COP service routine and what you are doing in this routine. "

You do not have to continue with _Startup function after COP reset. You can perform any initialization you want and continue where you want. If you are experienced user and you know how to init the MCU you do not need _Startup function generated by CW automatically.

Best regrads,

Ladislav

0 Kudos

639 Views
dannydeng
Contributor III

Thanks Lama,

Do you have any source code sample for this idea, we do not promote S12XEP100 for long time.

BRs,

Ray

0 Kudos

639 Views
lama
NXP TechSupport
NXP TechSupport

If you mean not to use _Startup routine then….

In the originally attached example you have function interrupt 2 void WatchDogIsr(void)

I’ll simplify it a little bit.

 

//********************************************************************

#pragma CODE_SEG NON_BANKED

 

interrupt 2 void WatchDogIsr(void)

{

// any local variable created in this function which is not static   // causes error because stack is not initialized after reset. Use

// global variables which exists everytime on defined addresses. 

// Be aware that all registers are set to the RESET status.

// The RAM remains unchanged.

 

   INIT_SP_FROM_STARTUP_DESC();

   asm JMP FunctionForMyNewStart;  // the best is to use near function

}

#pragma CODE_SEG DEFAULT

 

//********************************************************************

#pragma CODE_SEG NON_BANKED

 

void FunctionForMyNewStart(void)

{

  // I have rest status of registers and Stack set to initial value

  // Everything is up to me now

 

  // jump/call/do what you want

}

 

#pragma CODE_SEG DEFAULT

//********************************************************************

Best regards,

Ladislav

0 Kudos