Re: [Fx2lib-devel] Linker Options
Status: Beta
Brought to you by:
mulicheng
From: Dennis M. <de...@ub...> - 2010-01-27 19:00:42
|
> > The problem is more generic than that. Is there a way for the linker to fail when two sections (which may be abs sections or not) overlap. Setting the code/data etc sizes "--code-size" does protect against relative code sections from overrunning the boundary, but there is no protection for abs sections. > > The problem is the FX2 has 2 alignment requirements, the vectors must be on a 256 byte page boundary and the various descriptors - in order to be sent automatically - need to be word aligned. The fx1 does not have the descriptor alignment limitation, so its descriptor can just be defined in regular .c files. > > One thing that can help is to move the interrupt vectors to low memory, the descriptors after that - which can be tucked tightly after the interrupt vectors (no page alignment issues, just word). And then you can move the starting --code-addr to after the descriptors. This does not eliminate the possible overlap, but does confine it to just one place. > > I think I remember using something like "--code-loc 0x0200 --code-size 0x1200 --xram-loc 0x1400 --xram-size 0x0030" on the fx2. > I like the idea of putting the jump table first. SDCC generates a bunch of interrupt code for the USB and gpif interrupts at the interrupt locations 13-whatever but these are redundant with the jump table (and unused). Seems like it would be a good idea to overlay the jump table in that area. I think the jump table takes less bytes than the interrupt code SDCC generates does. I'll play around with that when I get a second. I think there is always going to be some responsibility on the person compiling the firmware to make sure their descriptor (yes the whole descriptor/strings etc) fit within the space allotted. It might work fine for a while but then you might add some long device names or company names or something and find your firmware doesn't work any longer. -Dennis |