Skip to content

Commit

Permalink
Add %z and %x to printf backend (#5424)
Browse files Browse the repository at this point in the history
* Add %z and %x to printf backend

%z is a C99 format used for size_t and was not included in any printf.
On the 8266 it's a no-op as size_t==int, so ignore it and things just
work.

%x lowercase support added back in (wasn't present in nano-printf).

* Update to toolchain built newlib, fix link error

Previous commit was a hand build and copy, this one used the full
toolchain and should not include atexit().
  • Loading branch information
earlephilhower authored and devyte committed Dec 3, 2018
1 parent 2f907f4 commit f770d1a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 0 deletions.
Binary file modified tools/sdk/libc/xtensa-lx106-elf/lib/libc.a
Binary file not shown.
Binary file modified tools/sdk/libc/xtensa-lx106-elf/lib/libg.a
Binary file not shown.
Binary file modified tools/sdk/libc/xtensa-lx106-elf/lib/libm.a
Binary file not shown.

6 comments on commit f770d1a

@ascillato
Copy link
Contributor

@ascillato ascillato commented on f770d1a Dec 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

With last commits now I can't compile. I have this error in platformio:

'vsnprintf' was not declared in this scope

Output:

C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp: In fun
ction 'int printf_P(const char*, ...)':
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp:248:34:
 error: 'vprintf' was not declared in this scope
ret = vprintf(format, arglist);
^
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp: In fun
ction 'int sprintf_P(char*, const char*, ...)':
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp:261:61:
 error: 'vsnprintf_P' was not declared in this scope
ret = vsnprintf_P(str, SIZE_IRRELEVANT, formatP, arglist);
^
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp: In fun
ction 'int snprintf_P(char*, size_t, const char*, ...)':
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp:272:53:
 error: 'vsnprintf_P' was not declared in this scope
ret = vsnprintf_P(str, strSize, formatP, arglist);
^
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp: In fun
ction 'int vsnprintf_P(char*, size_t, const char*, va_list)':
C:\Users\Usuario\.platformio\packages\framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910\cores\esp8266\pgmspace.cpp:285:45:
 error: 'vsnprintf' was not declared in this scope
ret = vsnprintf(str, strSize, format, ap);
^
Compiling .pioenvs\sonoff-ES_4MB\FrameworkArduino\sntp-lwip2.c.o
*** [.pioenvs\sonoff-ES_4MB\FrameworkArduino\pgmspace.cpp.o] Error 1

@earlephilhower
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI did a platform.io build against the libs for all the examples, so I think it's just a matter of your libs and the git head not quite lining up. I unfortunately don't know how to make PIO pull in latest and greatest straight from GIT and not from a PIO repo redirector which will probably be updated once per day.

@ascillato
Copy link
Contributor

@ascillato ascillato commented on f770d1a Dec 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied all the repo as I did before having the latest files.

What I'm seeing is that the vsnprintf_P is not declared in pgmspace.h file

In commit 6280e98 the declarations in pgmspace.h file were deleted

@earlephilhower
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Looks like you've ended up with dead files in your PIO repo. There is no pgmspace.cpp anymore., and it looks like your compile is failing on this (now non-existent) file.

@ascillato
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!!!! Thanks a lot. You solve my issue!!! 👍

@ascillato
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working very nice! Thanks 👍

Please sign in to comment.