|
|
View previous topic :: View next topic |
Author |
Message |
Lnguyen
Joined: 10 Nov 2007 Posts: 1
|
How to define data structure in ROM? |
Posted: Sat Nov 10, 2007 2:09 pm |
|
|
Could you please show me how to define structure in CCS, but it is located in ROM?
example for assembly:
left db 0x00,0x00
right db 0x00,0x00
roof dw left, right
but example for C:
static const byte left[]={0x00,0x00};
static const byte right[]={0x00,0x00};
static const long roof[]={address of left, address of right};
I do not want to use absolute address by using #org or #locate
I also want to build a TREE structure, but my data is put in ROM. Please show me how to do.
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah Guest
|
|
Posted: Sun Nov 11, 2007 3:41 am |
|
|
I think the problem is that he wants to store addresses of constant values. As such, this can be done, but you can't store these addreses in a constant.
Key to understand, is that a 'const' declaration, actually generates a program to retrieve the value. So the value itself, won't reside at the location where the 'program' is declared. The addressof function, allows you to retrieve the 'real' address for the data, but this is a runtime function, and the value it returns,is not therefore available at compile tme.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|