[OpenWrt-Devel] u-boot/lantiq: gcc7 incompatibility: resets when trying to access network

Martin Schiller ms at dev.tdt.de
Mon Sep 24 08:17:22 EDT 2018


On 2018-09-24 13:38, Martin Schiller wrote:
> On 2018-09-24 13:14, Martin Schiller wrote:
>> Hi,
>> 
>> I've got some problems with the lantiq uboot in combination with the
>> (default) gcc 7.x compiler.
>> 
>> Setting "OPTFLAGS" in uboot's config.mk to "-O2" or the default "-Os"
>> leads to the following behaviour:
>> 
>> The uboot compiles well, but when you try o access the ethernet
>> network (ping/tftboot) the device do a RESET:
>> 
>> (tested on a Lantiq VRX268 v1.2)
>> 
>> ----------------------------------------------------
>> ....
>> VR2020 # ping 192.168.1.20
>> ltq_phy: addr 1, link 0, speed 10, duplex 0
>> ltq_phy: addr 17, link 0, speed 10, duplex 0
>> ltq_phy: addr 18, link 0, speed 10, duplex 0
>> ltq_phy: addr 19, link 1, speed 100, duplex 1
>> ltq_phy: addr 20, link 0, speed 10, duplex 0
>> Using ltq-eth device
>> 
>> ROM VER: 1.1.4
>> CFG 04
>> _�
>> ROM VER: 1.1.4
>> CFG 04
>> EEPROM Data OK
>> UART
>> 
>> ----------------------------------------------------
>> 
>> doing the same with "OPTFLAGS" set to "-O1" everything works fine:
>> 
>> ----------------------------------------------------
>> ...
>> VR2020 # ping 192.168.1.20
>> ltq_phy: addr 1, link 0, speed 10, duplex 0
>> ltq_phy: addr 17, link 0, speed 10, duplex 0
>> ltq_phy: addr 18, link 0, speed 10, duplex 0
>> ltq_phy: addr 19, link 1, speed 100, duplex 1
>> ltq_phy: addr 20, link 0, speed 10, duplex 0
>> Using ltq-eth device
>> host 192.168.1.20 is alive
>> VR2020 #
>> ----------------------------------------------------
>> 
>> When using gcc 6.x or 5.x, "OPTFLAGS=-Os" also works.
>> 
>> Any ideas how to get "OPTFLAGS=-Os" working again with gcc 7.x?
> 
> Ok, found out that '-fstore-merging' is responsible for the crash,
> which is enabled with "-02" in gcc 7.x by default.
> 
> Adding "-fno-store-merging" to "OPTFLAGS" fixes the problem.
> 
> Here is also a "statement" to this problem:
> 
> https://patchwork.ozlabs.org/patch/792238/
> 

I've backported this commit/fix for uboot-lantiq now:

https://github.com/openwrt/openwrt/pull/1404

Maybe this should also be done for other uboot targets?

- Martin


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list