1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +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

@ -92,6 +92,72 @@ Global ``.h`` file: ``LowWatermark.ino.globals.h``
#endif
Separate production and debug build options
===========================================
If your production and debug build option requirements are different,
adding ``mkbuildoptglobals.extra_flags={build.debug_port}`` to
``platform.local.txt`` will create separate build option groups for
debugging and production. For the production build option group, the “C”
block comment starts with ``/*@create-file:build.opt@``, as previously
defined. For the debugging group, the new “C” block comment starts with
``/*@create-file:build.opt:debug@``. You make your group selection
through “Arduino->Tools->Debug port” by selecting or disabling the
“Debug port.”
Options common to both debug and production builds must be included in
both groups. Neither of the groups is required. You may also omit either
or both.
Reminder with this change, any old “sketch” with only a “C” block
comment starting with ``/*@create-file:build.opt@`` would not use a
``build.opt`` file for the debug case. Update old sketches as needed.
Updated Global ``.h`` file: ``LowWatermark.ino.globals.h``
.. code:: cpp
/*@create-file:build.opt:debug@
// Debug build options
-DMYTITLE1="\"Running on \""
-DUMM_STATS_FULL=1
//-fanalyzer
// Removing the optimization for "sibling and tail recursive calls" may fill
// in some gaps in the stack decoder report. Preserves the stack frames
// created at each level as you call down to the next.
-fno-optimize-sibling-calls
*/
/*@create-file:build.opt@
// Production build options
-DMYTITLE1="\"Running on \""
-DUMM_STATS_FULL=1
-O3
*/
#ifndef LOWWATERMARK_INO_GLOBALS_H
#define LOWWATERMARK_INO_GLOBALS_H
#if defined(__cplusplus)
#define MYTITLE2 "Empty"
#endif
#if !defined(__cplusplus) && !defined(__ASSEMBLER__)
#define MYTITLE2 "Full"
#endif
#ifdef DEBUG_ESP_PORT
// Global Debug defines
// ...
#else
// Global Production defines
// ...
#endif
#endif
Aggressively cache compiled core
================================