[U-Boot] [PATCH v2] tiny-printf: Add support for %p format

Tom Rini trini at konsulko.com
Tue Apr 11 14:00:18 UTC 2017


On Tue, Apr 11, 2017 at 07:56:06AM -0600, Simon Glass wrote:
> On 10 April 2017 at 00:53, Vignesh R <vigneshr at ti.com> wrote:
> > Add support for %p, %pa[p], %pM, %pm and %pI4 formats to tiny-printf.
> > %pM and %pI4 are widely used by SPL networking stack and is required if
> > networking support is desired in SPL.
> > %p, %pa and %pap are mostly used by debug prints and hence supported
> > only when DEBUG is enabled.
[snip]
> > +static void pointer(struct printf_info *info, const char *fmt, void *ptr)
> > +{
> > +#ifdef DEBUG
> 
> What is the #ifdef DEBUG for? It may not be enabled globally so I
> don't think you can do this. You probably need this code always.

So, %p/%pa/%pa[p] are used in debug() prints, which only matter when
DEBUG is set.  Doing it this way means we globally bloat by (I think I
snipped out..) 25 bytes? instead of ~250 bytes.  And since we're in
tiny-printf, which we use when every byte counts, I'm happier about only
bloating by 25 bytes here.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170411/4ecccc62/attachment.sig>


More information about the U-Boot mailing list