Maarten Brock wrote:
> Dennis,
> 
> Initially you had --xram-loc=0x4000, but the FX2 has 
> only 16kB RAM so there is nothing at 0x4000 unless you 
> have external RAM connected. Without any --xram-loc SDCC 
> puts xdata at 0x0000 but unless you have external ROM 
> and EA=1 this memory is shared with code memory. So any 
> write to xdata 0x0000 and up will overwrite the reset- 
> and interrupt vectors and the rest of your program!

The Development board does indeed have external ram shared with the code 
space at 0x0000 to 0x4000.  It has 64k total external ram (0x0000 to 
0xffff).  That is why starting at a higher number like 0x4000 works. 
The external memory can be turned off though depending on a couple 
jumper switches so that only up to 0x4000 is available for a program.

> 
> During initialization SDCC needs something like P2 on 
> the original 8051 to output the high byte of the 
> address. For the FX2 this is MPAGE (0x92) and you need 
> to tell SDCC about it through defining _XPAGE.  An 
> alternative is to reassemble crtxinit.asm for dual data 
> pointer use as the FX2 supports that as well.

If using _XPAGE works, I don't see a lot of reason to redo crtxinit.asm. 
  I do wonder if changing the way xdata is used by the compiler in 
general is worth looking at.  i.e., why use _XPAGE if you can always use 
dptr?

> 
> So if you only have internal memory, you best use --
> code-size=0x3000 to limit the generated code size and --
> xram-loc=0x3000 and --xram-size=0x1000 to make sure 
> xdata does not overlap with code memory.


Thanks for the additional info, this is helping to clarify what was 
going on and what can be done to help ensure a more stable build 
environment (like not having added variables crash the program.)

-Dennis



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to