Horacio Hoyos

Overwritable SECTION in RAM

Discussion created by Horacio Hoyos on Aug 14, 2006
Latest reply on Aug 17, 2006 by bigmac
I am traying to get a space of RAM to contain all my temp varaibles. This SECTION can be something like 16 bytes long, but the idea is for it to hold more than 16 varaibles. This means that some variables will share the same RAM location, and thy can because they are temporal!!!

I read on the CW help that using the PAGED directive in the .prm file can do the trick.

SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
EEPROM = READ_ONLY 0xEE00 TO 0xEE40;
ROM = READ_ONLY 0xEE41 TO 0xFDFF;
FLASH_RAM = READ_WRITE 0x008C TO 0x0093;
Z_RAM = READ_WRITE 0x0094 TO 0x00DF;
TEMP_RAM1 = PAGED 0x00E0 TO 0x00EF;
TEMP_RAM2 = PAGED 0x00E0 TO 0x00EF;
ROM1 = READ_ONLY 0xFFB0 TO 0xFFBD;
ROM2 = READ_ONLY 0xFFC2 TO 0xFFCF;
END
PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */
DEFAULT_ROM, ROM_VAR, STRINGS INTO ROM; /* ROM1,ROM2 In case you want to use ROM1,ROM2 as well, be sure the option -OnB=b is passed to the compiler. */
MyCode INTO ROM;
MyEeprom INTO EEPROM;
DEFAULT_RAM,
_DATA_ZEROPAGE, MY_ZEROPAGE INTO Z_RAM;
/* Secciones de los módulos */
EE_RAM INTO FLASH_RAM;
DTMF_RAM INTO Z_RAM;
SPI_RAM INTO Z_RAM;
MY_TEMP1 INTO TEMP_RAM1;
MY_TEMP2 INTO TEMP_RAM2;
END

(do a search for "OVERLAYS" in the CW help).

I used it but when MY_TEMP1 + MY_TEMP2 size exceeds 16 bytes the linker gyves me a "can't fit the section size" error.

Can anyone point me any other methods to get this working?

Thx

Horacio

Outcomes