Re: [U-Boot] How to use board specific #defines during building of linker script

2011-02-19 Thread Graeme Russ
On Sunday, February 20, 2011, Mike Frysinger  wrote:
> On Saturday, February 19, 2011 17:00:30 Graeme Russ wrote:
>> On Sunday, February 20, 2011, Mike Frysinger  wrote:
>> > On Thursday, February 17, 2011 16:52:14 Graeme Russ wrote:
>> >> But why not just include config.h when building u-boot.lds?
>> >
>> > why not include it yourself ?
>> > #include 
>>
>> Um, maybe a stupid question, but where (without touching common code)?
>
> in the linker script

Yeah, I thought of that 5 minutes after hitting send :)

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] How to use board specific #defines during building of linker script

2011-02-19 Thread Mike Frysinger
On Saturday, February 19, 2011 17:00:30 Graeme Russ wrote:
> On Sunday, February 20, 2011, Mike Frysinger  wrote:
> > On Thursday, February 17, 2011 16:52:14 Graeme Russ wrote:
> >> But why not just include config.h when building u-boot.lds?
> > 
> > why not include it yourself ?
> > #include 
> 
> Um, maybe a stupid question, but where (without touching common code)?

in the linker script
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] How to use board specific #defines during building of linker script

2011-02-19 Thread Graeme Russ
On Sunday, February 20, 2011, Mike Frysinger  wrote:
> On Thursday, February 17, 2011 16:52:14 Graeme Russ wrote:
>> But why not just include config.h when building u-boot.lds?
>
> why not include it yourself ?
> #include 

Um, maybe a stupid question, but where (without touching common code)?

>
> ive been doing this for years in the Blackfin arch (long before preprocessing
> the linker script was considered fashionable).

So it sounds like including config.h on les builds does not cause any issues.

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] How to use board specific #defines during building of linker script

2011-02-19 Thread Mike Frysinger
On Thursday, February 17, 2011 16:52:14 Graeme Russ wrote:
> But why not just include config.h when building u-boot.lds?

why not include it yourself ?
#include 

ive been doing this for years in the Blackfin arch (long before preprocessing 
the linker script was considered fashionable).
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] How to use board specific #defines during building of linker script

2011-02-17 Thread Graeme Russ
Hi All,

I'm looking at removing the following, last remaining, line from config.mk
of the eNET board:

LDPPFLAGS += -DFLASH_SIZE=0x4

This is needed to allow the calculation of the location of the reset vector
so it resided in the last 16 bytes of the boot flash.

Looking at how the compilation of u-boot.lds works, there are three locations
where defines are exposed to the compilation of u-boot.lds

  1) LDPPFLAGS or CPPFLAGS/PLATFORM_CPPFLAGS

  2) /include/u-boot/u-boot.lds.h

  3) config.mk detects a specific set of defined define and if present,
 adds them to CPPFLAGS - For example config.mk lines 169 through 175:

 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
 endif

 ifneq ($(RESET_VECTOR_ADDRESS),)
 CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS)
 endif


LDPPFLAGS forces the use of a board specific config.mk, so that is out of
the question.

Patching /include/u-boot/u-boot.lds.h seems a bit messy

Which leaves option #3 and adding the following to config.mk

ifneq ($(CONFIG_SYS_FLASH_SIZE),)
CPPFLAGS += -DCONFIG_SYS_FLASH_SIZE=$(CONFIG_SYS_FLASH_SIZE)
endif

and defining CONFIG_SYS_FLASH_SIZE in /include/configs/eNET.h

But why not just include config.h when building u-boot.lds?

For example, change Makefile lines 282 through 288 to:

# Special flags for CPP when processing the linker script.
# Pass the version down so we can handle backwards compatibility
# on the fly.
LDPPFLAGS += \
-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
-include $(TOPDIR)/include/config.h \
$(shell $(LD) --version | \
  sed -ne 's/GNU ld version
\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')

Thoughts?

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot