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 <NEW_VALUE>

During build:
Makefile obtains CONFIG_SYS_TEXT_BASE <NEW_VALUE> 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 <NEW_VALUE> <-- 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 <NEW_VALUE>

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
 ^
<command-line>: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?
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to