Skip to contentSkip to conversation

WARNING: in gcc 4.5.0 and 4.5.1 volatile is ignored

U-Boot Alexander Holler 4 participants 8 messages Jan 22, 2011 – Jan 24, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

because I've recently seen some other places where volatile is used to access registers without using read?() or write?() and many people seem to start using 4.5.1, I want to post this warning using a descriptive subject.

The keyword volatile might not have any effect when reading when gcc 4.5.0 or 4.5.1 is used.

The appropriate bug seems to be that one:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45052

You might either change such code to use readb(), readw() or readl(), or you have to use either an older version of gcc or a version >= 4.5.2 (it is fixed in 4.5.2).

A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):

http://lists.denx.de/pipermail/u-boot/2011-January/084885.html

Regards,

Alexander

#1 lore raw

Dear Alexander Holler,

Quoted 8 lines · In message <[email protected]> you wrote:

because I've recently seen some other places where volatile is used to access registers without using read?() or write?() and many people seem to start using 4.5.1, I want to post this warning using a descriptive subject.

The keyword volatile might not have any effect when reading when gcc 4.5.0 or 4.5.1 is used.

Actuelly this warning should eventually be extended to carefully check results when using any of the currently available 4.5.x versions of GCC.

Quoted 3 lines

The appropriate bug seems to be that one:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45052

This is probably only one part of the problem. Thereare a number of other bugs in thes ecompiler versions, for example this one:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44392

Unfortunately there appears to be little interest within the GCC folks to fix porolems that affect only such lunatic fringe groups as the embedded folks, so I don't expect to see fixes any time soon. Even bigger projects like the Linux Foundation driven Poky (resp. Yocto project) capitulated and stopped using -Os, see for example here:
http://thread.gmane.org/gmane.linux.embedded.poky/2311/focus=2565

Yes, "-Os" is default setting for U-Boot - changing it to (for example) -O2 will generate significantly larger code and even break a number of boards.

It appears there are a number of other issues with GCC 4.5.x that affect us. If you are using any such tool chain, and see strange results or unexpected breakages, it is probably a very good idea to try another (older, working) tool chain first, before spending any tme on debugging.

Quoted 3 lines

You might either change such code to use readb(), readw() or readl(), or you have to use either an older version of gcc or a version >= 4.5.2 (it is fixed in 4.5.2).

We will take care to provide working (at least with most of the compiler versions) I/O accessors (including sufficient memory barriers), and all code that uses the old volatile pointer approach to access device registers should be converted to use proper I/O acessors.

Quoted 4 lines

A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):

http://lists.denx.de/pipermail/u-boot/2011-January/084885.html

Thanks for raising this issue again.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The ideal situation is to have massive computing power right at home.
Something that dims the streetlights and shrinks the picture  on  the
neighbours' TVs when you boot it up.
#3 lore raw

Hi Dirk,

Le 22/01/2011 18:40, Dirk Behme a ?crit :

Quoted 7 lines · Alexander Holler
Quoted 4 lines

A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):

http://lists.denx.de/pipermail/u-boot/2011-January/084885.html

What's about pulling it sooner than later into master, then?

I will send out a pull request for u-boot-arm once I have applied all outstanding ARM patches from jan 17 or before and all outstanding ARM bug fixes regardless of their date, and pulled other ARM repos whose custodian requests pulling.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

Dear Albert ARIBAUD,

Quoted 6 lines · In message <[email protected]> you wrote:

Le 22/01/2011 18:40, Dirk Behme a =E9crit :

Quoted 4 lines · Alexander Holler
Quoted 3 lines

A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

http://lists.denx.de/pipermail/u-boot/2011-January/084885.html

What's about pulling it sooner than later into master, then?

I will send out a pull request for u-boot-arm once I have applied all outstanding ARM patches from jan 17 or before and all outstanding ARM bug fixes regardless of their date, and pulled other ARM repos whose custodian requests pulling.

Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Star Trek Lives!
#5 lore raw

Le 22/01/2011 20:30, Wolfgang Denk a ?crit :

Quoted 13 lines

Dear Albert ARIBAUD,

Quoted 10 lines · In message<[email protected]> you wrote:

Le 22/01/2011 18:40, Dirk Behme a =E9crit :

Quoted 7 lines · Alexander Holler
Quoted 4 lines

A patch for write?() and read?() is currently in the u-boot-arm-repository (but not in the master and not in 2010.12):

http://lists.denx.de/pipermail/u-boot/2011-January/084885.html

What's about pulling it sooner than later into master, then?

Quoted 7 lines
Quoted 4 lines

I will send out a pull request for u-boot-arm once I have applied all outstanding ARM patches from jan 17 or before and all outstanding ARM bug fixes regardless of their date, and pulled other ARM repos whose custodian requests pulling.

Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?

I didn't comment on this point as it was not for me to decide upon releasing an interim U-boot version :) but I'm fine with it if you do. When I rebase on u-boot/master before sending my pull request, I'll simply skip the corresponding patch in my tree as it will already be on yours.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

Dear Albert ARIBAUD,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?

I didn't comment on this point as it was not for me to decide upon releasing an interim U-boot version :) but I'm fine with it if you do. When I rebase on u-boot/master before sending my pull request, I'll simply skip the corresponding patch in my tree as it will already be on yours.

As soon as you send the pull-request for ARM (when will that be, btw?) I will also cherry-pick that commit into a .1 stable branch.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The greatest warriors are the ones who fight for peace."
- Holly Near
#7 lore raw

Le 24/01/2011 14:03, Wolfgang Denk a ?crit :

Quoted 7 lines

Dear Albert ARIBAUD,

Quoted 4 lines · In message<[email protected]> you wrote:
Quoted 3 lines

Thanks - but I also think that Dirk's proposal to create a v2010.12.1 bug fix release makes sense. What do you think?

Quoted 8 lines
Quoted 5 lines

I didn't comment on this point as it was not for me to decide upon releasing an interim U-boot version :) but I'm fine with it if you do. When I rebase on u-boot/master before sending my pull request, I'll simply skip the corresponding patch in my tree as it will already be on yours.

As soon as you send the pull-request for ARM (when will that be, btw?) I will also cherry-pick that commit into a .1 stable branch.

Ok. I am going through my patchwork backlog; I might be done tomorrow evening, but more probably the day after.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.