public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tolunay Orkun <listmember@orkun.us>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] possible ELDK4 gcc compiler bug
Date: Thu, 07 Dec 2006 10:42:39 -0600	[thread overview]
Message-ID: <4578447F.30001@orkun.us> (raw)
In-Reply-To: <200612071721.10783.matthias.fuchs@esd-electronics.com>

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

      parent reply	other threads:[~2006-12-07 16:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07 16:21 [U-Boot-Users] possible ELDK4 gcc compiler bug Matthias Fuchs
2006-12-07 16:28 ` Matthias Fuchs
2006-12-07 16:38   ` Pantelis Antoniou
2006-12-07 17:12     ` Matthias Fuchs
2006-12-07 17:25       ` Timur Tabi
2006-12-07 17:33         ` Pantelis Antoniou
2006-12-07 16:42   ` Rune Torgersen
2006-12-07 16:55     ` Matthias Fuchs
2006-12-07 16:29 ` Pantelis Antoniou
2006-12-07 16:42 ` Tolunay Orkun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4578447F.30001@orkun.us \
    --to=listmember@orkun.us \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox