|
1607 | 1607 | Custom config for Cortext-debug plugin for Arduino IDE
|
1608 | 1608 | </a>
|
1609 | 1609 |
|
| 1610 | +</li> |
| 1611 | + |
| 1612 | + <li class="md-nav__item"> |
| 1613 | + <a href="#additional-debugger-config-selection-via-debugadditional_config-directive" class="md-nav__link"> |
| 1614 | + Additional debugger config selection via debug.additional_config directive. |
| 1615 | + </a> |
| 1616 | + |
1610 | 1617 | </li>
|
1611 | 1618 |
|
1612 | 1619 | <li class="md-nav__item">
|
|
2246 | 2253 | Custom config for Cortext-debug plugin for Arduino IDE
|
2247 | 2254 | </a>
|
2248 | 2255 |
|
| 2256 | +</li> |
| 2257 | + |
| 2258 | + <li class="md-nav__item"> |
| 2259 | + <a href="#additional-debugger-config-selection-via-debugadditional_config-directive" class="md-nav__link"> |
| 2260 | + Additional debugger config selection via debug.additional_config directive. |
| 2261 | + </a> |
| 2262 | + |
2249 | 2263 | </li>
|
2250 | 2264 |
|
2251 | 2265 | <li class="md-nav__item">
|
@@ -3440,6 +3454,60 @@ <h3 id="custom-config-for-cortext-debug-plugin-for-arduino-ide">Custom config fo
|
3440 | 3454 | <span class="w"> </span><span class="p">}</span>
|
3441 | 3455 | <span class="p">}</span>
|
3442 | 3456 | </code></pre></div>
|
| 3457 | +<h3 id="additional-debugger-config-selection-via-debugadditional_config-directive">Additional debugger config selection via <code>debug.additional_config</code> directive.<a class="headerlink" href="#additional-debugger-config-selection-via-debugadditional_config-directive" title="Permanent link">¶</a></h3> |
| 3458 | +<p>It is possible to use any sub-tree of the platform configuration to override the debugger configuration using the |
| 3459 | +directive <code>debug.additional_config=CONFIG_PREFIX</code>. This rule will use the configuration under <code>CONFIG_PREFIX.*</code> to |
| 3460 | +override the current <code>debug.*</code> config.</p> |
| 3461 | +<p>This change allows a more convenient rationalization and selection of the configs to apply to the debugger. For example, |
| 3462 | +we could factor common parts of a configuration in the platform.txt file:</p> |
| 3463 | +<div class="highlight"><pre><span></span><code># CONFIG 1 |
| 3464 | +debug-overrides.esp32.cortex-debug.custom.name=Arduino on ESP32 |
| 3465 | +debug-overrides.esp32.cortex-debug.custom.request=attach |
| 3466 | +debug-overrides.esp32.cortex-debug.custom.postAttachCommands.0=set remote hardware-watchpoint-limit 2 |
| 3467 | +debug-overrides.esp32.cortex-debug.custom.postAttachCommands.1=monitor reset halt |
| 3468 | +debug-overrides.esp32.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync |
| 3469 | +debug-overrides.esp32.cortex-debug.custom.postAttachCommands.3=thb setup |
| 3470 | +debug-overrides.esp32.cortex-debug.custom.postAttachCommands.4=c |
| 3471 | +debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt |
| 3472 | +debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync |
| 3473 | +debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.2=thb setup |
| 3474 | +debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.3=c |
| 3475 | + |
| 3476 | +# CONFIG 2 |
| 3477 | +debug-overrides.esp32s2.cortex-debug.custom.name=Arduino on ESP32-S2 |
| 3478 | +debug-overrides.esp32s2.cortex-debug.custom.request=attach |
| 3479 | +debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.0=set remote hardware-watchpoint-limit 2 |
| 3480 | +debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.1=monitor reset halt |
| 3481 | +debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync |
| 3482 | +debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.3=thb setup |
| 3483 | +debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.4=c |
| 3484 | +debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt |
| 3485 | +debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync |
| 3486 | +debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.2=thb setup |
| 3487 | +debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.3=c |
| 3488 | +</code></pre></div> |
| 3489 | +<p>and choose which one to use depending on the board in the boards.txt file:</p> |
| 3490 | +<div class="highlight"><pre><span></span><code>myboard.name=My Board with esp32 |
| 3491 | +myboard.debug.additional_config=debug-overrides.esp32 |
| 3492 | + |
| 3493 | +anotherboard.name=My Board with esp32s2 |
| 3494 | +anotherboard.debug.additional_config=debug-overrides.esp32s2 |
| 3495 | +... |
| 3496 | +</code></pre></div> |
| 3497 | +<p>Another possibility is to compose the configuration using another variable present in the board configuration, for |
| 3498 | +example if in the <code>platform.txt</code> we add:</p> |
| 3499 | +<div class="highlight"><pre><span></span><code>debug.additional_config=debug-overrides.{build.mcu} |
| 3500 | +</code></pre></div> |
| 3501 | +<p>we may use the <code>build.mcu</code> value as a "selector" for the board-specific debug configuration that is overlapped to the |
| 3502 | +global debug configuration:</p> |
| 3503 | +<div class="highlight"><pre><span></span><code>myboard.name=My Board with esp32 |
| 3504 | +myboard.build.mcu=esp32 |
| 3505 | +... |
| 3506 | + |
| 3507 | +anotherboard.name=My Board with esp32s2 |
| 3508 | +anotherboard.build.mcu=esp32s2 |
| 3509 | +... |
| 3510 | +</code></pre></div> |
3443 | 3511 | <h3 id="optimization-level-for-debugging">Optimization level for debugging<a class="headerlink" href="#optimization-level-for-debugging" title="Permanent link">¶</a></h3>
|
3444 | 3512 | <p>The compiler optimization level that is appropriate for normal usage will often not provide a good experience while
|
3445 | 3513 | debugging. For this reason, it may be helpful to use different compiler flags when compiling a sketch for use with the
|
|
0 commit comments