Jake S

HC908GP32 C Help

Discussion created by Jake S on Oct 3, 2006
Latest reply on Oct 5, 2006 by Pavel Lajsner
I'm new to CW and am having trouble storing constants in ROM. My prm file is as follows:

NAMES
END

SEGMENTS
// RAM location
RAM = READ_WRITE 0x0100 TO 0x023F;

// ROM locations
ROM = READ_ONLY 0x8000 TO 0x8FFF;
LCD_ROM = READ_ONLY 0x9000 TO 0x91FF;
END

PLACEMENT
DEFAULT_RAM INTO RAM;
DEFAULT_ROM INTO ROM;
ROM_VAR, STRINGS INTO LCD_ROM;
END

STACKSIZE 0x50

VECTOR 0 _Startup

Actual ROM locations, at this point, are for testing purposes. My issue is when I use the following code in the main.c file:

#pragma CODE_SEG LCD_ROM

const unsigned char lcd[] = {1,2,3,4,5};
const unsigned char spd[] = {1,2,3,4,5};

#pragma CODE_SEG DEFAULT
.
.
.

These constants are not being stored starting at memory location 0x9000 as indicated in the prm file. Instead, they start at 0x0000 and are uninitialized even though I've initialized them. I have also added the -Cc option to the compiler with no avail. Can anyone help?

Outcomes