[U-Boot-Users] possible ELDK4 gcc compiler bug
Tolunay Orkun
listmember at orkun.us
Thu Dec 7 17:42:39 CET 2006
Matthias Fuchs wrote:
> Hi,
>
> I noticed some strange behavior when using the ELDK4 gcc for compiling
> U-Boot for a (new) 405 target based on the current PMC405 board.
>
> The code needs to read-modify-write a memory mapped FPGA internal register.
> But the FPGA access does not appear in the object and therefore it is never
> done.
>
> Here are some code snippets:
>
> 1) my 'fifo' BSP command:
>
> int do_fifo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> {
> struct pmc405v2_fpga_s *fpga = (struct pmc405v2_fpga_s *)FPGA_BA;
> int i;
> int n = 0;
The compiler is optimizing away your code. Check out the 'volatile'
keyword. It is exactly this situation it was intended. A better way is
to use in32() out32() etc. The I/O accessors make sure I/O operation is
completed before next instruction is executed. Simply accessing the
memory mapped registers might not archive the same.
Best regards,
Tolunay
More information about the U-Boot
mailing list