HC908GP32 C Help

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

HC908GP32 C Help

1,792 Views
spatula
Contributor I
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?
Labels (1)
0 Kudos
3 Replies

310 Views
CompilerGuru
NXP Employee
NXP Employee
Two things,

First very probably your constants are not allocated at all.
Either use them or add an
ENTRIES lcd spd END
block to the prm.

The second point is that you are using the LCD_ROM as segment name, and not on the left side in the placement.
So what you intended:


SEGMENTS
...
MY_LCD_ROM = READ_ONLY 0x9000 TO 0x91FF;
END
PLACEMENT
...
LCD_ROM INTO MY_LCD_ROM;
END

-cc has no effect when using ELF.

Daniel
0 Kudos

310 Views
spatula
Contributor I
Ahh... I'm used to using DS, RMB, etc. in other assemblers where you don't have to consume the constants in order for them to be in ROM. Thanks for the help!!
0 Kudos

310 Views
ok2ucx
Contributor IV
Hi,
 
try using
 
#pragma CONST_SEG STRINGS

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

#pragma CONST_SEG DEFAULT
.
instead.
 
Regards, Pavel ok2ucx

Message Edited by ok2ucx on 2006-10-0511:36 AM

0 Kudos