Merge branch 'feature/os_printf_equal_to_printf' into 'master'

feat(esp8266): Make os_printf equal to printf

See merge request sdk/ESP8266_RTOS_SDK!179
This commit is contained in:
Wu Jian Gang
2018-05-24 10:58:39 +08:00
6 changed files with 22 additions and 40 deletions

View File

@ -73,11 +73,7 @@ unsigned long os_random(void);
int os_get_random(unsigned char *buf, size_t len); int os_get_random(unsigned char *buf, size_t len);
#ifndef os_printf #ifndef os_printf
/* NOTE: don't use printf_opt in irq handler, for test */ #define os_printf printf
#define os_printf(fmt, ...) do { \
static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
printf(flash_str, ##__VA_ARGS__); \
} while(0)
#endif #endif
/* Note: check_memleak_debug_enable is a weak function inside SDK. /* Note: check_memleak_debug_enable is a weak function inside SDK.

View File

@ -36,23 +36,23 @@ int lwip_trace_tcp(int s, int cmd, void *arg);
#ifdef SOCKETS_MT_DBUG #ifdef SOCKETS_MT_DBUG
#define accept(a,b,c) lwip_accept_mt(a,b,c); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define accept(a,b,c) lwip_accept_mt(a,b,c); printf("%s %d\n", __FUNCTION__, __LINE__);
#define bind(a,b,c) lwip_bind_mt(a,b,c); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define bind(a,b,c) lwip_bind_mt(a,b,c); printf("%s %d\n", __FUNCTION__, __LINE__);
#define shutdown(a,b) lwip_shutdown_mt(a,b); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define shutdown(a,b) lwip_shutdown_mt(a,b); printf("%s %d\n", __FUNCTION__, __LINE__);
#define closesocket(s) lwip_close_mt(s); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define closesocket(s) lwip_close_mt(s); printf("%s %d\n", __FUNCTION__, __LINE__);
#define connect(a,b,c) lwip_connect_mt(a,b,c); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define connect(a,b,c) lwip_connect_mt(a,b,c); printf("%s %d\n", __FUNCTION__, __LINE__);
#define getsockname(a,b,c) lwip_getsockname_mt(a,b,c); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define getsockname(a,b,c) lwip_getsockname_mt(a,b,c); printf("%s %d\n", __FUNCTION__, __LINE__);
#define getpeername(a,b,c) lwip_getpeername_mt(a,b,c); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define getpeername(a,b,c) lwip_getpeername_mt(a,b,c); printf("%s %d\n", __FUNCTION__, __LINE__);
#define setsockopt(a,b,c,d,e) lwip_setsockopt_mt(a,b,c,d,e); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define setsockopt(a,b,c,d,e) lwip_setsockopt_mt(a,b,c,d,e); printf("%s %d\n", __FUNCTION__, __LINE__);
#define getsockopt(a,b,c,d,e) lwip_getsockopt_mt(a,b,c,d,e); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define getsockopt(a,b,c,d,e) lwip_getsockopt_mt(a,b,c,d,e); printf("%s %d\n", __FUNCTION__, __LINE__);
#define listen(a,b) lwip_listen_mt(a,b); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define listen(a,b) lwip_listen_mt(a,b); printf("%s %d\n", __FUNCTION__, __LINE__);
#define recv(a,b,c,d) lwip_recv_mt(a,b,c,d); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define recv(a,b,c,d) lwip_recv_mt(a,b,c,d); printf("%s %d\n", __FUNCTION__, __LINE__);
#define recvfrom(a,b,c,d,e,f) lwip_recvfrom_mt(a,b,c,d,e,f); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define recvfrom(a,b,c,d,e,f) lwip_recvfrom_mt(a,b,c,d,e,f); printf("%s %d\n", __FUNCTION__, __LINE__);
#define send(a,b,c,d) lwip_send_mt(a,b,c,d); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define send(a,b,c,d) lwip_send_mt(a,b,c,d); printf("%s %d\n", __FUNCTION__, __LINE__);
#define sendto(a,b,c,d,e,f) lwip_sendto_mt(a,b,c,d,e,f); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define sendto(a,b,c,d,e,f) lwip_sendto_mt(a,b,c,d,e,f); printf("%s %d\n", __FUNCTION__, __LINE__);
#define socket(a,b,c) lwip_socket_mt(a,b,c); os_printf("%s %d\n", __FUNCTION__, __LINE__); #define socket(a,b,c) lwip_socket_mt(a,b,c); printf("%s %d\n", __FUNCTION__, __LINE__);
#define select(a,b,c,d,e) lwip_select_mt(a,b,c,d,e) #define select(a,b,c,d,e) lwip_select_mt(a,b,c,d,e)
#define ioctlsocket(a,b,c) lwip_ioctl_mt(a,b,c) ; os_printf("%s %d\n", __FUNCTION__, __LINE__); #define ioctlsocket(a,b,c) lwip_ioctl_mt(a,b,c) ; printf("%s %d\n", __FUNCTION__, __LINE__);
#if LWIP_POSIX_SOCKETS_IO_NAMES #if LWIP_POSIX_SOCKETS_IO_NAMES
#define read(a,b,c) lwip_read_mt(a,b,c) #define read(a,b,c) lwip_read_mt(a,b,c)

View File

@ -64,16 +64,9 @@ typedef int sys_prot_t;
#include <stdio.h> #include <stdio.h>
#ifndef os_printf
#define os_printf(fmt, ...) do { \
static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
printf(flash_str, ##__VA_ARGS__); \
} while(0)
#endif
#ifdef LWIP_DEBUG #ifdef LWIP_DEBUG
#define LWIP_PLATFORM_DIAG(x) do {os_printf x;} while(0) #define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) do {os_printf(x); sys_arch_assert(__FILE__, __LINE__);} while(0) #define LWIP_PLATFORM_ASSERT(x) do {printf(x); sys_arch_assert(__FILE__, __LINE__);} while(0)
#else #else
#define LWIP_PLATFORM_DIAG(x) #define LWIP_PLATFORM_DIAG(x)
#define LWIP_PLATFORM_ASSERT(x) #define LWIP_PLATFORM_ASSERT(x)

View File

@ -44,7 +44,7 @@ extern "C" {
#include "esp_common.h" #include "esp_common.h"
#if 0 #if 0
#define ssl_printf(fmt, args...) os_printf(fmt,## args) #define ssl_printf(fmt, args...) printf(fmt,## args)
#else #else
#define ssl_printf(fmt, args...) #define ssl_printf(fmt, args...)
#endif #endif

View File

@ -63,14 +63,7 @@ extern void vPortFree(void *pv);
#define ssl_speed_up_enter() system_update_cpu_freq(SYS_CPU_160MHZ) #define ssl_speed_up_enter() system_update_cpu_freq(SYS_CPU_160MHZ)
#define ssl_speed_up_exit() system_update_cpu_freq(SYS_CPU_80MHZ) #define ssl_speed_up_exit() system_update_cpu_freq(SYS_CPU_80MHZ)
#ifndef os_printf #define SSL_DEBUG_LOG printf
#define os_printf(fmt, ...) do { \
static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
printf(flash_str, ##__VA_ARGS__); \
} while(0)
#endif
#define SSL_DEBUG_LOG os_printf
#define LOCAL_ATRR ICACHE_RODATA_ATTR STORE_ATTR #define LOCAL_ATRR ICACHE_RODATA_ATTR STORE_ATTR

View File

@ -122,7 +122,7 @@ typedef struct test_res_s {
goto __fail_assert; \ goto __fail_assert; \
} }
#define DBGT(...) os_printf(__VA_ARGS__) #define DBGT(...) printf(__VA_ARGS__)
#define str(s) #s #define str(s) #s