Skip to content

Commit a252b07

Browse files
authored
Merge pull request #12797 from AGlass0fMilk/stm-custom-board
Add custom board option to STM32 pins generation script
2 parents 4c08455 + 958edf9 commit a252b07

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/targets/STM32_gen_PeripheralPins.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ def parse_pins():
11291129

11301130
def parse_BoardFile(fileName):
11311131
print(" * Board file: '%s'" % (fileName))
1132-
board_file = open(board_file_name, "r")
1132+
board_file = open(fileName, "r")
11331133
# IOC_PIN_pattern = re.compile(r'(P[A-I][\d]*).*\.([\w]*)=(.*)')
11341134
IOC_PIN_pattern = re.compile(r'(.*)\.([\w]*)=(.*)')
11351135
for line in board_file.readlines():
@@ -1248,6 +1248,10 @@ def parse_BoardFile(fileName):
12481248
Parameter can be a filter like L496 (only the first file found will be parsed).
12491249
'''))
12501250

1251+
group.add_argument("-c", "--custom", help=textwrap.dedent('''\
1252+
specify a custom board .ioc file description to use (use double quotes).
1253+
'''))
1254+
12511255
args = parser.parse_args()
12521256

12531257
if not(os.path.isdir(cubemxdir)):
@@ -1364,6 +1368,11 @@ def parse_BoardFile(fileName):
13641368
else:
13651369
quit()
13661370

1371+
# Parse the user's custom board .ioc file
1372+
if args.custom:
1373+
parse_BoardFile(args.custom)
1374+
TargetName = ""
1375+
13671376
for mcu_file in mcu_list:
13681377
if args.mcu:
13691378
TargetName = os.path.splitext(mcu_file)[0]

0 commit comments

Comments
 (0)