This is an idea that I don't want distracting me until I'm done with my
current work on printf, so I'm spilling it to the mailing list.

A big limitation on printf right now is the size of the stack buffer to
hold a formatted number.  Adding 64-bit support means doubling that size.

And if ROM space is to be hoarded like silver on a microcontroller,
RAM space is gold.

Would it be worth enlarging the code to store converted numbers in BCD?
When printing hex, phase 1 would consist of counting significant
digits, and phase 2 would do everything.


Typical ATmega flash/SRAM size are

4K      0.25K/0.5K (48A/48PB)
8K      0.5K/1K (88A/88PB)
16K     1K (16A,164A,168A)
32K     2K (32,32[459],AT90CAN32)
64K     4K (64,64[045679],AT90CAN64)
128K    4K/8K/16K (128A,AT90CAN128/128[01]/1284)
256K    8K (256[01])

It seems like SRAM 1/16 the size of program ROM is the most common
configuration.  So 11 bytes of stack could be considered "worth"
88 instructions.

_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to