9
9
// this is needed separately from lwipopts.h
10
10
// because it is shared by both sides of glue
11
11
12
- #define UNDEBUG 1 // 0 or 1 (1: uassert removed)
12
+ #define UNDEBUG 1 // 0 or 1 (1: uassert removed = saves flash )
13
13
#define UDEBUG 0 // 0 or 1 (glue debug)
14
- #define UDUMP 0 // 0 or 1 (glue / dump packet)
15
- #define UDEBUGINDEX 0 // 0 or 1 (show debug line number)
16
- #define UDEBUGSTORE 0 // 0 or 1 (store debug into buffer until doprint_allow=1=serial-available)
14
+ #define UDUMP 0 // 0 or 1 (glue: dump packet)
17
15
18
16
#define ULWIPDEBUG 0 // 0 or 1 (trigger lwip debug)
19
17
#define ULWIPASSERT 0 // 0 or 1 (trigger lwip self-check, 0 saves flash)
24
22
#define STRING_IN_FLASH 0 // *print("fmt is stored in flash")
25
23
#endif
26
24
27
- #define ROTBUFLEN_BIT 11 // (UDEBUGSTORE=1) doprint()'s buffer: 11=2048B
28
-
29
25
#if ULWIPDEBUG
30
26
//#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
31
27
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH)
@@ -45,17 +41,11 @@ extern void (*phy_capture) (int netif_idx, const char* data, size_t len, int out
45
41
}
46
42
#endif
47
43
48
-
49
44
/////////////////////////////////////////////////////////////////////////////
50
45
#if ARDUINO
51
46
#include <sys/pgmspace.h>
52
47
#endif
53
48
54
- #if UDEBUG && UDEBUGSTORE
55
- #warning use 'doprint_allow=1' right after Serial is enabled
56
- extern int doprint_allow ;
57
- #endif
58
-
59
49
// print definitions:
60
50
// uprint(): always used by glue, defined as doprint() in debug mode or nothing()
61
51
// os_printf(): can be redefined as doprint()
@@ -65,41 +55,21 @@ extern int doprint_allow;
65
55
#if STRING_IN_FLASH && !defined(USE_OPTIMIZE_PRINTF )
66
56
#define USE_OPTIMIZE_PRINTF // at least used in arduino/esp8266
67
57
#endif
68
- // os_printf_plus() missing in osapi.h (fixed in arduino's sdk-2.1):
69
- //extern int os_printf_plus (const char * format, ...) __attribute__ ((format (printf, 1, 2)));
70
58
71
59
#include <osapi.h> // os_printf* definitions + ICACHE_RODATA_ATTR
72
60
73
- #if UDEBUG && (UDEBUGINDEX || UDEBUGSTORE )
74
- // doprint() is used
75
-
76
- #undef os_printf
77
- #define os_printf (x ...) do { doprint(x); } while (0)
78
-
79
- #if STRING_IN_FLASH
80
-
81
- #define doprint (fmt , ...) \
82
- do { \
83
- static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
84
- doprint_minus(flash_str, ##__VA_ARGS__); \
85
- } while(0)
86
-
87
- #else // !STRING_IN_FLASH
88
-
89
- #define doprint (fmt , ...) doprint_minus(fmt, ##__VA_ARGS__)
90
-
91
- #endif // !STRING_IN_FLASH
92
-
93
- int doprint_minus (const char * format , ...) __attribute__ ((format (printf , 1 , 2 ))); // format in flash
94
-
95
- #else // !( UDEBUG && (UDEBUGINDEX || UDEBUGSTORE) )
96
-
97
- #define doprint (x ...) do { os_printf(x); } while (0)
98
-
99
- #endif // !( UDEBUG && (UDEBUGINDEX || UDEBUGSTORE) )
61
+ #if defined(ARDUINO )
62
+ // os_printf() does not understand ("%hhx",0x12345678) => "78") and prints 'h' instead
63
+ // now hacking/using ::printf() from updated and patched esp-quick-toolchain-by-Earle
64
+ #include <stdio.h>
65
+ #undef os_printf
66
+ #undef os_printf_plus
67
+ #define os_printf printf
68
+ #define os_printf_plus printf
69
+ #endif
100
70
101
71
#if UDEBUG
102
- #define uprint (x ...) do { doprint (x); } while (0)
72
+ #define uprint (x ...) do { os_printf (x); } while (0)
103
73
#else
104
74
#define uprint (x ...) do { (void)0; } while (0)
105
75
#endif
@@ -127,7 +97,7 @@ do { if ((assertion) == 0) { \
127
97
128
98
#define ualwaysassert (assertion ...) udoassert(assertion)
129
99
130
- #define uerror (x ...) do { doprint (x); } while (0)
100
+ #define uerror (x ...) do { os_printf (x); } while (0)
131
101
#define uhalt () do { *((int*)0) = 0; /* this triggers gdb */ } while (0 )
132
102
#define nl () do { uprint("\n"); } while (0)
133
103
0 commit comments