We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a function that creates an instance of a structure on the users stack. The structure is called object and it is located at address 0xEFB0.
boolean CAN1_read(ubyte mbx, CAN_MSG *msg) { ubyte newd; TCAN1_Obj object; if ( newd = CAN1_ubNewData(mbx) ) { CAN1_vGetMsgObj(mbx, &object); CAN1_vReleaseObj(mbx); msg->id = object.ulArbitr; msg->size = object.ubMsgCfg >> 4; memcpy(&msg->data[0], &object.ubData[0], msg->size); } return((boolean)newd); }
CAN1_vGetMsgObj(mbx, (TCAN1_Obj huge *)&object);
I had a similar problem with the following piece of code:
static const int OpCodes[][8]= { /* ... */ }; void SomeFunction(int n) { ( (void (*)(void)) (OpCodes[n]) ) (); }
Interesting. This code seems so fundamental that I didn't even consider the possibility that it could be a bug. Does anyone have any ideas for things that I can try to make the code compile correctly without using a huge pointer? -Walt
Maybe switch to the previous version of the compiler? - Mike
Hi Mike: The problems I describe in this thread and in a recent thread http://www.keil.com/forum/msgpage.asp?MsgID=4783 were both solved by turning off all compiler optimization. This was something that you suggested doing in the other thread but unfortunately I forgot about after being pulled from the project temporarily. After reviewing the other thread I decided to give it a try and was amazed that that was causing the problems I have been fighting for so long. Thanks again for your help. -Walt