From f197196c6c0e2181492e486c809450f6b41f7a4e Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 8 Dec 2021 11:19:51 -0500 Subject: [PATCH] replace printf for rt-thread --- package/pikaRTThread/pika_config.h | 2 -- src/PikaPlatform.h | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package/pikaRTThread/pika_config.h b/package/pikaRTThread/pika_config.h index 75b30f18f..e74e18d34 100644 --- a/package/pikaRTThread/pika_config.h +++ b/package/pikaRTThread/pika_config.h @@ -11,6 +11,4 @@ #define PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ #include -#define __platform_printf(...) rt_kprintf(__VA_ARGS__) - #endif /* PACKAGES_PIKASCRIPT_LATEST_PIKASCRIPT_LIB_RTBOOTER_PIKA_CONFIG_H_ */ diff --git a/src/PikaPlatform.h b/src/PikaPlatform.h index 44b1c096d..6151e94f6 100644 --- a/src/PikaPlatform.h +++ b/src/PikaPlatform.h @@ -40,6 +40,10 @@ #define PIKA_WEAK __attribute__((weak)) #endif +#ifdef __RTTHREAD__ +#define __platform_printf(...) rt_kprintf(__VA_ARGS__) +#endif + /* The following functions are can be overrided to config pikaScript. */ @@ -53,8 +57,10 @@ uint8_t __platform_Asm_is_to_flash(char* pyMultiLine); int32_t __platform_save_pikaAsm_EOF(void); char* __platform_load_pikaAsm(void); -/* printf */ +/* printf family */ +#ifndef __platform_printf void __platform_printf(char* fmt, ...); +#endif int __platform_sprintf(char* buff, char* fmt, ...); int __platform_vsprintf(char* buff, char* fmt, va_list args); int __platform_vsnprintf(char* buff,