diff --git a/src/modm/board/black_pill_f103/module.lb b/src/modm/board/black_pill_f103/module.lb
index ae0c7209df..94d1e69be2 100644
--- a/src/modm/board/black_pill_f103/module.lb
+++ b/src/modm/board/black_pill_f103/module.lb
@@ -11,49 +11,19 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------
-description = """
+def init(module):
+ module.name = ":board:black-pill-f103"
+ module.description = """
# Black Pill
STM32F103C8T6 "Black Pill" Minimum System Development Board
Cheap and bread-board-friendly board for STM32 F1 series.
-Sold for less than 2 USD on well known Internet shops from China.
+Sold for less than 2 USD on Aliexpress.
https://stm32-base.org/boards/STM32F103C8T6-Black-Pill.html
-
-## Programming
-
-Since the board doesn't have a programmer on-board, you need to use your
-own and *specify* which one you're using in a custom `openocd.cfg` file:
-
-```
-# Replace this with your custom programmer
-source [find interface/stlink-v2.cfg]
-
-# If you use the clone CKS32F103C8T6 chip you need to overwrite this ID
-#set CPUTAPID 0x2ba01477
-
-# To select a specific programmer you can specify its serial number
-#hla_serial "\\x53\\x3f\\x6f\\x06\\x50\\x77\\x50\\x57\\x12\\x17\\x14\\x3f"
-# You can discover the serial via `stlink --hla-serial` or `st-info --hla-serial`.
-```
-
-Then include this file in your build options like so:
-
-```xml
-
- modm:black-pill
-
-
-
-
-```
"""
-def init(module):
- module.name = ":board:black-pill-f103"
- module.description = description
-
def prepare(module, options):
if not options[":target"].partname.startswith("stm32f103c8t"):
return False
@@ -76,9 +46,6 @@ def build(env):
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f103_blue_pill.cfg"), "stm32f103_blue_pill.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32f103_blue_pill.cfg")
-
- # Warn the user if they forgot to set a custom openocd config
- if env.has_option(":build:openocd.cfg") and not len(env.get(":build:openocd.cfg", "")):
- env.log.warning("You need to provide the programmer via a custom OpenOCD config!\n" + description)
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f1x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/black_pill_f401/module.lb b/src/modm/board/black_pill_f401/module.lb
index 524f6c37e3..1fded2cf7c 100644
--- a/src/modm/board/black_pill_f401/module.lb
+++ b/src/modm/board/black_pill_f401/module.lb
@@ -12,13 +12,13 @@
def init(module):
module.name = ":board:black-pill-f401"
- module.description = """\
+ module.description = """
# Black Pill F401
STM32F401CCU "Mini-F401" Minimum System Development Board
Cheap and bread-board-friendly board for STM32F401 series.
-Sold for less than 4 USD on well known Internet shops from China.
+Sold for less than 4 USD on Aliexpress.
Attention: There are two variants: Mini-F411 and the cheaper Mini-F401.
https://stm32-base.org/boards/STM32F401CEU6-WeAct-Black-Pill-V3.0
@@ -32,25 +32,6 @@ A DFU command is integrated into the `modm:build:scons` tool and can be called a
```
scons program-dfu
```
-
-Alternatively you can go for an external programmer
-and *specify* which one you're using in a custom `openocd.cfg` file:
-
-```
-# Replace this with your custom programmer
-source [find interface/stlink-v2.cfg]
-```
-
-Then include this file in your build options like so:
-
-```xml
-
- modm:black-pill-f401
-
-
-
-
-```
"""
def prepare(module, options):
@@ -75,5 +56,6 @@ def build(env):
env.copy('../black_pill_f411/board.hpp', 'board.hpp')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f4x1_mini_f4x1.cfg"), "stm32f4x1_mini_f4x1.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32f4x1_mini_f4x1.cfg")
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f4x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/black_pill_f411/module.lb b/src/modm/board/black_pill_f411/module.lb
index ad303b44ce..47983e961f 100644
--- a/src/modm/board/black_pill_f411/module.lb
+++ b/src/modm/board/black_pill_f411/module.lb
@@ -12,13 +12,13 @@
def init(module):
module.name = ":board:black-pill-f411"
- module.description = """\
+ module.description = """
# Black Pill F411
STM32F411CEU "Mini-F411" Minimum System Development Board
Cheap and bread-board-friendly board for STM32F411 series.
-Sold for less than 5 USD on well known Internet shops from China.
+Sold for less than 5 USD on Aliexpress.
Attention: There are two variants: Mini-F411 and the cheaper Mini-F401.
https://stm32-base.org/boards/STM32F401CEU6-WeAct-Black-Pill-V3.0
@@ -32,25 +32,6 @@ A DFU command is integrated into the `modm:build:scons` tool and can be called a
```
scons program-dfu
```
-
-Alternatively you can go for an external programmer
-and *specify* which one you're using in a custom `openocd.cfg` file:
-
-```
-# Replace this with your custom programmer
-source [find interface/stlink-v2.cfg]
-```
-
-Then include this file in your build options like so:
-
-```xml
-
- modm:black-pill-f411
-
-
-
-
-```
"""
def prepare(module, options):
@@ -75,5 +56,6 @@ def build(env):
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f4x1_mini_f4x1.cfg"), "stm32f4x1_mini_f4x1.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32f4x1_mini_f4x1.cfg")
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f4x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/blue_pill_f103/module.lb b/src/modm/board/blue_pill_f103/module.lb
index 4fff8cb9e0..48c235f382 100644
--- a/src/modm/board/blue_pill_f103/module.lb
+++ b/src/modm/board/blue_pill_f103/module.lb
@@ -11,49 +11,19 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------
-description = """
+def init(module):
+ module.name = ":board:blue-pill-f103"
+ module.description = """
# Blue Pill
STM32F103C8T6 "Blue Pill" Minimum System Development Board
Cheap and bread-board-friendly board for STM32 F1 series.
-Sold for less than 2 USD on well known Internet shops from China.
+Sold for less than 2 USD on Aliexpress.
https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html
-
-## Programming
-
-Since the board doesn't have a programmer on-board, you need to use your
-own and *specify* which one you're using in a custom `openocd.cfg` file:
-
-```
-# Replace this with your custom programmer
-source [find interface/stlink-v2.cfg]
-
-# If you use the clone CKS32F103C8T6 chip you need to overwrite this ID
-#set CPUTAPID 0x2ba01477
-
-# To select a specific programmer you can specify its serial number
-#hla_serial "\\x53\\x3f\\x6f\\x06\\x50\\x77\\x50\\x57\\x12\\x17\\x13\\x3f"
-# You can discover the serial via `stlink --hla-serial` or `st-info --hla-serial`.
-```
-
-Then include this file in your build options like so:
-
-```xml
-
- modm:blue-pill-f103
-
-
-
-
-```
"""
-def init(module):
- module.name = ":board:blue-pill-f103"
- module.description = description
-
def prepare(module, options):
if not options[":target"].partname.startswith("stm32f103c8t"):
return False
@@ -76,9 +46,6 @@ def build(env):
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f103_blue_pill.cfg"), "stm32f103_blue_pill.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32f103_blue_pill.cfg")
-
- # Warn the user if they forgot to set a custom openocd config
- if env.has_option(":build:openocd.cfg") and not len(env.get(":build:openocd.cfg", "")):
- env.log.warning("You need to provide the programmer via a custom OpenOCD config!\n" + description)
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f1x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/devebox_stm32f4xx/module.lb b/src/modm/board/devebox_stm32f4xx/module.lb
index edbbdbc974..8c733d6c6f 100644
--- a/src/modm/board/devebox_stm32f4xx/module.lb
+++ b/src/modm/board/devebox_stm32f4xx/module.lb
@@ -40,5 +40,6 @@ def build(env):
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f4x1_mini_f4x1.cfg"), "stm32f4x1_mini_f4x1.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32f4x1_mini_f4x1.cfg")
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f4x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/devebox_stm32h750vb/module.lb b/src/modm/board/devebox_stm32h750vb/module.lb
index 20b71b14c9..e4906a0b61 100644
--- a/src/modm/board/devebox_stm32h750vb/module.lb
+++ b/src/modm/board/devebox_stm32h750vb/module.lb
@@ -10,7 +10,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------
-description = """
+def init(module):
+ module.name = ":board:devebox-stm32h750vb"
+ module.description = """
# STM32F750VB mcudev DevEBox
[STM32F750VB mcudev DevEBox H7xx](https://github.com/mcauser/MCUDEV_DEVEBOX_H7XX_M)
@@ -32,40 +34,8 @@ target option in your `project.xml`:
```
-
-## Programming
-
-Since the board doesn't have a programmer on-board, you need to use your
-own and *specify* which one you're using in a custom `openocd.cfg` file:
-
-```
-# Replace this with your custom programmer
-source [find interface/stlink.cfg]
-
-# If you use the clone CKS32F103C8T6 chip you need to overwrite this ID
-#set CPUTAPID 0x2ba01477
-
-# To select a specific programmer you can specify its serial number
-#hla_serial "\\x53\\x3f\\x6f\\x06\\x50\\x77\\x50\\x57\\x12\\x17\\x13\\x3f"
-# You can discover the serial via `stlink --hla-serial` or `st-info --hla-serial`.
-```
-
-Then include this file in your build options like so:
-
-```xml
-
- modm:devebox-stm32h750vb
-
-
-
-
-```
"""
-def init(module):
- module.name = ":board:devebox-stm32h750vb"
- module.description = description
-
def prepare(module, options):
if not options[":target"].partname.startswith("stm32h750vbt"):
return False
@@ -90,9 +60,6 @@ def build(env):
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32h7xx_devebox.cfg"), "stm32h7xx_devebox.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32h7xx_devebox.cfg")
-
- # Warn the user if they forgot to set a custom openocd config
- if env.has_option(":build:openocd.cfg") and not len(env.get(":build:openocd.cfg", "")):
- env.log.warning("You need to provide the programmer via a custom OpenOCD config!\n" + description)
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32h7x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/feather_m0/module.lb b/src/modm/board/feather_m0/module.lb
index a60336d5f7..46bb074f26 100644
--- a/src/modm/board/feather_m0/module.lb
+++ b/src/modm/board/feather_m0/module.lb
@@ -47,7 +47,3 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- # env.outbasepath = "modm/openocd/modm/board/"
- # env.copy(repopath("tools/openocd/modm/stm32f103_blue_pill.cfg"), "stm32f103_blue_pill.cfg")
- # env.collect(":build:openocd.source", "modm/board/stm32f103_blue_pill.cfg");
diff --git a/src/modm/board/feather_rp2040/module.lb b/src/modm/board/feather_rp2040/module.lb
index 1df18598b7..a0e0341675 100644
--- a/src/modm/board/feather_rp2040/module.lb
+++ b/src/modm/board/feather_rp2040/module.lb
@@ -43,7 +43,4 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/rp2040_picoprobe.cfg"), "rp2040_picoprobe.cfg")
- env.collect(":build:openocd.source", "modm/board/rp2040_picoprobe.cfg")
+ env.collect(":build:openocd.source", "interface/picoprobe.cfg", "target/rp2040.cfg")
diff --git a/src/modm/board/module.md b/src/modm/board/module.md
index 92ace1c563..3c7856c975 100644
--- a/src/modm/board/module.md
+++ b/src/modm/board/module.md
@@ -66,6 +66,45 @@ int main()
same functions resulting in naming conflicts.
+## Programming
+
+Most development boards have a programmer on-board and the BSPs are configured
+to use them automatically.
+
+However, for development boards without a programmer on-board, you need to use
+your own and *specify* which one you're using. For simple configuration, adding
+a collector is enough:
+
+```xml
+
+
+ interface/stlink.cfg
+
+
+```
+
+For more complex configuration, add a custom `openocd.cfg` file:
+
+```tcl
+# Replace this with your custom programmer
+source [find interface/stlink.cfg]
+
+# To select a specific programmer you can specify its serial number
+hla_serial "\\x53\\x3f\\x6f\\x06\\x50\\x77\\x50\\x57\\x12\\x17\\x14\\x3f"
+# You can discover the serial via `lsusb -v`.
+```
+
+Then include this file in your build options like so:
+
+```xml
+
+
+
+
+
+```
+
+
## Customization
The BSPs contain an opinionated set of pre-defined functionality and settings.
diff --git a/src/modm/board/nucleo_c031c6/module.lb b/src/modm/board/nucleo_c031c6/module.lb
index 8d72e77882..e6352c7e7e 100644
--- a/src/modm/board/nucleo_c031c6/module.lb
+++ b/src/modm/board/nucleo_c031c6/module.lb
@@ -39,5 +39,6 @@ def build(env):
env.copy("../nucleo64_arduino_c0.hpp", "nucleo64_arduino.hpp")
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_c0.cfg"), "st_nucleo_c0.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_c0.cfg")
+ env.template(repopath("tools/openocd/modm/st_nucleo_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32c0x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/nucleo_g070rb/module.lb b/src/modm/board/nucleo_g070rb/module.lb
index 147168f08b..05c7f861e1 100644
--- a/src/modm/board/nucleo_g070rb/module.lb
+++ b/src/modm/board/nucleo_g070rb/module.lb
@@ -35,7 +35,4 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy("../nucleo_g071rb/board.hpp", "board.hpp")
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_g0.cfg"), "st_nucleo_g0.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_g0.cfg")
+ env.collect(":build:openocd.source", "board/st_nucleo_g0.cfg")
diff --git a/src/modm/board/nucleo_g071rb/module.lb b/src/modm/board/nucleo_g071rb/module.lb
index c10da91c6a..8a99442f94 100644
--- a/src/modm/board/nucleo_g071rb/module.lb
+++ b/src/modm/board/nucleo_g071rb/module.lb
@@ -34,8 +34,4 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- # The patch doesn't include board config file though
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_g0.cfg"), "st_nucleo_g0.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_g0.cfg")
+ env.collect(":build:openocd.source", "board/st_nucleo_g0.cfg")
diff --git a/src/modm/board/nucleo_g431kb/module.lb b/src/modm/board/nucleo_g431kb/module.lb
index 63e68ed2d3..67ea2a88cd 100644
--- a/src/modm/board/nucleo_g431kb/module.lb
+++ b/src/modm/board/nucleo_g431kb/module.lb
@@ -34,7 +34,4 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_g4.cfg"), "st_nucleo_g4.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_g4.cfg")
+ env.collect(":build:openocd.source", "board/st_nucleo_g4.cfg")
diff --git a/src/modm/board/nucleo_g431rb/module.lb b/src/modm/board/nucleo_g431rb/module.lb
index 910ceb5bde..e624843b3a 100644
--- a/src/modm/board/nucleo_g431rb/module.lb
+++ b/src/modm/board/nucleo_g431rb/module.lb
@@ -35,7 +35,4 @@ def build(env):
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.copy("../nucleo64_arduino.hpp", "nucleo64_arduino.hpp")
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_g4.cfg"), "st_nucleo_g4.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_g4.cfg")
+ env.collect(":build:openocd.source", "board/st_nucleo_g4.cfg")
diff --git a/src/modm/board/nucleo_g474re/module.lb b/src/modm/board/nucleo_g474re/module.lb
index 0a2527b508..cda5c630b1 100644
--- a/src/modm/board/nucleo_g474re/module.lb
+++ b/src/modm/board/nucleo_g474re/module.lb
@@ -35,7 +35,4 @@ def build(env):
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.copy("../nucleo64_arduino.hpp", "nucleo64_arduino.hpp")
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_g4.cfg"), "st_nucleo_g4.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_g4.cfg")
+ env.collect(":build:openocd.source", "board/st_nucleo_g4.cfg")
diff --git a/src/modm/board/nucleo_h723zg/module.lb b/src/modm/board/nucleo_h723zg/module.lb
index d484059a6c..ef31adeb0b 100644
--- a/src/modm/board/nucleo_h723zg/module.lb
+++ b/src/modm/board/nucleo_h723zg/module.lb
@@ -51,6 +51,8 @@ def build(env):
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.copy("../nucleo144_arduino.hpp", "nucleo144_arduino.hpp")
+
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_h723zg.cfg"), "st_nucleo_h723zg.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_h723zg.cfg")
+ env.template(repopath("tools/openocd/modm/st_nucleo_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32h7x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/nucleo_l031k6/module.lb b/src/modm/board/nucleo_l031k6/module.lb
index e35f967e10..126da77d85 100644
--- a/src/modm/board/nucleo_l031k6/module.lb
+++ b/src/modm/board/nucleo_l031k6/module.lb
@@ -40,5 +40,6 @@ def build(env):
env.template("../nucleo32_arduino.hpp.in", "nucleo32_arduino.hpp")
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_l0.cfg"), "st_nucleo_l0.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_l0.cfg");
+ env.template(repopath("tools/openocd/modm/st_nucleo_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32l0"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/nucleo_l053r8/module.lb b/src/modm/board/nucleo_l053r8/module.lb
index 05f5b5497a..3be36b548f 100644
--- a/src/modm/board/nucleo_l053r8/module.lb
+++ b/src/modm/board/nucleo_l053r8/module.lb
@@ -38,5 +38,6 @@ def build(env):
env.copy("../nucleo64_arduino.hpp", "nucleo64_arduino.hpp")
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_l0.cfg"), "st_nucleo_l0.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_l0.cfg")
+ env.template(repopath("tools/openocd/modm/st_nucleo_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32l0"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/nucleo_u575zi-q/module.lb b/src/modm/board/nucleo_u575zi-q/module.lb
index 4ff37e65a6..79de2b5921 100644
--- a/src/modm/board/nucleo_u575zi-q/module.lb
+++ b/src/modm/board/nucleo_u575zi-q/module.lb
@@ -42,6 +42,8 @@ def build(env):
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.copy("../nucleo144_arduino_u5.hpp", "nucleo144_arduino_u5.hpp")
+
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/st_nucleo_u5.cfg"), "st_nucleo_u5.cfg")
- env.collect(":build:openocd.source", "modm/board/st_nucleo_u5.cfg")
+ env.template(repopath("tools/openocd/modm/st_nucleo_dap.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32u5x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/rp_pico/module.lb b/src/modm/board/rp_pico/module.lb
index 5632162f10..0fbc999389 100644
--- a/src/modm/board/rp_pico/module.lb
+++ b/src/modm/board/rp_pico/module.lb
@@ -99,7 +99,4 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/rp2040_picoprobe.cfg"), "rp2040_picoprobe.cfg")
- env.collect(":build:openocd.source", "modm/board/rp2040_picoprobe.cfg")
+ env.collect(":build:openocd.source", "interface/picoprobe.cfg", "target/rp2040.cfg")
diff --git a/src/modm/board/samd21_mini/module.lb b/src/modm/board/samd21_mini/module.lb
index c5ee204998..654847b0dd 100644
--- a/src/modm/board/samd21_mini/module.lb
+++ b/src/modm/board/samd21_mini/module.lb
@@ -37,10 +37,4 @@ def prepare(module, options):
def build(env):
env.outbasepath = "modm/src/modm/board"
- # env.substitutions = {"board_has_logger": False}
- # env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- # env.outbasepath = "modm/openocd/modm/board/"
- # env.copy(repopath("tools/openocd/modm/stm32f103_blue_pill.cfg"), "stm32f103_blue_pill.cfg")
- # env.collect(":build:openocd.source", "modm/board/stm32f103_blue_pill.cfg");
diff --git a/src/modm/board/samg55_xplained_pro/module.lb b/src/modm/board/samg55_xplained_pro/module.lb
index 3aec8017fb..a1b8822805 100644
--- a/src/modm/board/samg55_xplained_pro/module.lb
+++ b/src/modm/board/samg55_xplained_pro/module.lb
@@ -31,4 +31,6 @@ def build(env):
env.outbasepath = "modm/src/modm/board"
env.copy('board.hpp')
- # TODO: openocd config?
+ env.outbasepath = "modm/openocd/modm/board/"
+ env.copy(repopath("tools/openocd/modm/atmel_samg55_xplained_pro.cfg"), "atmel_samg55_xplained_pro.cfg")
+ env.collect(":build:openocd.source", "modm/board/atmel_samg55_xplained_pro.cfg")
diff --git a/src/modm/board/stm32_f4ve/module.lb b/src/modm/board/stm32_f4ve/module.lb
index 4b2382148d..5a17155c40 100644
--- a/src/modm/board/stm32_f4ve/module.lb
+++ b/src/modm/board/stm32_f4ve/module.lb
@@ -40,12 +40,12 @@ def build(env):
env.outbasepath = "modm/src/modm/board"
env.substitutions = {
"with_logger": True,
- "with_assert": env.has_module(":architecture:assert")
+ "with_assert": env.has_module(":architecture:assert"),
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f4x.cfg"), "stm32f4x.cfg")
- env.copy(repopath("tools/openocd/modm/stm32_f4ve.cfg"), "stm32_f4ve.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32_f4ve.cfg")
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f4x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/stm32f030f4p6_demo/module.lb b/src/modm/board/stm32f030f4p6_demo/module.lb
index 543b7980e4..daac6906b7 100644
--- a/src/modm/board/stm32f030f4p6_demo/module.lb
+++ b/src/modm/board/stm32f030f4p6_demo/module.lb
@@ -11,46 +11,19 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------
-description = """
+def init(module):
+ module.name = ":board:stm32f030_demo"
+ module.description = """
# STM32F030 Demo Board
STM32F030F4P6 Minimum System Development Board.
Cheap and bread-board-friendly board for STM32 F0 series.
-Sold for less than 1.5 USD on well known Internet shops from China.
+Sold for less than 1.5 USD on Aliexpress.
https://stm32-base.org/boards/STM32F030F4P6-STM32F030-DEMO-BOARD-V1.1
-
-## Programming
-
-Since the board doesn't have a programmer on-board, you need to use your
-own and *specify* which one you're using in a custom `openocd.cfg` file:
-
-```
-# Replace this with your custom programmer
-source [find interface/stlink-v2.cfg]
-
-# To select a specific programmer you can specify its serial number
-#hla_serial "\\x53\\x3f\\x6f\\x06\\x51\\x77\\x50\\x57\\x12\\x17\\x13\\x3f"
-# You can discover the serial via `stlink --hla-serial` or `st-info --hla-serial`.
-```
-
-Then include this file in your build options like so:
-
-```xml
-
- modm:stm32f030_demo
-
-
-
-
-```
"""
-def init(module):
- module.name = ":board:stm32f030_demo"
- module.description = description
-
def prepare(module, options):
if not options[":target"].partname.startswith("stm32f030f4p"):
return False
@@ -73,9 +46,6 @@ def build(env):
env.copy('.')
env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/stm32f030_demo_board.cfg"), "stm32f030_demo_board.cfg")
- env.collect(":build:openocd.source", "modm/board/stm32f030_demo_board.cfg")
-
- # Warn the user if they forgot to set a custom openocd config
- if env.has_option(":build:openocd.cfg") and not len(env.get(":build:openocd.cfg", "")):
- env.log.warning("You need to provide the programmer via a custom OpenOCD config!\n" + description)
+ env.template(repopath("tools/openocd/modm/stm32_swd.cfg.in"), "board.cfg",
+ substitutions={"target": "stm32f0x"})
+ env.collect(":build:openocd.source", "modm/board/board.cfg")
diff --git a/src/modm/board/thingplus_rp2040/module.lb b/src/modm/board/thingplus_rp2040/module.lb
index 10005331ab..3609565b0c 100644
--- a/src/modm/board/thingplus_rp2040/module.lb
+++ b/src/modm/board/thingplus_rp2040/module.lb
@@ -49,7 +49,4 @@ def build(env):
}
env.template("../board.cpp.in", "board.cpp")
env.copy('.')
-
- env.outbasepath = "modm/openocd/modm/board/"
- env.copy(repopath("tools/openocd/modm/rp2040_picoprobe.cfg"), "rp2040_picoprobe.cfg")
- env.collect(":build:openocd.source", "modm/board/rp2040_picoprobe.cfg")
+ env.collect(":build:openocd.source", "interface/picoprobe.cfg", "target/rp2040.cfg")
diff --git a/tools/openocd/modm/atmel_samg55_xplained_pro.cfg b/tools/openocd/modm/atmel_samg55_xplained_pro.cfg
new file mode 100644
index 0000000000..a6b88600cc
--- /dev/null
+++ b/tools/openocd/modm/atmel_samg55_xplained_pro.cfg
@@ -0,0 +1,12 @@
+#
+# Atmel ATSAMG55 Xplained Pro evaluation kit.
+# https://www.microchip.com/en-us/development-tool/ATSAMG55-XPRO
+#
+
+source [find interface/cmsis-dap.cfg]
+
+# chip name
+set CHIPNAME ATSAMG55J19
+
+source [find target/at91samg5x.cfg]
+
diff --git a/tools/openocd/modm/busblaster-ktlink.cfg b/tools/openocd/modm/busblaster-ktlink.cfg
deleted file mode 100644
index 13aa64e736..0000000000
--- a/tools/openocd/modm/busblaster-ktlink.cfg
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Dangerous Prototypes - Bus Blaster
-#
-# The Bus Blaster has a configurable buffer between the FTDI FT2232H and the
-# JTAG header which allows it to emulate various debugger types. It comes
-# configured as a JTAGkey device.
-#
-# The Bus Blaster used in MODM development was configured as KTLINK
-#
-# http://dangerousprototypes.com/docs/Bus_Blaster
-#
-
-interface ft2232
-# interface_transports jtag swd
-ft2232_device_desc "Dual RS232-HS"
-ft2232_layout ktlink
-ft2232_vid_pid 0x0403 0x6010
diff --git a/tools/openocd/modm/lpcxpresso_lpc11xx_stlink.cfg b/tools/openocd/modm/lpcxpresso_lpc11xx_stlink.cfg
deleted file mode 100644
index c23e786c4e..0000000000
--- a/tools/openocd/modm/lpcxpresso_lpc11xx_stlink.cfg
+++ /dev/null
@@ -1,14 +0,0 @@
-# Using an ST-Link V2 to programm the target by SWD
-# as LPC-Link firmware is closed source and buggy.
-
-# LPC11C24 LPCXpresso Target
-
-# Using stlink as SWD programmer
-source [find interface/stlink-v2.cfg]
-
-# SWD as transport
-transport select hla_swd
-
-# Use LPC11C24 target
-set WORKAREASIZE 0x4000
-source [find target/lpc11xx.cfg]
diff --git a/tools/openocd/modm/rp2040_picoprobe.cfg b/tools/openocd/modm/rp2040_picoprobe.cfg
deleted file mode 100644
index 06b6ebb423..0000000000
--- a/tools/openocd/modm/rp2040_picoprobe.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-# Script for working with RP2040 boards using Picoprobe
-
-# Must be specified by the user via `modm:build:openocd.cfg` option
-
-source [find interface/picoprobe.cfg]
-source [find target/rp2040.cfg]
diff --git a/tools/openocd/modm/st_nucleo_dap.cfg.in b/tools/openocd/modm/st_nucleo_dap.cfg.in
new file mode 100644
index 0000000000..0b48b4592d
--- /dev/null
+++ b/tools/openocd/modm/st_nucleo_dap.cfg.in
@@ -0,0 +1,8 @@
+source [find interface/stlink-dap.cfg]
+
+transport select dapdirect_swd
+
+source [find target/{{target}}.cfg]
+
+# use hardware reset
+reset_config srst_only srst_nogate
diff --git a/tools/openocd/modm/st_nucleo_g0.cfg b/tools/openocd/modm/st_nucleo_g0.cfg
deleted file mode 100644
index fd063fddb2..0000000000
--- a/tools/openocd/modm/st_nucleo_g0.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Should work with all STM32G0 Nucleo Dev Boards.
-# http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html
-
-source [find interface/stlink.cfg]
-
-transport select hla_swd
-
-source [find target/stm32g0x.cfg]
-
-# use hardware reset
-reset_config srst_only srst_nogate
diff --git a/tools/openocd/modm/st_nucleo_g4.cfg b/tools/openocd/modm/st_nucleo_g4.cfg
deleted file mode 100644
index 00dabbad44..0000000000
--- a/tools/openocd/modm/st_nucleo_g4.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Should work with all STM32G4 Nucleo Dev Boards.
-# http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html
-
-source [find interface/stlink.cfg]
-
-transport select hla_swd
-
-source [find target/stm32g4x.cfg]
-
-# use hardware reset
-reset_config srst_only srst_nogate
diff --git a/tools/openocd/modm/st_nucleo_h723zg.cfg b/tools/openocd/modm/st_nucleo_h723zg.cfg
deleted file mode 100644
index 48c7d40f76..0000000000
--- a/tools/openocd/modm/st_nucleo_h723zg.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-# This is an ST NUCLEO-H723ZG board with single STM32H723ZG chip.
-# http://www.st.com/en/evaluation-tools/nucleo-h723zg.html
-
-source [find interface/stlink.cfg]
-
-transport select hla_swd
-
-source [find target/stm32h7x.cfg]
-
-reset_config srst_only
diff --git a/tools/openocd/modm/st_nucleo_l0.cfg b/tools/openocd/modm/st_nucleo_l0.cfg
deleted file mode 100644
index e3ec2e91da..0000000000
--- a/tools/openocd/modm/st_nucleo_l0.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Should work with all STM32L0 Nucleo Dev Boards.
-# http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html
-
-source [find interface/stlink.cfg]
-
-transport select hla_swd
-
-source [find target/stm32l0.cfg]
-
-# use hardware reset
-reset_config srst_only srst_nogate
diff --git a/tools/openocd/modm/st_nucleo_c0.cfg b/tools/openocd/modm/st_nucleo_swd.cfg.in
similarity index 86%
rename from tools/openocd/modm/st_nucleo_c0.cfg
rename to tools/openocd/modm/st_nucleo_swd.cfg.in
index 6e92b32c43..099915a3b8 100644
--- a/tools/openocd/modm/st_nucleo_c0.cfg
+++ b/tools/openocd/modm/st_nucleo_swd.cfg.in
@@ -5,7 +5,7 @@ source [find interface/stlink.cfg]
transport select hla_swd
-source [find target/stm32c0x.cfg]
+source [find target/{{target}}.cfg]
# use hardware reset
reset_config srst_only srst_nogate
diff --git a/tools/openocd/modm/st_nucleo_u5.cfg b/tools/openocd/modm/st_nucleo_u5.cfg
deleted file mode 100644
index db574eb0af..0000000000
--- a/tools/openocd/modm/st_nucleo_u5.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# This is for STM32U5 Nucleo Dev Boards.
-# http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html
-
-source [find interface/stlink-dap.cfg]
-
-transport select dapdirect_swd
-
-source [find target/stm32u5x.cfg]
-
-# use hardware reset
-reset_config srst_only srst_nogate
diff --git a/tools/openocd/modm/stm32_f4ve.cfg b/tools/openocd/modm/stm32_f4ve.cfg
deleted file mode 100644
index 6f7647098d..0000000000
--- a/tools/openocd/modm/stm32_f4ve.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-# Cheap STM32F103C8T6 "Blue Pill" Minimum System Development Board
-
-# Must be specified by the user via `modm:build:openocd.cfg` option
-source [find interface/stlink-v2.cfg]
-
-transport select hla_swd
-
-source [find target/stm32f4x.cfg]
-
-reset_config none
diff --git a/tools/openocd/modm/stm32_swd.cfg.in b/tools/openocd/modm/stm32_swd.cfg.in
new file mode 100644
index 0000000000..6377be080d
--- /dev/null
+++ b/tools/openocd/modm/stm32_swd.cfg.in
@@ -0,0 +1,3 @@
+transport select hla_swd
+source [find target/{{target}}.cfg]
+reset_config none
diff --git a/tools/openocd/modm/stm32f030_demo_board.cfg b/tools/openocd/modm/stm32f030_demo_board.cfg
deleted file mode 100644
index 18d39baba9..0000000000
--- a/tools/openocd/modm/stm32f030_demo_board.cfg
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2018, Raphael Lehmann
-#
-# This file is part of the modm project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# Cheap STM32F030F4P6 "Demo Board" Minimum System Development Board
-
-# Must be specified by the user via `modm:build:openocd.cfg` option
-#source [find interface/stlink-v2.cfg]
-
-transport select hla_swd
-
-source [find target/stm32f0x.cfg]
-
-reset_config none
diff --git a/tools/openocd/modm/stm32f103_blue_pill.cfg b/tools/openocd/modm/stm32f103_blue_pill.cfg
deleted file mode 100644
index c101eeaf70..0000000000
--- a/tools/openocd/modm/stm32f103_blue_pill.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-# Cheap STM32F103C8T6 "Blue Pill" Minimum System Development Board
-
-# Must be specified by the user via `modm:build:openocd.cfg` option
-#source [find interface/stlink-v2.cfg]
-
-transport select hla_swd
-
-source [find target/stm32f1x.cfg]
-
-reset_config none
diff --git a/tools/openocd/modm/stm32f4x.cfg b/tools/openocd/modm/stm32f4x.cfg
deleted file mode 100644
index 228b63b45f..0000000000
--- a/tools/openocd/modm/stm32f4x.cfg
+++ /dev/null
@@ -1,62 +0,0 @@
-# Modified stm32f2xxx script to work with the st32f4
-# run something like this to flash your board
-# flash write_image erase demo.hex 0 ihex
-
-if { [info exists CHIPNAME] } {
- set _CHIPNAME $CHIPNAME
-} else {
- set _CHIPNAME stm32f4xxx
-}
-
-if { [info exists ENDIAN] } {
- set _ENDIAN $ENDIAN
-} else {
- set _ENDIAN little
-}
-
-# Work-area is a space in RAM used for flash programming
-# By default use 64kB
-if { [info exists WORKAREASIZE] } {
- set _WORKAREASIZE $WORKAREASIZE
-} else {
- set _WORKAREASIZE 0x10000
-}
-
-# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
-#
-# Since we may be running of an RC oscilator, we crank down the speed a
-# bit more to be on the safe side. Perhaps superstition, but if are
-# running off a crystal, we can run closer to the limit. Note
-# that there can be a pretty wide band where things are more or less stable.
-adapter_khz 2000
-
-adapter_nsrst_delay 100
-jtag_ntrst_delay 100
-
-#jtag scan chain
-if { [info exists CPUTAPID ] } {
- set _CPUTAPID $CPUTAPID
-} else {
- # See STM Document RM0033
- # Section 32.6.3 - corresponds to Cortex-M3 r2p0
- set _CPUTAPID 0x4ba00477
-}
-jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
-
-if { [info exists BSTAPID ] } {
- set _BSTAPID $BSTAPID
-} else {
- # See STM Document RM0033
- # Section 32.6.2
- #
- set _BSTAPID 0x06413041
-}
-jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID
-
-set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
-
-$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
-
-set _FLASHNAME $_CHIPNAME.flash
-flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
diff --git a/tools/openocd/modm/stm32f4x1_mini_f4x1.cfg b/tools/openocd/modm/stm32f4x1_mini_f4x1.cfg
deleted file mode 100644
index 237125e86e..0000000000
--- a/tools/openocd/modm/stm32f4x1_mini_f4x1.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-# Cheap STM32F4x1 "Mini-F4x1" Minimum System Development Board
-
-# Must be specified by the user via `modm:build:openocd.cfg` option
-#source [find interface/stlink-v2.cfg]
-
-transport select hla_swd
-
-source [find target/stm32f4x.cfg]
-
-reset_config none
diff --git a/tools/openocd/modm/stm32h7xx_devebox.cfg b/tools/openocd/modm/stm32h7xx_devebox.cfg
deleted file mode 100644
index 55353be9ca..0000000000
--- a/tools/openocd/modm/stm32h7xx_devebox.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-# DevEBox STM32H7xxx Board
-
-# Must be specified by the user via `modm:build:openocd.cfg` option
-#source [find interface/stlink-v2.cfg]
-
-transport select hla_swd
-
-source [find target/stm32h7x.cfg]
-
-reset_config none