ports/sh: improve USB debugging behavior
- Set MP_DEBUG_PRINTER to go through DEBUG_printf instead of the console, which is important when the former is USB. - Disable malloc/gc_alloc messages to avoid spamming USB debug log.
This commit is contained in:
parent
70e15e9ed1
commit
5b52671c50
|
@ -74,6 +74,14 @@ int pe_debug_printf(char const *fmt, ...)
|
|||
int DEBUG_printf(char const *fmt, ...)
|
||||
__attribute__((alias("pe_debug_printf")));
|
||||
|
||||
static void print_strn(void *env, const char *str, size_t len) {
|
||||
(void)env;
|
||||
usb_open_wait();
|
||||
usb_fxlink_text(str, len);
|
||||
}
|
||||
|
||||
mp_print_t const mp_debug_print = { NULL, print_strn };
|
||||
|
||||
void pe_debug_kmalloc(void)
|
||||
{
|
||||
kmalloc_gint_stats_t *s;
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
/* PythonExtra's main debug flag */
|
||||
#define PE_DEBUG (0)
|
||||
#define MICROPY_DEBUG_VERBOSE (0)
|
||||
/* Custom flag to remove DEBUG_printf in alloc/GC (very verbose) */
|
||||
#define MICROPY_DEBUG_VERBOSE_ALLOC (0)
|
||||
|
||||
#if PE_DEBUG
|
||||
extern const struct _mp_print_t mp_debug_print;
|
||||
#define MICROPY_DEBUG_PRINTER (&mp_debug_print)
|
||||
#endif
|
||||
|
||||
/* General feature set selection
|
||||
Other options: BASIC_FEATURES, EXTRA_FEATURES, FULL_FEATURES, EVERYTHING */
|
||||
|
|
2
py/gc.c
2
py/gc.c
|
@ -34,7 +34,7 @@
|
|||
|
||||
#if MICROPY_ENABLE_GC
|
||||
|
||||
#if MICROPY_DEBUG_VERBOSE // print debugging info
|
||||
#if MICROPY_DEBUG_VERBOSE && MICROPY_DEBUG_VERBOSE_ALLOC
|
||||
#define DEBUG_PRINT (1)
|
||||
#define DEBUG_printf DEBUG_printf
|
||||
#else // don't print debugging info
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "py/misc.h"
|
||||
#include "py/mpstate.h"
|
||||
|
||||
#if MICROPY_DEBUG_VERBOSE // print debugging info
|
||||
#if MICROPY_DEBUG_VERBOSE && MICROPY_DEBUG_VERBOSE_ALLOC
|
||||
#define DEBUG_printf DEBUG_printf
|
||||
#else // don't print debugging info
|
||||
#define DEBUG_printf(...) (void)0
|
||||
|
|
Loading…
Reference in New Issue