public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64953] New: Compiling sourcecode for STM32F103 causes USB errors with some optimization settings
@ 2015-02-05 19:30 manuel.reimer at gmx dot de
  2015-02-05 19:34 ` [Bug c/64953] " manuel.reimer at gmx dot de
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: manuel.reimer at gmx dot de @ 2015-02-05 19:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64953

            Bug ID: 64953
           Summary: Compiling sourcecode for STM32F103 causes USB errors
                    with some optimization settings
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manuel.reimer at gmx dot de

I've tried to compile this sourcecode for an STM32F103 controller:

https://github.com/tormodvolden/maple-bootloader/tree/unify_platforms

I've modified the Makefile to use "-Os" to reduce size used in flash.

This worked well, so far, with an gcc 4.8 compiler. But if I do this with a
4.9.2 compiler, then the USB handshake fails with ugly errors on dmesg:

[ 2068.103728] usb 1-1: new full-speed USB device number 2 using xhci_hcd
[ 2068.217014] usb 1-1: device descriptor read/64, error -71
[ 2068.323573] xhci_hcd 0000:02:00.0: Setup ERROR: setup context command for
slot 1.
[ 2068.327349] usb 1-1: hub failed to enable device, error -22
[ 2068.436815] usb 1-1: new full-speed USB device number 3 using xhci_hcd
[ 2068.550102] usb 1-1: device descriptor read/64, error 18
[ 2068.656663] xhci_hcd 0000:02:00.0: Setup ERROR: setup context command for
slot 1.
[ 2068.660448] usb 1-1: hub failed to enable device, error -22
[ 2068.773235] usb 1-1: new full-speed USB device number 4 using xhci_hcd
[ 2068.773866] xhci_hcd 0000:02:00.0: ERROR: unexpected setup address command
completion code 0x6.
[ 2068.980792] xhci_hcd 0000:02:00.0: ERROR: unexpected setup address command
completion code 0x6.
[ 2069.186265] usb 1-1: device not accepting address 4, error -22
[ 2069.296195] usb 1-1: new full-speed USB device number 5 using xhci_hcd
[ 2069.296483] xhci_hcd 0000:02:00.0: ERROR: unexpected setup address command
completion code 0x6.
[ 2069.503332] xhci_hcd 0000:02:00.0: ERROR: unexpected setup address command
completion code 0x6.
[ 2069.709220] usb 1-1: device not accepting address 5, error -22
[ 2069.713114] usb usb1-port1: unable to enumerate USB device

After some trying I've found out that the key in this case is the optimization
setting. If I use "-O3", then the resulting binary works again if I use the
4.9.2 compiler.

So "something" is wrong with the optimization.

Can someone give me a hint about what changed between 4.8 and 4.9.2? Is this a
bug in the gcc compiler or do I just need some new "compiler switch" to disable
"some new feature" and get a valid binary, again?


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-02-13  8:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05 19:30 [Bug c/64953] New: Compiling sourcecode for STM32F103 causes USB errors with some optimization settings manuel.reimer at gmx dot de
2015-02-05 19:34 ` [Bug c/64953] " manuel.reimer at gmx dot de
2015-02-05 19:44 ` [Bug target/64953] " trippels at gcc dot gnu.org
2015-02-06 17:59 ` manuel.reimer at gmx dot de
2015-02-06 18:23 ` trippels at gcc dot gnu.org
2015-02-06 18:27 ` manuel.reimer at gmx dot de
2015-02-06 18:28 ` manuel.reimer at gmx dot de
2015-02-08 21:23 ` manuel.reimer at gmx dot de
2015-02-08 21:33 ` trippels at gcc dot gnu.org
2015-02-08 21:45 ` manuel.reimer at gmx dot de
2015-02-09  5:51 ` trippels at gcc dot gnu.org
2015-02-10 11:41 ` rearnsha at gcc dot gnu.org
2015-02-10 16:17 ` manuel.reimer at gmx dot de
2015-02-10 16:52 ` rearnsha at gcc dot gnu.org
2015-02-10 17:17 ` manuel.reimer at gmx dot de
2015-02-10 17:23 ` manuel.reimer at gmx dot de
2015-02-10 18:38 ` pinskia at gcc dot gnu.org
2015-02-10 19:44 ` manuel.reimer at gmx dot de
2015-02-13  8:34 ` maltsevm at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).