We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 74958e0 + d05b7f5 commit d20ce63Copy full SHA for d20ce63
libraries/mbed/common/RawSerial.cpp
@@ -47,6 +47,13 @@ int RawSerial::puts(const char *str) {
47
int RawSerial::printf(const char *format, ...) {
48
std::va_list arg;
49
va_start(arg, format);
50
+#if defined(__MICROLIB) && defined(__ARMCC_VERSION) // with microlib and ARM compiler
51
+ char *temp;
52
+ temp = (char*)alloca(STRING_STACK_LIMIT);
53
+ vsprintf(temp, format, arg);
54
+ puts(temp);
55
+ int len = strlen(temp);
56
+#else
57
int len = vsnprintf(NULL, 0, format, arg);
58
if (len < STRING_STACK_LIMIT) {
59
char temp[STRING_STACK_LIMIT];
@@ -58,6 +65,7 @@ int RawSerial::printf(const char *format, ...) {
65
puts(temp);
66
delete[] temp;
60
67
}
68
+#endif
61
69
va_end(arg);
62
70
return len;
63
71
0 commit comments