From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spl: implement stack usage check
Date: Wed, 17 Jul 2019 14:07:22 -0400 [thread overview]
Message-ID: <20190717180722.GF20116@bill-the-cat> (raw)
In-Reply-To: <20190716203036.24430-1-simon.k.r.goldschmidt@gmail.com>
On Tue, Jul 16, 2019 at 10:30:36PM +0200, Simon Goldschmidt wrote:
> This implements a stack usage check in SPL.
>
> Many boards start up SPL to run code + data from one common, rather small
> SRAM. To implement a sophisticated SPL binary size limit on such boards,
> the stack size (as well as malloc size and global data size) must be
> subtracted from this SRAM size.
>
> However, to do that properly, the stack size first needs to be known.
>
> This patch adds a new Kconfig option:
> - SPL_SYS_REPORT_STACK_F_USAGE: memset(0xaa) the whole area of the stack
> very early and check stack usage based on this constant later before the
> stack is switched to DRAM
>
> Initializing the stack and checking it is implemented in weak functions,
> in case a board does not use the stack as saved in gd->start_addr_sp.
>
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Very nice! I wish I had thought of something like that years ago when
Wolfgang asked and I came up with the -fstack-usage stuff we have today.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190717/5b2a7f1b/attachment.sig>
next prev parent reply other threads:[~2019-07-17 18:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 20:30 [U-Boot] [PATCH] spl: implement stack usage check Simon Goldschmidt
2019-07-17 18:07 ` Tom Rini [this message]
2019-07-17 18:18 ` Simon Goldschmidt
2019-08-13 16:52 ` Tom Rini
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=20190717180722.GF20116@bill-the-cat \
--to=trini@konsulko.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