CONST_SEG into flast using struct

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

CONST_SEG into flast using struct

2,865 Views
CarlFST60L_3rd
Contributor I
Ok, I have a problem getting these structs to go into Flash in my table.

The first two constants work (just bytes) but the stucts come up in RAM!

I have these lines in my PRM

Code:
ENTRIES  FB01  FB02  TestEvent END

 
Here is a sample of the code (has been modified to remove what it actually does)

Code:
//********************************************************************************************************************************************************//Flash data#pragma CONST_SEG UserFlashData//These work fine and show up at required addressconst far byte FB01 = 0xC1;                   //Two GP registers in flashconst far byte FB02 = 0xC4;                   //Two GP registers in flash//These dont and show up in RAM!volatile far struct SomeStructure TestEvent[10] ={  {  0,                               1,                                  2,                            3                     },{  0,                               1,                                  2,                            3                     },{FALSE}};#pragma CONST_SEG DEFAULT//********************************************************************************************************************************************************

To many possiblities for me to keep guessing and trying, so i thought i would just ask

EDIT* Using Version 5.9.0 and using S08 family 8 bit (S08GB32)

Thanks,
Carl
 


Message Edited by CarlFST60L_3rd on 2008-02-05 05:08 AM
Labels (1)
0 Kudos
Reply
3 Replies

633 Views
CrasyCat
Specialist III
Hello
 
Actually the structure is not defined as constant, so it will be allocated in a data segment.
 
You need to define it as
 
const struct SomeStructure TestEvent[10] = {
...
}
 
I do not understand why you are applying the modified far and volatile to this constant.
 
Anyway if the structure is allocated in flash, its content does not change. So why are you defining it as volatile?
CrasyCat
0 Kudos
Reply

633 Views
CarlFST60L_3rd
Contributor I
It is in a varible flash table that changes, so to me its not actually constant, and it is volitile. Is my reasoning wrong?

Edit: I also defined it as far as it is, isnt it? (its at address 0xF000)

It would be good to get some clarification on these issues at it all seems to be assumed knowledge in the documentation.


Message Edited by CarlFST60L_3rd on 2008-02-05 11:17 AM

Message Edited by CarlFST60L_3rd on 2008-02-05 11:18 AM
0 Kudos
Reply

633 Views
CrasyCat
Specialist III
Hello
 
If you want to get the table allocated in the section UserFlashData you need to define it as const.
Otherwise it will go into a data section (not a const section).
 
Only thing you can try out is the following
volatile far struct SomeStructure TestEvent[10] @ "UserFlashData "= {
...
}
 
This should force allocation of the table in the specified section.
 
Around far modifier, this modifier applies to pointer only (please refer to the compiler reference manual).
And if you build in small memory model far is not needed anyway..
 
CrasyCat
0 Kudos
Reply