Re: [Fx2lib-devel] Setupdata at 0xe000
Status: Beta
Brought to you by:
mulicheng
From: Maarten B. <sou...@ds...> - 2011-09-16 19:56:03
|
> OK I see now. Sorry, I was unaware of the 512 bytes of RAM at 0xe000. But these can only be used as RAM accordign to the datasheet. > If we just go ahead and change the storage class of the string > descriptors from "code" to "xdata" in setupdat.c[1] (i.e no preprocessor > guards), will it conceivably break anything? It looks to me like > changing it to "xdata" merely gives apps the option of relocating > DSCR_AREA to 0xe000 (which may be used for "xdata" only, not "code"), > but with NO downside. > > Or am I missing something? And how is that xdata filled? SDCC assumes the code memory is stored in a ROM-like memory and xdata is volatile. So during startup it copies initialized data from code to xdata. So you have two copies in memory and thus your memory footprint has grown. If you use --no- xinit-opt it is not copied but initialized by lots of instructions, usually taking even more code memory. I guess it works because SDCC's initialization code copied it from lower memory to xdata at 0xe000. I also guess you missed the downside. SDCC does not support the concept of preinitialized xdata as the FX2 has when it gets the firmware from the driver or the I2C eeprom. > FWIW, I just tried the code->xdata + DSCR_AREA=e000 change on the > firmware in FPGALink[2] and it works fine. Are you using C0 or C2 mode? C2 mode cannot load 0xe000 according to the datasheet. Can the driver download to 0xe000 directly? My advice is to keep these constants in code memory. And if you do want to change them at runtime cast a code pointer to xdata pointer to access them. If the driver really supports loading to 0xe000 you can choose to store the constants there. You can also choose to use 0xe000 as xdata as it was meant. Maarten |