Forwarded message follows --------------------------------------------------------------------------
Kurt, All global and static variables in xdata are initialized by crtxinit.asm. This piece uses DPTR to read code memory and MOVX @Ri and _XPAGE to write xdata memory. Afterwards _XPAGE is set to the start of pdata. Paged memory (pdata) is 256 bytes or less, SDCC does not use _XPAGE after initialization. Maarten > Maarten; > > Thanks for the reply. I'm more of a hacker than a programmer. It still > isn't obvious to me after reading section 4.1.1. > > The Cypress manuals shows the MPAGE register within the CY7C68013 is only > used for Upper Addr Byte of MOVX using @R0 / @R1. I wasn't certain that > the compiler would work or initialize variables or stop paging external > memory just by redefining _XPAGE. I do initialize the MPAGE register just > in case the instruction is used. But I didn't need to specify paged > memory locations as the part has 16K built in and the EZ-USB development > board has 64K of external memory too. I don't plan on running out. > > I also couldn't tell how the compiler decides how large the paged memory > is? It looks like we have to track memory usage if we're using paged > memory to guarantee that we stay within the physical limits. > > Here's section 4.1.1 from V2.9.2. I do redefine _XPAGE to 0x92 just in > case. Then if the compiler does invoke a paged memory access it wouldn't > corrupt P2 which is mapped to IOC (0xA0) of the CY7C68013. I had tested > for paging by decompiling the hex code and searching for P2 in the output > listing prior to redefining _XPAGE. > > > SDCCMan.pdf V2.9.2 Section 4.1.1 for reference... > > > > Kurt M. Sanger > > > > > From: > "Maarten Brock" <sourceforge.br...@dse.nl> > To: > sdcc-user@lists.sourceforge.net > Date: > 10/28/2009 03:46 PM > Subject: > Re: [Sdcc-user] Fw: Support for C99 designated initializers? > > > > Kurt, > > If you had read 4.1.1 too, you would have realized that > it was enough to declare _XPAGE as an alias for MPAGE to > make xdata initialization work. And it probably saves a > lot of code memory. > > Maarten > >> Brandon; >> >> In this case I would try initializing your structure within your main >> startup. If that works, then the compiler recognizes structures and its > >> just an issue of writing the startup code you need to initialize your >> variables. (Section 3.12 Startup Code of sdccman.pdf) I'm writing for > an >> 8051 embedded within a Cypress CY7C68013 IC. I found I needed to write > my >> own startup function, and in it I initialize xdata variables. I didn't >> rewrite sections to initialize other data types such as idata, byte > data, >> and registers. I have to remember to use global variables and > initialize >> them in order to guarantee that they are setup properly. For instance I > >> had a local static variable that wasn't getting initialized too. >> >> Kurt M. Sanger >> >> ----- Forwarded by Kurt M. Sanger/241870/EKC on 10/27/2009 01:09 PM > ----- >> >> From: >> Brandon Fosdick <b...@bfoz.net> >> To: >> sdcc-user <sdcc-user@lists.sourceforge.net> >> Date: >> 10/27/2009 12:15 AM >> Subject: >> [Sdcc-user] Support for C99 designated initializers? >> >> >> >> I tried to do something like >> >> struct {int a, b;} mystruct = { .a=1, .b=1 }; >> >> and it didn't work, even though I used the --std-c99 option. Did I do >> something wrong or is this unsupported? >> >> The error message was: >> >> ../main.c:38: syntax error: token -> '.' ; column 33 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user