[En-Nut-Discussion] Two problems with the new printf / putf

bon at elektron.ikp.physik.tu-darmstadt.de bon at elektron.ikp.physik.tu-darmstadt.de
Fri Sep 27 12:11:43 CEST 2013


>>>>> "Ole" == Ole Reinhardt <ole.reinhardt at embedded-it.de> writes:

    Ole> Hi all, it looks like the latest changes to putf raise some some
    Ole> strange bugs.

    Ole> I tried to debug this, but did not yet succeed, but I assume there
    Ole> are still problem with the va_arg handling.

    Ole> The bug is triggered with this code:

    Ole> printf("Test int: %d, hex: %08x, char: %c, str: %s %d\n", 100,
    Ole> 0xabcd, 'A', "Hello world", 123456);

At some point I changed va_args_ulval to pass ap as value, as all functions
calling putf.c do, but that caused havok. Calling again by reference works
as expected. Fixed in r5360 and tested on AVR8 and STM32. The formerly
failing argument is no part of the printf demo.

Also 64-bit stdio handling is now a configuration item "STDIO_64_BIT"
normally turned off. When 64-bit arguments are used in this case, "NA" is
now printed, as is with double arguments when "STDIO_FLOATING_POINT" is not
set.

For AVR I also moved many constants to flash, bringing down RAM usage. Flash
usage is still higher than with the old version, where a 64-bit printf
argument would cause silent missbehaviour as argument not printed and
following arguments corrupted and double arguments silently munged.

I hope this compromise between correctness and code size is acceptable.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list