1111# file, You can obtain one at http://mozilla.org/MPL/2.0/.
1212# -----------------------------------------------------------------------------
1313
14- description = """
14+ def init (module ):
15+ module .name = ":board:black-pill-f103"
16+ module .description = """
1517# Black Pill
1618
1719STM32F103C8T6 "Black Pill" Minimum System Development Board
1820
1921Cheap and bread-board-friendly board for STM32 F1 series.
20- Sold for less than 2 USD on well known Internet shops from China .
22+ Sold for less than 2 USD on Aliexpress .
2123
2224https://stm32-base.org/boards/STM32F103C8T6-Black-Pill.html
23-
24- ## Programming
25-
26- Since the board doesn't have a programmer on-board, you need to use your
27- own and *specify* which one you're using in a custom `openocd.cfg` file:
28-
29- ```
30- # Replace this with your custom programmer
31- source [find interface/stlink-v2.cfg]
32-
33- # If you use the clone CKS32F103C8T6 chip you need to overwrite this ID
34- #set CPUTAPID 0x2ba01477
35-
36- # To select a specific programmer you can specify its serial number
37- #hla_serial "\\ x53\\ x3f\\ x6f\\ x06\\ x50\\ x77\\ x50\\ x57\\ x12\\ x17\\ x14\\ x3f"
38- # You can discover the serial via `stlink --hla-serial` or `st-info --hla-serial`.
39- ```
40-
41- Then include this file in your build options like so:
42-
43- ```xml
44- <library>
45- <extends>modm:black-pill</extends>
46- <options>
47- <option name="modm:build:openocd.cfg">openocd.cfg</option>
48- </options>
49- </library>
50- ```
5125"""
5226
53- def init (module ):
54- module .name = ":board:black-pill-f103"
55- module .description = description
56-
5727def prepare (module , options ):
5828 if not options [":target" ].partname .startswith ("stm32f103c8t" ):
5929 return False
@@ -76,9 +46,6 @@ def build(env):
7646 env .copy ('.' )
7747
7848 env .outbasepath = "modm/openocd/modm/board/"
79- env .copy (repopath ("tools/openocd/modm/stm32f103_blue_pill.cfg" ), "stm32f103_blue_pill.cfg" )
80- env .collect (":build:openocd.source" , "modm/board/stm32f103_blue_pill.cfg" )
81-
82- # Warn the user if they forgot to set a custom openocd config
83- if env .has_option (":build:openocd.cfg" ) and not len (env .get (":build:openocd.cfg" , "" )):
84- env .log .warning ("You need to provide the programmer via a custom OpenOCD config!\n " + description )
49+ env .template (repopath ("tools/openocd/modm/stm32_swd.cfg.in" ), "board.cfg" ,
50+ substitutions = {"target" : "stm32f1x" })
51+ env .collect (":build:openocd.source" , "modm/board/board.cfg" )
0 commit comments