From: Grant Likely Date: Mon, 12 Nov 2007 16:09:55 -0700 Subject: [U-Boot-Users] RFC: Some improvements for the FPGA subsystem In-Reply-To: References: <200711111745.02822.matthias.fuchs@esd-electronics.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/12/07, Bruce_Leonard at selinc.com wrote: > Matthias, > > Matthias Fuchs wrote on 11/11/2007 > 08:45:02 AM: > > < snip > > > > 5) 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. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. grant.likely at secretlab.ca (403) 399-0195