Brent W
(Silicon Labs Team Member)
Fri Sep 07 2007 08:40 PM
Error "Can't generate code for this expression"

Hi,

I'm porting an HID USB mouse example to HI-Tech 8051 ver 9.01 and am getting the error above. I've reduced the code to fit in this post (shows error at 'EP_STATUS[0] = EP_IDLE;' line).

Please use Code tags to maintain formatting and improve code readability. I have added them here. (mod)
Code:
#define  EP_IDLE                 0x00  // This signifies Endpoint Idle State
#define EP_HALT 0x03 // Endpoint Halt State (return stalls)

unsigned char EP_STATUS[3] = {EP_IDLE, EP_HALT, EP_HALT};

void Usb_Reset (void);

void main (void)
{

Usb_Reset ();

while (1) // Spin forever
{
}
}

void Usb_Reset (void)
{
EP_STATUS[0] = EP_IDLE; // Set default Endpoint Status
EP_STATUS[1] = EP_HALT;
EP_STATUS[2] = EP_HALT;
}



Any help would be greatly appreciated.

Thanks,

Brent


Dan Henry
(Guru)
Sat Sep 08 2007 02:04 PM
Re: Error "Can't generate code for this expression"

It appears to a problem with the small memory model. I think help will have to come directly from support@htsoft.com.

Dan Henry
(Guru)
Sat Sep 08 2007 03:05 PM
Re: Error "Can't generate code for this expression"

Quote:

It appears to a problem with the small memory model.



In the small model, static duration objects are supposed to be 'near' by default, I think. Explicitly qualifying EP_STATUS as 'near' fixes the error.

Code:
near unsigned char EP_STATUS[3] = {EP_IDLE, EP_HALT, EP_HALT};



Brent W
(Silicon Labs Team Member)
Mon Sep 10 2007 12:37 PM
Re: Error "Can't generate code for this expression"

Excellent. Thanks!

-Brent



Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5