8051 >> 8051

Pages: 1
Brent W
Silicon Labs Team Member


Reged: Aug 21 2007
Posts: 2
Loc: Austin, TX
Error "Can't generate code for this expression"
      #29553 - Fri Sep 07 2007 08:40 PM

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

Edited by Dan Henry (Sat Sep 08 2007 01:19 PM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3210
Loc: Boulder, Colorado U.S.A.
Re: Error "Can't generate code for this expression" [Re: Brent W]
      #29557 - Sat Sep 08 2007 02:04 PM

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

Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3210
Loc: Boulder, Colorado U.S.A.
Re: Error "Can't generate code for this expression" [Re: Dan Henry]
      #29558 - Sat Sep 08 2007 03:05 PM

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};



Post Extras: Print Post   Remind Me!   Notify Moderator  
Brent W
Silicon Labs Team Member


Reged: Aug 21 2007
Posts: 2
Loc: Austin, TX
Re: Error "Can't generate code for this expression" [Re: Dan Henry]
      #29577 - Mon Sep 10 2007 12:37 PM

Excellent. Thanks!

-Brent


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:  ndouglas, garth, jtemples, Dan Henry, Andrew L, Ryan, mikerj 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 2547

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5