Hi Jake,

If there are problems with globals and statics in xdata 
not being initialized, it probably has to do with mcu-
internal xdata memory. The original 8051 had no internal 
xdata but external.

SDCC uses a loop containing MOVC A,@A+DPTR to get the 
initializers from code memory and MOVX @R0,A to store 
them in xdata. The high byte of the xdata address is put 
to P2 on a genuine 8051/8052. Most derivatives with 
internal xdata memory do not use the contents of P2 for 
the high address byte but invented another SFR for that 
(or nothing at all). The name of this SFR is not 
standard and can be XPAGE, MPAGE, EMI0CN or other.

SDCC introduced a virtual SFR name for this one and it's 
called _XPAGE. It defaults to P2, but defining it 
anywhere in your program overrules this. Check the 
datasheet of your mcu to find it and its address, just 
like you do for all SFR's if SDCC does not have a header 
file for your derivative. All this was introduced after 
SDCC 2.4.1 in the first half of 2004.

If your derivative has dual data pointers a better 
solution could be to change crtxinit.asm to use those 
instead.

Hope this clears things up.
Maarten

> Sorry I can't be very specific here because I only faintly recall the issue.
> But I think it has to do with static global data allocated within XDATA.  It
> somehow takes up more space than required within the linked result.
> 
> I never pursued it.  The Keil compiler and all the FX2 samples put static
> stuff in XDATA and it caused larger binaries.  If one just removed the
> "XDATA", things work fine and the static global data is still initialized
> properly.
> 
>    Jake
>  
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of 
> > Maarten Brock
> > Sent: Thursday, December 28, 2006 9:46 AM
> > To: [email protected]
> > Subject: Re: [Sdcc-user] XDATA and the FX2
> > 
> > Chris,
> > 
> > I have no idea what you mean and do not intend to wade 
> > through all GnuRadio code to find what you're pointing at. 
> > What is "the issue" with XDATA, the Cypress FX2LP, and SDCC? 
> > If you cannot identify the problem we can give no history, no 
> > workaround and no patch.
> > 
> > Maarten
> > 
> > > Is there someone on the list that can explain the issue with XDATA, 
> > > the Cypress FX2LP, and SDCC. I see various comments 
> > (particularly in the GnuRadio code) about how SDCC doesn't 
> > handle XDATA correctly.
> > > What is history of this problem? Is there an accepted 
> > workaround? Or 
> > > does SDCC really need a patch to handle this?
> > > 
> > > --
> > > C


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to