cancel
Showing results for 
Search instead for 
Did you mean: 

Using the NO_OVERLAP command

us2
Associate II
Posted on June 16, 2003 at 07:40

Using the NO_OVERLAP command

4 REPLIES 4
us2
Associate II
Posted on June 16, 2003 at 05:13

Hi

I have a problem using the NO_OVERLAP command. I have some local variables which I would like to protect against overwriting. Therefore, I put the #pragma NO_OVERLAP in front of the function as described in the documentation but the variables end up in the REG_AREA in stead of the DEFAULT_RAM area as said in the documentation and I get an error when emulating - writing to write protected area.

Here is my code. What do I do wrong?

#pragma NO_OVERLAP

void ADkonverter(unsigned char AD_kanal)

{

extern unsigned int AD_vaerdi_lo;

unsigned char opsaetning;

unsigned int roter;

signed char n;

opsaetning = 0;

roter = 0;

n = 0;

if (AD_kanal == 0) opsaetning = 0x97; //10010111b

else if (AD_kanal == 1) opsaetning = 0xD7; //11010111b

else if (AD_kanal == 2) opsaetning = 0xA7; //10100111b

PFDR = PFDR & pf2_dclk_off;

much more code

}

Regards,

Ulrich
us2
Associate II
Posted on June 16, 2003 at 05:15

...sorry for all the posts but somehow my post ended up being empty when I used the code commands!

/Ulrich
shreya
Associate II
Posted on June 16, 2003 at 06:50

Hello,

Please check that the memory sections you are defining are compatible with the memory map of the device you are using.

Could you post the part of your configuration file where you define your memory sections?
us2
Associate II
Posted on June 16, 2003 at 07:40

I am using the ST72334 and Metrowerks. Here is the .prm file:

/* STACK INITIALIZATION ******************************************************/

STACKTOP 0x01FF

/* MEMORY LOCATION SETTING ***************************************************/

SECTIONS

/* For ST72331J4 & ST72331N4 */

RAM0 = READ_WRITE 0x0080 TO 0x017F;

MY_STACK = READ_WRITE 0x0180 TO 0x01FF;

RAM1 = READ_WRITE 0x0200 TO 0x027F;

ROM = READ_ONLY 0xC000 TO 0xFFDF;

EEPROM_A = READ_WRITE 0x0C00 TO 0x0C0B;

EEPROM_B = READ_WRITE 0x0C10 TO 0x0C15;

EEPROM_LO = READ_WRITE 0x0C20 TO 0x0C2B;

EEPROM_HI = READ_WRITE 0x0C30 TO 0x0C3B;

EEPROM_AD = READ_WRITE 0x0C40 TO 0x0C4B;

EEPROM_ALARM1 = READ_WRITE 0x0C50 TO 0x0C54;

EEPROM_ALARM2 = READ_WRITE 0x0C16 TO 0x0C1F;

EEPROM_R3 = READ_WRITE 0x0C2C TO 0x0C2F;

EEPROM_R4 = READ_WRITE 0x0C3C TO 0x0C3F;

EEPROM_R5 = READ_WRITE 0x0C4C TO 0x0C4F;

PLACEMENT

REG_AREA INTO NO_INIT 0x0000 TO 0x007F;

/* PORT_A INTO NO_INIT 0x0000 TO 0x0002;

PORT_C INTO NO_INIT 0x0004 TO 0x0006;

PORT_B INTO NO_INIT 0x0008 TO 0x000A;

PORT_E INTO NO_INIT 0x000C TO 0x000E;

PORT_D INTO NO_INIT 0x0010 TO 0x0012;

PORT_F INTO NO_INIT 0x0014 TO 0x0016;

MISC INTO NO_INIT 0x0020 TO 0x0020;

SPI INTO NO_INIT 0x0021 TO 0x0023;

WDG INTO NO_INIT 0x002A TO 0x002B;

EEPROM_REG INTO NO_INIT 0x002C TO 0x002C;

TIMERA INTO NO_INIT 0x0031 TO 0x003F;

TIMERB INTO NO_INIT 0x0041 TO 0x004F;

SCI INTO NO_INIT 0x0050 TO 0x0057;

ADC INTO NO_INIT 0x0070 TO 0x0071;

EEPROM INTO NO_INIT 0x0C00 TO 0x0CFF;*/

DEFAULT_ROM, ROM_VAR, STRINGS INTO ROM;

DEFAULT_RAM INTO RAM1;

_ZEROPAGE, _OVERLAP INTO RAM0;

SSTACK INTO MY_STACK;

A_SPACE INTO EEPROM_A;

B_SPACE INTO EEPROM_B;

LO_SPACE INTO EEPROM_LO;

HI_SPACE INTO EEPROM_HI;

AD_SPACE INTO EEPROM_AD;

ALARM1_SPACE INTO EEPROM_ALARM1;

ALARM2_SPACE INTO EEPROM_ALARM2;

R3_SPACE INTO EEPROM_R3;

R4_SPACE INTO EEPROM_R4;

R5_SPACE INTO EEPROM_R5;

END

I have tried to define NO_OVERLAP after DEFAULT RAM to put it into the RAM1 space but I got a linker 2300 error message. I also tried to write #pragma DATA_SEG NO_OVERLAP in front of the function in stead of only #pragma NO_OVERLAP but that only resulted in the local variables being stored in the _OVERLAP area.

I hope that helps

Regards,

Ulrich