
On 11/12/07, Bruce_Leonard@selinc.com Bruce_Leonard@selinc.com wrote:
Matthias,
Matthias Fuchs matthias.fuchs@esd-electronics.com wrote on 11/11/2007 08:45:02 AM:
< snip >
- Add post() and pre() callback for Spartan2/3 FPGAs inslave serial
mode.
Only comment I have is to point out that one of the things we talked about last summer. The Spartan 3 code in particular (and I think all of the Xilinx/Altera code in general) makes the pre()/post() function calls optional. However, the relocation code doesn't check to see if the pre()/post() functions exist and therefore incorrectly "relocates" them even if they don't exist. This causes problems later because they now appear to exist since they no longer have a NULL address. One of the things we talked about was makeing the FPGA relocation code smart enough to detect NULL addresses for these functions and not relocate them.
Now it may not be an issue anymore. I made the changes to the code, but when stepping through 1.3.0-rc3 of the code, I noticed that gd->reloc_off = 0 which ment that the relocation_offset passed to the FPGA relocation code was zero and therefore nothing actually got relocated. So a NULL pointer is still NULL when zero is added to it. Now, I'm not sure why gd->reloc_off = 0, it may be my setup, it may be I'm broken, it may be that it's no longer used for some reason I don't know about. But it seems to me that the FPGA relocation code should still deal with non-existant pre()/post() functions, just in case gd->reloc_off is not zero in someone else's circumstances.
Manual relocation shouldn't be necessary *at all*. The fact that we have it is due to the u-boot C environment being broken. I've fixed it for many of the powerpc ports, which is why reloc_off is now zero for those boards. Unfortunately, the fix only works with some versions of GCC, so the fix might need to be temporarily backed out. :-(
Regardless, fixing the FPGA manual reloc code is trivial and should definitely be done.
Cheers, g.