Bug 11051

Summary: runtime issue on STM32 with usage of binutils 2.29.x
Product: buildroot Reporter: Christophe Priouzeau <christophe.priouzeau>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: major CC: buildroot
Priority: P5    
Version: 2018.02   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Christophe Priouzeau 2018-05-29 07:42:09 UTC
Since the default usage of binutils 2.29.x, on stm32 we have an issue at runtime.

Error seen at runtime:
[    1.460000] Unhandled exception: IPSR = 00000006 LR = fffffff1
[    1.460000] CPU: 0 PID: 1 Comm: init Tainted: G        W       4.11.0 #2
[    1.460000] Hardware name: STM32 (Device Tree Support)
[    1.460000] task: 00822000 task.stack: 00828000
[    1.460000] PC is at ret_fast_syscall+0x2/0x4a
[    1.460000] LR is at tty_ioctl+0x327/0x7e4
[    1.460000] pc : [<08009942>]    lr : [<080c1013>]    psr: 4000000b
[    1.460000] sp : 00829fa8  ip : 0000001c  fp : 00a95600
[    1.460000] r10: 00000000  r9 : 00828000  r8 : 08009ae0
[    1.460000] r7 : 00000036  r6 : 00adcee0  r5 : 00000000  r4 : 00adcf3c
[    1.460000] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : 00000000
[    1.460000] xPSR: 4000000b
[    1.460000] CPU: 0 PID: 1 Comm: init Tainted: G        W       4.11.0 #2
[    1.460000] Hardware name: STM32 (Device Tree Support)
[    1.460000] [<0800bdc5>] (unwind_backtrace) from [<0800b153>] (show_stack+0xb/0xc)
[    1.460000] [<0800b153>] (show_stack) from [<0800b717>] (__invalid_entry+0x4b/0x4c)


After a bisect, the issue are present since this commit : 
37e1e6cf6d133afeed1be98c5d5542cd00664efb package/binutils: switch to use 2.29.x as the default version

How to reproduce:
  git clone git://git.buildroot.net/buildroot
  cd buildroot
  git checkout -b work 2018.05-rc3
  make stm32f469_disco_defconfig
  make 
  ./board/stmicroelectronics/stm32f469-disco/flash.sh output/

Regards
Christophe Priouzeau
Comment 1 romain.naour 2018-05-29 07:55:33 UTC
Hello,

Thanks for the report!

This issue seems related to a change to the behaviour of the assembler's "adr" pseudo-instruction [1]

This issue has already be reported by some Buildroot user [2] but it's an upstream issue. For now, you should use a toolchain generated with Binutils 2.28.

I don't have such board to do a runtime test.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2017-November/543467.html
[2] http://lists.busybox.net/pipermail/buildroot/2018-March/215706.html
    http://lists.busybox.net/pipermail/buildroot/2018-April/219223.html
Comment 2 Christophe Priouzeau 2018-05-29 12:50:08 UTC
Thanks for the information.

I have made the test by changing the version of binutils and we doesn't see the issue at runtime.

I have pushed to patch for updating the configuration of stm32 on buildroot: 
patch 1: http://patchwork.ozlabs.org/patch/922037/
patch 2: http://patchwork.ozlabs.org/patch/922049/

Thanks for your help and your reactivity.
Chritophe Priouzeau
Comment 3 Peter Korsgaard 2018-06-01 19:54:53 UTC
Fixed by making ARM thumb builds default to binutils 2.28.x and display a warning message in the Linux config:

https://git.buildroot.org/buildroot/commit/?id=17f352acdebd4a825903807f8a2d60ebea223afb
https://git.buildroot.org/buildroot/commit/?id=3dbc5a62798d0f804a9a931b5dbd1c3a2a419ab2