#pragma.....

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

#pragma.....

1,543 Views
DavidoBG
Contributor II
I have a big structure (sizeof structure "x" equal 0x100). So my RAM equals 0x200!!!! I would like declared this structure on the first page of my flash. Is it possible??
I try to use
#pragma CONST_SEG STRUCT_ZONE_CODE
struct x{
...
....
....
};
#pragma CONST_SEG DEFAULT
 
in prm file i added
    STRUCT_ZONE =  READ_WRITE    0xE000 TO 0xE1FF;
 
STRUCT_ZONE_CODE                      INTO STRUCT_ZONE;
 
But no effect.
Thanks for your help
David
 
Labels (1)
0 Kudos
4 Replies

348 Views
MrBean
Contributor I
As compilerguru says, use the pragma to place a const , not a struct definition, into the SECTION.
 
Furthermore: i think the .prm line should read:
 
STRUCT_ZONE =  READ_ONLY   0xE000 TO 0xE1FF;
 
because you cannot simply write to it.
The linker may outsmart you because of the READ_WRITE you used...
 
You can still re-program the const via flash routines, with the above .prm line


Message Edited by MrBean on 2008-11-27 02:09 PM
0 Kudos

348 Views
DavidoBG
Contributor II
It's running now!!! Thanks a lot
 
David
0 Kudos

348 Views
DavidoBG
Contributor II
I try again but not successfull.
But my problem is :
I use MCS08QE8 µC (512 Bytes = RAM) but i have a big structure around 256Bytes. To keep my space RAM, i would like declare my big structure in Flash instead of use RAM.
Is it really possible???
Or What is the method to avoid use always RAM Access to manage variable.
 
Thanks you
 
 
David
0 Kudos

348 Views
CompilerGuru
NXP Employee
NXP Employee
That should work as you tried, apart
(I guess is only because of the code extraction), a variable in C has to have name, otherwise it is just a struct type definition.
Also #pragma CONST_SEG applies to constants, so it should be something similar to:

Code:
#pragma CONST_SEG STRUCT_ZONE_CODEconst struct x {int i;} VarNameOfx;#pragma CONST_SEG DEFAULT


Daniel
0 Kudos