@@ -1452,6 +1452,74 @@ will result in the following JSON:
1452
1452
}
1453
1453
```
1454
1454
1455
+ ### Additional debugger config selection via ` debug.additional_config ` directive.
1456
+
1457
+ It is possible to use any sub-tree of the platform configuration to override the debugger configuration using the
1458
+ directive ` debug.additional_config=CONFIG_PREFIX ` . This rule will use the configuration under ` CONFIG_PREFIX.* ` to
1459
+ override the current ` debug.* ` config.
1460
+
1461
+ This change allows a more convenient rationalization and selection of the configs to apply to the debugger. For example,
1462
+ we could factor common parts of a configuration in the platform.txt file:
1463
+
1464
+ ```
1465
+ # CONFIG 1
1466
+ debug-overrides.esp32.cortex-debug.custom.name=Arduino on ESP32
1467
+ debug-overrides.esp32.cortex-debug.custom.request=attach
1468
+ debug-overrides.esp32.cortex-debug.custom.postAttachCommands.0=set remote hardware-watchpoint-limit 2
1469
+ debug-overrides.esp32.cortex-debug.custom.postAttachCommands.1=monitor reset halt
1470
+ debug-overrides.esp32.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync
1471
+ debug-overrides.esp32.cortex-debug.custom.postAttachCommands.3=thb setup
1472
+ debug-overrides.esp32.cortex-debug.custom.postAttachCommands.4=c
1473
+ debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
1474
+ debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
1475
+ debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.2=thb setup
1476
+ debug-overrides.esp32.cortex-debug.custom.overrideRestartCommands.3=c
1477
+
1478
+ # CONFIG 2
1479
+ debug-overrides.esp32s2.cortex-debug.custom.name=Arduino on ESP32-S2
1480
+ debug-overrides.esp32s2.cortex-debug.custom.request=attach
1481
+ debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.0=set remote hardware-watchpoint-limit 2
1482
+ debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.1=monitor reset halt
1483
+ debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync
1484
+ debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.3=thb setup
1485
+ debug-overrides.esp32s2.cortex-debug.custom.postAttachCommands.4=c
1486
+ debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
1487
+ debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
1488
+ debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.2=thb setup
1489
+ debug-overrides.esp32s2.cortex-debug.custom.overrideRestartCommands.3=c
1490
+ ```
1491
+
1492
+ and choose which one to use depending on the board in the boards.txt file:
1493
+
1494
+ ```
1495
+ myboard.name=My Board with esp32
1496
+ myboard.debug.additional_config=debug-overrides.esp32
1497
+
1498
+ anotherboard.name=My Board with esp32s2
1499
+ anotherboard.debug.additional_config=debug-overrides.esp32s2
1500
+ ...
1501
+ ```
1502
+
1503
+ Another possibility is to compose the configuration using another variable present in the board configuration, for
1504
+ example if in the ` platform.txt ` we add:
1505
+
1506
+ ```
1507
+ debug.additional_config=debug-overrides.{build.mcu}
1508
+ ```
1509
+
1510
+ we may use the ` build.mcu ` value as a "selector" for the board-specific debug configuration that is overlapped to the
1511
+ global debug configuration:
1512
+
1513
+ ```
1514
+ myboard.name=My Board with esp32
1515
+ myboard.build.mcu=esp32
1516
+ ...
1517
+
1518
+ anotherboard.name=My Board with esp32s2
1519
+ anotherboard.build.mcu=esp32s2
1520
+ ...
1521
+ ```
1522
+
1455
1523
### Optimization level for debugging
1456
1524
1457
1525
The compiler optimization level that is appropriate for normal usage will often not provide a good experience while
0 commit comments