2003-06-30 10:03 PM
2003-06-29 10:19 PM
I use Codewarrior compiler and I want to access bits in this way:
typedef struct Type_AnIn { signed short Value; unsigned char Ampli :4; unsigned char Status :4; }; struct Type_AnIn AnIn; /* size: 3 bytes */ void Test(void) { unsigned char Aux; /* Example */ AnIn.Ampli = 3; /* write access --> warning */ AnIn.Status = 0; /* write access --> warning */ AnIn.Value = -20; /* no warning */ AnIn.Status = 0; /* write access --> warning */ Aux = AnIn.Ampli; /* read access --> no warning */ } The compiler generate the following message only when I tried to write bit access structure fields: C3604 Static '_xxPSID1' was not referenced. I think.......there is something wrong Thanks, Patrik2003-06-30 05:24 PM
I tried to run similar code on Hiware Compiler and there is no problem with bitfield operation.
There may be some other problems in the code Regards, PraveenG2003-06-30 10:03 PM
You are correct, I omit some informations because I thought the ''error'' happened anyway....sorry.
The code is like this: struct Type_AnIn AnIn[3]; void Test(void) { unsigned char Ix; for (Ix = 0; Ix < 3; Ix++) AnIn[Ix].Ampli = AMP_NTC; } When I select the ''error'' to point the code that generates it, the Codewarrior highlight the line above header of the next function.... The ''problem'' doesn't occur if I use: AnIn->Ampli = AMP_NTC; The ''problem'' doesn't occur if I use: typedef struct Type_AnIn { signed short Value; unsigned char Ampli; unsigned char Status:4; }; If I open the map file, I see that when I access a bit mapped field the compiler generates a variable (_xxPSID1) in the overlap segment. C3604 is not an error nor a warning, it's only an ''information'' message...but I want to know why... Thanks for your help, Patrik