File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 2828#include " Print.h"
2929
3030// Public Methods //////////////////////////////////////////////////////////////
31+ size_t Print::printf (const char *format, ...)
32+ {
33+ char loc_buf[64 ];
34+ char * temp = loc_buf;
35+ va_list arg;
36+ va_list copy;
37+ va_start (arg, format);
38+ va_copy (copy, arg);
39+ size_t len = vsnprintf (NULL , 0 , format, arg);
40+ va_end (copy);
41+ if (len >= sizeof (loc_buf)){
42+ temp = new char [len+1 ];
43+ if (temp == NULL ) {
44+ return 0 ;
45+ }
46+ }
47+ len = vsnprintf (temp, len+1 , format, arg);
48+ write ((uint8_t *)temp, len);
49+ va_end (arg);
50+ if (len >= sizeof (loc_buf)){
51+ delete[] temp;
52+ }
53+ return len;
54+ }
3155
3256/* default implementation: may be overridden */
3357size_t Print::write (const uint8_t *buffer, size_t size)
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ class Print
6161 return write ((const uint8_t *)buffer, size);
6262 }
6363
64+ size_t printf (const char * format, ...) __attribute__ ((format (printf, 2 , 3 )));
6465 size_t print (const __FlashStringHelper *);
6566 size_t print (const String &);
6667 size_t print (const char []);
Original file line number Diff line number Diff line change @@ -15,11 +15,10 @@ compiler.objcopy.cmd=riscv64-unknown-elf-objcopy
1515compiler.elf2hex.cmd=riscv64-unknown-elf-objcopy
1616compiler.size.cmd=riscv64-unknown-elf-size
1717
18- compiler.clib.path={runtime.tools.riscv64-unknown-elf-gcc.path}/include
1918compiler.sdk.path={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lib
2019compiler.lib_hal_inc.path={runtime.platform.path}/cores/arduino/hal/include
2120compiler.cores.path={runtime.platform.path}/cores/arduino/
22- compiler.preproc.flags=-I{build.system.path}/include -I{compiler.cores.path} -I{compiler.lib_hal_inc.path} -I{compiler.sdk.path}/bsp/include -I{compiler.sdk.path}/drivers/include -I{compiler.sdk.path}/utils/include -I{compiler.sdk.path}/freertos/conf -I{compiler.sdk.path}/freertos/include -I{compiler.sdk.path}/freertos/portable -I{compiler.clib.path}
21+ compiler.preproc.flags=-I{build.system.path}/include -I{compiler.cores.path} -I{compiler.cores.path}/avr -I{compiler. lib_hal_inc.path} -I{compiler.sdk.path}/bsp/include -I{compiler.sdk.path}/drivers/include -I{compiler.sdk.path}/utils/include -I{compiler.sdk.path}/freertos/conf -I{compiler.sdk.path}/freertos/include -I{compiler.sdk.path}/freertos/portable
2322
2423compiler.both.flags=-mcmodel=medany -mabi=lp64f -march=rv64imafc -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-zero-initialized-in-bss -Os -ggdb -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Werror=frame-larger-than=65536 -Wno-unused-parameter -Wno-sign-compare -Wno-error=missing-braces -Wno-error=return-type -Wno-error=pointer-sign -Wno-missing-braces -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-int-to-pointer-cast -Wno-error=comment -Wno-error=logical-not-parentheses -Wno-error=duplicate-decl-specifier -Wno-error=parentheses -Wno-error=narrowing -Wno-error=unused-value
2524
You can’t perform that action at this time.
0 commit comments