This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Apr 15 12:33, Jozef Lawrynowicz wrote:
> >From d4c48179ea3362b0dea483afba748728fdfa9310 Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Fri, 12 Apr 2019 11:57:59 +0100
> Subject: [PATCH 1/2] [MSP430][1/2] Copy prerequisite file for "tiny" printf
> implementation
>
> Use newlib/libc/stdio/nano-vfprintf.c as baseline for tiny-printf.c
> [...]
> Subject: [PATCH 2/2] [MSP430][2/2] Implement reduced code size "tiny" printf
> and puts
>
> "tiny" printf is derived from _vfprintf_r in libc/stdio/nano-vfprintf.c.
> "tiny" puts has been implemented so that it just calls write, without
> any other processing.
> Support for buffering, reentrancy and streams has been removed from
> these functions to achieve reduced code size.
>
> This reduced code size implementation of printf and puts can be enabled
> in an application by passing "--wrap printf" and "--wrap puts" to the
> GNU linker. This will replace references to "printf" and "puts" in user
> code with "__wrap_printf" and "__wrap_puts" respectively.
> If there is no implementation of these __wrap* functions in user code,
> these "tiny" printf and puts implementations will be linked into the
> final executable.
>
> The wrapping mechanism is supposed to be invisible to the user:
> - A GCC wrapper option such as "-mtiny-printf" will be added to alias
> these wrap commands.
> - If the user is unaware of the "tiny" implementation, and chooses to
> implement their own __wrap_printf and __wrap_puts, their own
> implementation will be automatically chosen over the "tiny" printf and
> puts from the library.
>
> Newlib must be configured with --enable-newlib-nano-formatted-io for
> the "tiny" printf and puts functions to be built into the library.
>
> Code size reduction examples:
> printf("Hello World\n")
> baseline - msp430-elf-gcc gcc-8_3_0-release
> text data bss
> 5638 214 26
> "tiny" puts enabled
> text data bss
> 714 90 20
>
> printf("Hello %d\n", a)
> baseline - msp430-elf-gcc gcc-8_3_0-release
> text data bss
> 10916 614 28
>
> "tiny" printf enabled
> text data bss
> 4632 280 20
Pushed.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Attachment:
signature.asc
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |