1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-02 14:22:55 +03:00

Add debug support for build.opt (#8637)

Add support to have different build option comment blocks
for debug and production builds.

Updated example esp8266/HwdtStackDump to use build.opt
This commit is contained in:
M Hightower
2022-08-04 11:33:24 -07:00
committed by GitHub
parent ee7ac2f79d
commit 313b3c07ec
5 changed files with 132 additions and 4 deletions

View File

@ -47,8 +47,6 @@ extern "C" {
////////////////////////////////////////////////////////////////////
void setup(void) {
WiFi.persistent(false); // w/o this a flash write occurs at every boot
WiFi.mode(WIFI_OFF);
Serial.begin(115200);
delay(20); // This delay helps when using the 'Modified Serial monitor' otherwise it is not needed.
Serial.println();
@ -56,16 +54,20 @@ void setup(void) {
Serial.println(F("The Hardware Watchdog Timer Demo is starting ..."));
Serial.println();
#ifdef DEMO_THUNK
// This allows us to test dumping a BearSSL stack after HWDT.
stack_thunk_add_ref();
thunk_ets_uart_printf("Using Thunk Stack to print this line.\n\n");
#endif
#ifdef DEMO_WIFI
// We don't need this for this example; however, starting WiFi uses a little
// more of the SYS stack.
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println(F("A WiFi connection attempt has been started."));
Serial.println();
#endif
// #define DEMO_NOEXTRA4K
#ifdef DEMO_NOEXTRA4K

View File

@ -0,0 +1,51 @@
/*@create-file:build.opt:debug@
// For this block to work, you must have
// `mkbuildoptglobals.extra_flags={build.debug_port}` in `platform.local.txt`
// Or move contents to the block with the signature "@create-file:build.opt@"
// Removing the optimization for "sibling and tail recursive calls" will clear
// up some gaps in the stack decoder report. Preserves stack frames created at
// each level as you call down to the next.
-fno-optimize-sibling-calls
// Adds a pointer toward the end of the stack frame that points to the beginning
// of the stack frame. The stack dump will annotate the line where it occurs
// with a `<` mark.
-fno-omit-frame-pointer
// Options for HWDT Stack Dump (hwdt_app_entry.cpp)
// Alter the UART serial speed used for printing the Hardware WDT reset stack
// dump. Without this option on an HWDT reset, the existing default speed of
// 115200 bps will be used. If you are using this default speed, you can skip
// this option. Note this option only changes the speed while the stack dump is
// printing. Prior settings are restored.
// -DDEBUG_ESP_HWDT_UART_SPEED=19200
// -DDEBUG_ESP_HWDT_UART_SPEED=74880
// -DDEBUG_ESP_HWDT_UART_SPEED=115200
// -DDEBUG_ESP_HWDT_UART_SPEED=230400
// HWDT Stack Dump defaults to print a simple introduction to let you know the
// tool is active and in the build. At power-on, this may not be viewable on
// some devices. Use the DEBUG_ESP_HWDT_UART_SPEED option above to improve.
// Or uncomment line below to turn off greeting
// -DDEBUG_ESP_HWDT_PRINT_GREETING=0
// Demos
-DDEMO_THUNK=1
// -DDEMO_NOEXTRA4K=1
-DDEMO_WIFI=1
*/
/*@create-file:build.opt@
// -fno-optimize-sibling-calls
// -fno-omit-frame-pointer
// Demos
-DDEMO_THUNK=1
// -DDEMO_NOEXTRA4K=1
-DDEMO_WIFI=1
*/