2 Nov 2008 10:21
Re: Memory Weirdness
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! 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. 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. Maarten > Dennis Muhlestein wrote: > > Dennis Muhlestein wrote: > >> I have a little test program I've been playing with to test different > >> variable sizes and locations. I came across a weird situation and > >> I'm hoping someone can help me explain it. > > I've traced this problem down to a smaller issue.(Continue reading)
RSS Feed