Hi,

maybe providing a (pseudo-)module with an advanced `printf()` version would be a
solution? That way people actually needing full support can have it, without the
ROM / RAM cost being paid by everyone. However, I'm not sure if one can pick
the non-nano stdio from newlib while everything else remains "nano" flavor.
(E.g. the non-nano malloc implementation can cause issues when working with
non-contiguous memory regions, so just switching to the non-nano newlib via a
pseudo module might be more involved.)

One could of course provide a fully distinct `printf()` implementation (e.g.
based on the avrlibc) as module in source and use some linker magic to link
calls to `printf()` to the custom implementation. I think it would be possible
to provide `printf()` with both %llu / %lld support and lower RAM / ROM
consumption compared to newlib's implementation. I bet nobody would complain
about extra printf() features, if they end up coming with a lower RAM/ROM
consumption; so this might end up becoming the default option for newlib based
platforms.

While I like the idea of this, I sadly don't have the time to PR this; at
least not now. But maybe someone else wants to do so?

Kind regards,
Marian

On Tue, 28 Jul 2020 16:05:41 +0300
Lars Eggert <l...@eggert.org> wrote:

> Hi,
> 
> On 2020-7-28, at 15:48, Marian Buschsieweke <marian.buschsiew...@ovgu.de> 
> wrote:
> > you can use print_u64_dec() [1] instead, which is provided by the module fmt
> > (USEMODULE += fmt).  
> 
> thanks for the pointer! But the fmt module doesn't seem to have a 
> printf/vprintf-style interface with format strings? (The logging 
> functionality that I am trying to get to run is built around that.)
> 
> > The lack of 64 bit support is deliberate and consistent with other 
> > platforms,
> > as full stdio compatibility is quite expensive in terms of ROM and RAM
> > consumption.  
> 
> Understood. And I wouldn't really care if the ESP32 didn't crash when its 
> printf encounters a 64-bit format string...
> 
> Thanks,
> Lars

Attachment: pgpqhh5i2b89g.pgp
Description: OpenPGP digital signature

_______________________________________________
users mailing list
users@riot-os.org
https://lists.riot-os.org/mailman/listinfo/users

Reply via email to