All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] __FILE__ usage and and SPL limits for SRAM
Date: Tue, 28 Mar 2017 15:29:04 +0900	[thread overview]
Message-ID: <CAK7LNAS9wmOe9FBm-zSBLi+nUbES8L6FmJbk9dn3391k_QRJnQ@mail.gmail.com> (raw)
In-Reply-To: <7522fff3-a33e-21bd-00fe-55c03b4169c1@ti.com>

Hi Nishanth,


2017-03-28 6:44 GMT+09:00 Nishanth Menon <nm@ti.com>:
> Hi,
>
> we've kind of run into an interesting situation recently, but might be of
> interest for various folks trying to reduce the image sizes.
>
> our AM335x device has a limited amount of sram.. and the SPL tries to fit
> into it (a bit tricky given the restricted space we have on it on certain
> class of devices).
>
> arch/arm/mach-omap2/am33xx/u-boot-spl.lds is a bit custom tailored around
> this.
>
> Key in this is:
> . = ALIGN(4);
> .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
>
> . = ALIGN(4);
> .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>
>
> Now, our jenkins build system happens to use a varied build path and uses O=
> path. to simplify the details:
> mkdir
> /tmp/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/cccccccccccccccccccccccccccccccccccccccccccccccccc
> mkdir
> /tmp/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/cccccccccccccccccccccccccccccccccccccccccccccccccc/b
>
> git clone u-boot
> cd u-boot
>
> git clean -fdx
> make CROSS_COMPILE=arm-linux-gnueabihf- O=../b am335x_evm_defconfig
> make CROSS_COMPILE=arm-linux-gnueabihf- O=../b all
>
> depending on depth of the path, this would fail.. a little bit of
> headscratching later..
> when using O= build system uses absolute paths, which translates to __FILE__
> being absolute paths as well..
>
> in u-boot, any printf("%s", __FILE__) makes u-boot allocate this file path
> in rodata.
>
> So, depending on how deep the path is rodata size varies and ends up pushing
> .data out of sram max range.
>
> we dont really care to put a print of complete absolute path anyways, and I
> am not really sure of a clean way to resolve this:
> a) override __FILE__ with something.. -Wbuiltin-macro-redefined kicks in
> b) replace usage of __FILE__ with something like __FILENAME__ as recommended
> by [1]
>
>
> What is the suggestion we do?
>
> [1] http://stackoverflow.com/questions/8487986/file-macro-shows-full-path


When O= is given, the build system runs in the object tree,
not in the source tree.
(This is the same as Linux.)

If you see the top Makefile:

ifeq ($(KBUILD_SRC),)
        # building in the source tree
        srctree := .
else
        ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
                # building in a subdirectory of the source tree
                srctree := ..
        else
                srctree := $(KBUILD_SRC)
        endif
endif




If O=  points to a sub-directory of the source tree,
the relative path "srctree := .." is used.

Otherwise, the absolute path srctree := $(KBUILD_SRC) is used.
In your case, "O=../b" means the source tree and the obj tree
are siblings.  So, absolute path.



If you want to see a short relative path for __FILE__,
I'd recommend to use a sub-directory for O=.

For example, your source tree is located at
~/aaaaaaaaa/bbbbbbb/cccccccc/u-boot,
create a directory  ~/aaaaaaaaa/bbbbbbb/cccccccc/u-boot/foo,
then give  O=foo


Masahiro

  parent reply	other threads:[~2017-03-28  6:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 21:44 [U-Boot] __FILE__ usage and and SPL limits for SRAM Nishanth Menon
2017-03-28  6:07 ` Lokesh Vutla
2017-04-04 19:06   ` Tom Rini
2017-04-05 11:27     ` Wolfgang Denk
2017-04-09 19:27     ` Simon Glass
2017-04-22  5:30       ` Masahiro Yamada
2017-05-22 17:23         ` Denys Dmytriyenko
2017-05-23  0:57           ` Masahiro Yamada
2017-05-23  1:27             ` Tom Rini
2017-05-31  4:51               ` Masahiro Yamada
2017-05-31 11:32                 ` Tom Rini
2017-03-28  6:29 ` Masahiro Yamada [this message]
2017-03-28 11:20   ` Nishanth Menon
2017-03-28 11:47     ` Felipe Balbi
2017-03-28 11:59       ` Nishanth Menon
2017-03-29 10:57       ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNAS9wmOe9FBm-zSBLi+nUbES8L6FmJbk9dn3391k_QRJnQ@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.