From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC/PATCH] tools: New 'spl-stackusage' script
Date: Mon, 02 Feb 2015 14:15:33 +0100 [thread overview]
Message-ID: <54CF7875.2090109@gmail.com> (raw)
In-Reply-To: <1422748072-32405-1-git-send-email-siarhei.siamashka@gmail.com>
Dear Siarhei Siamashka,
On 02/01/2015 12:47 AM, Siarhei Siamashka wrote:
> This is a script, which tries to provide a pessimistic estimate
> of the stack usage in the SPL binary.
>
> A more detailed description about how it works and some example
> pictures are available in an earlier e-mail:
> http://lists.denx.de/pipermail/u-boot/2015-January/201713.html
>
> In fact, I have done nothing with it since that old status update
> and the code is still very much just at the proof of concept
> stage and can be only treated as a somewhat working prototype.
> It only supports 32-bit ARM so far.
>
> An example of trying it:
>
> 1. First compile u-boot for some ARM board. For example:
>
> make CROSS_COMPILE=arm-none-linux-gnueabi- Cubieboard_defconfig
> make CROSS_COMPILE=arm-none-linux-gnueabi- -j8
unfortunately out-of-tree build is not directly supported with this
script. I mean some environment (CROSS_COMPILE) is re-used/required by
the script but others not (O). It would be fine to just replace the make
in cmdline with this tool to run it.
> 2. Run the script:
>
> tools/spl-stackusage/spl-stackusage
>
> 3. Look at the (slightly reformatted) output:
>
> Execution path with maximized stack usage (3152 bytes):
> entry > _main > board_init_f > board_init_r > spl_mmc_load_image >
> mmc_init > mmc_startup > mmc_switch.isra.1 > mmc_send_status >
> printf > puts > console_puts ? mmc_bread > mmc_set_blocklen >
> mmc_send_cmd ? sunxi_mmc_getcd > gpio_get_value >
> axp_gpio_get_value > axp209_read > i2c_read ? twsi_i2c_read >
> i2c_begin > twsi_wait > udelay > __udelay
>
> The '>' symbols indicate normal calls. The '?' symbols
> indicate a suspected indirect call. Now we can see that the
> 'console_puts ? mmc_bread' indirect call does not make any sense.
> So we can run the script again, now indicating that a call
> from 'console_puts' to 'mmc_bread' is impossible:
>
> 4. Run the script again as:
>
> tools/spl-stackusage/spl-stackusage \
> remove_arrow[console_puts,mmc_bread]
Unfortunately dynamic stack allocation is not considered. So adding FAT
to SPL will result in an empty list here. I only get 'dynamic stack size
in get_cluster'. I think the most important thing is to always print out
the summary and the caller stack, mark the dynamic parts of the stack
and mention that there is some more required.
Some interface to declare the maximum amount of dynamic stack usage for
a specific symbol by command line would be really great. So one can
guess the relevant parts and calculate the maximum size.
Another point ... I really appreciate your efforts to bring this tool
in. So don't get me wrong, but ... why ruby?
A while ago some guys started to introduce python for some complex
scripts, before that u-boot only had shell scripts.
I personally think one interpreter in u-boot world is enough. I'm
curious how others think about that.
Best regards
Andreas Bie?mann
next prev parent reply other threads:[~2015-02-02 13:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-31 23:47 [U-Boot] [RFC/PATCH] tools: New 'spl-stackusage' script Siarhei Siamashka
2015-02-02 13:15 ` Andreas Bießmann [this message]
2015-02-11 4:15 ` Siarhei Siamashka
2015-02-11 9:12 ` Andreas Bießmann
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=54CF7875.2090109@gmail.com \
--to=andreas.devel@googlemail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox