embeddedartistry / arduino-printf

Add printf support to the Arduino SDK
MIT License
91 stars 15 forks source link

Switch printf library implementations #25

Closed phillipjohnston closed 2 years ago

phillipjohnston commented 2 years ago

Cannot merge yet - printf("string with no args") is not functional

eyalroz commented 2 years ago

Your last commit may perhaps be obviated by -fno-builtin-printf . See discussion at eyalroz/printf#76 .

phillipjohnston commented 2 years ago

The problem here is that it's an arduino library, so I don't have a good way about enforcing build flags. For that approach (which I favor), I need EVERYONE to adjust their local rules for the AVR cores or whatever other architectures to apply that flag.

eyalroz commented 2 years ago

In that case - won't you also need to define a putchar(), avoiding replacements of printf("%c", ch) with putchar(ch) ?

phillipjohnston commented 2 years ago

Yes, certainly right.

phillipjohnston commented 2 years ago

Probably means I should just handle it via #27 (changing the macro approach)

phillipjohnston commented 2 years ago

Yeah, redefining puts works fine, but putchar just opens a new can of worms of unwanted compiler optimizations.