Merge pull request #12 from mysterywolf/master

rt-thread接管printf
This commit is contained in:
Lyon 2021-12-09 00:09:33 +08:00 committed by GitHub
commit af40a2e885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -11,11 +11,11 @@
#include <rtthread.h>
#include "pikaPlatform.h"
/* sprintf support */
int __platform_sprintf(char* buff, char* fmt, ...) {
va_list args;
int res;
va_start(args, fmt);
int res = rt_vsprintf(buff, fmt, args);
res = rt_vsprintf(buff, fmt, args);
va_end(args);
return res;
}

View File

@ -11,5 +11,6 @@
#define PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_
#include <rtthread.h>
#define __platform_printf(...) rt_kprintf(__VA_ARGS__)
#endif /* PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ */

View File

@ -56,12 +56,15 @@ PIKA_WEAK void __quick_malloc_disable(void) {}
PIKA_WEAK uint8_t __is_locked_pikaMemory(void) {
return 0;
}
#ifndef __platform_printf
PIKA_WEAK void __platform_printf(char* fmt, ...) {
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
}
#endif
PIKA_WEAK int __platform_sprintf(char* buff, char* fmt, ...) {
va_list args;