From 0915664eaedd514605472d2efe28fbb97fcdf566 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Mon, 4 Apr 2022 09:10:54 +0200 Subject: [PATCH] Berry improve asserts and stack size --- lib/libesp32/berry/default/berry_conf.h | 11 +++++++++++ lib/libesp32/berry/src/be_parser.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/libesp32/berry/default/berry_conf.h b/lib/libesp32/berry/default/berry_conf.h index 8ee9cd0ba..43994b22d 100644 --- a/lib/libesp32/berry/default/berry_conf.h +++ b/lib/libesp32/berry/default/berry_conf.h @@ -251,6 +251,17 @@ extern "C" { #ifdef USE_BERRY_DEBUG #undef BE_DEBUG_RUNTIME_INFO #define BE_DEBUG_RUNTIME_INFO 1 /* record line information in 32 bits to be places in IRAM */ + #undef BE_DEBUG + #define BE_DEBUG 1 + #undef be_assert + #define be_assert(expr) \ + ((expr) \ + ? (0) \ + : serial_debug("BRY: ASSERT '%s', %s - %i\n", #expr, __FILE__, __LINE__)) + #ifdef USE_LVGL + #undef BE_STACK_START + #define BE_STACK_START 200 + #endif // USE_LVGL #endif // USE_BERRY_DEBUG #endif diff --git a/lib/libesp32/berry/src/be_parser.c b/lib/libesp32/berry/src/be_parser.c index dd16c68d7..d0c35bb52 100644 --- a/lib/libesp32/berry/src/be_parser.c +++ b/lib/libesp32/berry/src/be_parser.c @@ -1694,7 +1694,7 @@ static void statement(bparser *parser) case OptSemic: scan_next_token(parser); break; /* empty statement */ default: expr_stmt(parser); break; } - be_assert(parser->finfo->freereg == be_list_count(parser->finfo->local)); + be_assert(parser->finfo->freereg >= be_list_count(parser->finfo->local)); } static void stmtlist(bparser *parser)