From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Kiryanov Date: Thu, 07 Aug 2014 14:27:01 +0300 Subject: [U-Boot] [PATCH 12/18] arm: mx6: add support for Compulab cm-fx6 CoM In-Reply-To: <53DF97A8.9060600@compulab.co.il> References: <1407051288-17324-1-git-send-email-nikita@compulab.co.il> <1407051288-17324-13-git-send-email-nikita@compulab.co.il> <53DF97A8.9060600@compulab.co.il> Message-ID: <53E36285.5020403@compulab.co.il> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04/08/14 17:24, Nikita Kiryanov wrote: > > > On 04/08/14 09:02, Tim Harvey wrote: >> Nikita, >> >> Are the values in include/configs/imx6_spl.h too inflexible to use? If >> so, I can submit a patch in the future to remove that file and pull >> them all in my board config files as I'm the only user of it. > > This is actually something I forgot to make use of when I was rebasing > the code over mainline. I'll try to use it in a v2. > I came across an unexpected problem when using imx6_spl.h. Due to the way the makefile is written, it is impossible to redefine imx6_spl.h's definition of CONFIG_SYS_TEXT_BASE using standard #undef/#define pair. This happens because the makefile passes the CONFIG_SYS_TEXT_BASE define using the -D option to the compiler, and it clashes with the contents of common.h. For example: The relevant code from Makefile: ifneq ($(CONFIG_SYS_TEXT_BASE),) KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) endif The include hierarchy and contents of include/configs/someboard.h: include/common.h |---> include/config.h |---> include/configs/someboard.h #include "imx6_spl.h" #undef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE During build: Makefile obtains CONFIG_SYS_TEXT_BASE and passes it to the compiler using: -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) For every file that #includes common.h we get this: #define CONFIG_SYS_TEXT_BASE <-- from compiler #define CONFIG_SYS_TEXT_BASE 0x17800000 <-- from imx6_spl.h (redefinition!) #undef CONFIG_SYS_TEXT_BASE <-- from someboard.h #define CONFIG_SYS_TEXT_BASE Sample output during compilation: include/configs/imx6_spl.h:68:0: warning: "CONFIG_SYS_TEXT_BASE" redefined [enabled by default] #define CONFIG_SYS_TEXT_BASE 0x17800000 ^ :0:0: note: this is the location of the previous definition LD arch/arm/cpu/armv7/mx6/built-in.o CC arch/arm/lib/reset.o In file included from include/configs/cm_fx6.h:273:0, from include/config.h:10, from include/common.h:18, from arch/arm/lib/interrupts.c:22: This goes on and on for quite a lot of files, and I wonder if passing -DCONFIG_SYS_TEXT_BASE to the compiler is even necessary. It looks like the includes already take care of bringing this value where it is needed. I tried to remove KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) and run MAKEALL for arm boards, and most of them compiled without problems. Only these two boards failed: cam_enc_4xx, hawkboard. Tom, any insight as to the necessity of this practice?