d00dajo
Joined: 20 Jul 2004 Posts: 34
|
Defining a structure in CCS |
Posted: Fri May 13, 2005 5:02 am |
|
|
Hi,
I have run into a problem with code explosion using the CCS compiler.
Now, what I want to define is something like:
struct
{
int8 b[6]
int8 c[8]
int8 d[2]
int 8 e
}a[3]
That is , I want to access a[1].d[0] etc. Now, looking at the assembler code generated I suspect that the structure is NOT saved in the way I intended it to be.
The way I want to be able to use it, the memory for "b" should be allocated linearly.
That is, to get a[1].b[5] I would like to use
int16 * ptr ;
ptr = a[1].b;
ptr[5]; //THIS SHOULD BE a[1].b[5]
Now, it appears that the struct is not saved in this manner. How do I define a structure with the memorymapping I want?
That is memory usage as follows (in bytes):
//Start of struct
adr+0:[a0.b0]
adr+1:[a0.b1]
adr+2:[a0.b2]
adr+3:[a0.b3]
adr+4:[a0.b4]
adr+5:[a0.b5]
adr+6:[a0.c0]
....
And so on.
(Yes, I could manually define every variable and separate them, but surely there must be a way to define a struct to do this?)
Thanks in advance //DJ. |
|