How to set reasonably "S12ZVM.prm ”File, I suspect my data overflow

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

How to set reasonably "S12ZVM.prm ”File, I suspect my data overflow

1,089 Views
maxxu
Contributor IV
hi
    When my code is running, it will appear unexplained phenomenon. I suspect that there is a data overflow problem in the running of the program. I want to optimize my S12ZVM.prm, but I can't start. I want to set it reasonably。
   The chip I use is s12zvml32。
    How to set   APP_DATA_RAM、RAM  and   STACKSIZE
 
The file I am using is as follows:
 
/* This is a linker parameter file for the MC9S12ZVM32 */
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
 
SEGMENTS  /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
 
/* Register space  */
/*    IO_SEG        = PAGED         0x000000 TO   0x000FFF; intentionally not defined */
 
/* RAM */
      APP_DATA_RAM  = READ_WRITE  0x001600 TO 0x0016FF;
      RAM           = READ_WRITE  0x001700 TO 0x001FFF;
 
/* EEPROM */
      EEPROM        = READ_ONLY   0x100000 TO 0x10007F;
 
/* non-paged FLASHs */
      ROM           = READ_ONLY   0xFFC000 TO 0xFFFDFF;
 /*   VECTORS       = READ_ONLY     0xFFFE00 TO   0xFFFFFF; intentionally not defined: used for VECTOR commands below */
     OSVECTORS      = READ_ONLY     0xFFFE10 TO   0xFFFFFF;   /* OSEK interrupt vectors (use your vector.o) */
END
 
PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
      _PRESTART,              /* Used in HIWARE format: jump to _Startup at the code start */
      STARTUP,                /* startup data structures */
      ROM_VAR,                /* constant variables */
      STRINGS,                /* string literals */
      VIRTUAL_TABLE_SEGMENT,  /* C++ virtual table segment */
    //.ostext,                /* OSEK */
      NON_BANKED,             /* runtime routines which must not be banked */
      DEFAULT_ROM,
      COPY              INTO  ROM;
 
    //.stackstart,            /* eventually used for OSEK kernel awareness: Main-Stack Start */
      SSTACK,                 /* allocate stack first to avoid overwriting variables on overflow */
    //.stackend,              /* eventually used for OSEK kernel awareness: Main-Stack End */
      ptuTrigE,
      adcLists,
    DEFAULT_RAM         INTO  RAM;
 
    vector    INTO  OSVECTORS; /* OSEK */
END
 
ENTRIES /* keep the following unreferenced variables */
    /* OSEK: always allocate the vector table and all dependent objects */
  //_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
  _vectab
END
 
STACKSIZE 0x500
 
//VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry  /* reset vector: this is the default entry point for an Assembly application. */
//INIT Entry      /* for assembly applications: that this is as well the initialization entry point */
0 Kudos
Reply
4 Replies

1,061 Views
maxxu
Contributor IV

hi

I looked at the code of the official website,About STACKSIZE sections,It seems to be contained in the RAM area, and there is no need to define the area separately。

I use the following definition, the code can run。

/* RAM */

APP_DATA_RAM = READ_WRITE 0x001000 TO 0x0010FF;

RAM                     = READ_WRITE 0x001100 TO 0x001FFF;

STACKSIZE 0x0400

0 Kudos
Reply

1,072 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Maxuu,

It is 4k RAM in this MCU - from 0.001000 to 0.001FFF.

So you could divide it to your sections:

/* RAM */

APP_DATA_RAM = READ_WRITE 0x001400 TO 0x0014FF;

RAM                     = READ_WRITE 0x001500 TO 0x001FFF;

STACKSIZE 0x0400

So the stack will fill from 0x0013FF down to 0x001000, it is 1k byte, the dedicated data RAM is 256 bytes and rest is for application.

The accurate volumes can be set as needed by application. If you don't need dedicated data RAM, you can use only RAM in range of 0x001400 TO 0x001FFF.

I hope you project will run smoothly.

Best Regards,

Stano.

 

0 Kudos
Reply

1,067 Views
maxxu
Contributor IV

Thank you for your help!

So, is that understandable

APP_DATA_RAM  sections: 、This section is used to use variables defined by PR_SECTION(XXX)

RAM  sections:                     Used to store all local and global variables

0 Kudos
Reply

1,050 Views
StanoA
NXP TechSupport
NXP TechSupport

Yes You are right.

Stano.

0 Kudos
Reply