Skip to content

Commit 59f3c7f

Browse files
jimmodpgeorge
authored andcommitted
examples/pins.py: Remove this pins printing example.
It's not supported on all ports, adds complexity to the build to generate pins_af.py, and can mostly be replicated just by printing the pin objects. Remove support for generating pins_af.py from all ports (nrf, stm32, renesas-ra, mimxrt, rp2). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent cb37b7b commit 59f3c7f

11 files changed

Lines changed: 5 additions & 133 deletions

File tree

examples/pins.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

ports/mimxrt/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ BOARD_PINS = $(BOARD_DIR)/pins.csv
6262
PREFIX_FILE = boards/mimxrt_prefix.c
6363
GEN_FLEXRAM_CONFIG_SRC = $(BUILD)/flexram_config.s
6464
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
65-
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
6665
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
6766
GEN_PINS_SRC = $(BUILD)/pins_gen.c
6867

ports/nrf/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
119119
GEN_PINS_SRC = $(BUILD)/pins_gen.c
120120
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
121121
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
122-
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
123122

124123
CFLAGS_CORTEX_M = -mthumb -mabi=aapcs -fsingle-precision-constant -Wdouble-promotion
125124

@@ -544,7 +543,7 @@ $(OBJ): | $(HEADER_BUILD)/pins.h
544543
# both pins_gen.c and pins.h
545544
$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
546545
$(ECHO) "Create $@"
547-
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)
546+
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --af-const $(GEN_PINS_AF_CONST) > $(GEN_PINS_SRC)
548547

549548
$(PY_BUILD)/nlr%.o: CFLAGS += -Os -fno-lto
550549

ports/nrf/boards/make-pins.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,6 @@ def print_af_hdr(self, af_const_filename):
320320
val = "MP_ROM_INT(GPIO_{})".format(mux_name)
321321
print(" { %-*s %s }," % (mux_name_width + 26, key, val), file=af_const_file)
322322

323-
def print_af_py(self, af_py_filename):
324-
with open(af_py_filename, "wt") as af_py_file:
325-
print("PINS_AF = (", file=af_py_file)
326-
for named_pin in self.board_pins:
327-
print(" ('%s', " % named_pin.name(), end="", file=af_py_file)
328-
for af in named_pin.pin().alt_fn:
329-
if af.is_supported():
330-
print("(%d, '%s'), " % (af.idx, af.af_str), end="", file=af_py_file)
331-
print("),", file=af_py_file)
332-
print(")", file=af_py_file)
333-
334323

335324
def main():
336325
parser = argparse.ArgumentParser(
@@ -351,12 +340,6 @@ def main():
351340
help="Specifies header file for alternate function constants.",
352341
default="build/pins_af_const.h",
353342
)
354-
parser.add_argument(
355-
"--af-py",
356-
dest="af_py_filename",
357-
help="Specifies the filename for the python alternate function mappings.",
358-
default="build/pins_af.py",
359-
)
360343
parser.add_argument(
361344
"-b",
362345
"--board",
@@ -401,7 +384,6 @@ def main():
401384
pins.print()
402385
pins.print_header(args.hdr_filename)
403386
pins.print_af_hdr(args.af_const_filename)
404-
pins.print_af_py(args.af_py_filename)
405387

406388

407389
if __name__ == "__main__":

ports/renesas-ra/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ GEN_PINS_SRC = $(BUILD)/pins_$(BOARD).c
558558
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
559559
# Currently unused.
560560
GEN_PINS_AD_CONST = $(HEADER_BUILD)/pins_ad_const.h
561-
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
562561

563562
FILE2H = $(TOP)/tools/file2h.py
564563

@@ -581,7 +580,7 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(BOARD_DIR)/mpconfigboard.h
581580
.PRECIOUS: $(GEN_PINS_SRC)
582581
$(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_ad_const.h: $(BOARD_DIR)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
583582
$(ECHO) "GEN $@"
584-
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --ad-const $(GEN_PINS_AD_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)
583+
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --ad-const $(GEN_PINS_AD_CONST) > $(GEN_PINS_SRC)
585584

586585
CMSIS_MCU_HDR = $(CMSIS_DIR)/$(CMSIS_MCU_LOWER).h
587586

ports/renesas-ra/boards/make-pins.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ def main():
240240
help="Specifies header file for AD function constants.",
241241
default="build/pins_ad_const.h",
242242
)
243-
parser.add_argument(
244-
"--af-py",
245-
dest="af_py_filename",
246-
help="Specifies the filename for the python alternate function mappings.",
247-
default="build/pins_af.py",
248-
)
249243
parser.add_argument(
250244
"--af-defs",
251245
dest="af_defs_filename",

ports/rp2/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ set(GEN_PINS_MKPINS "${MICROPY_BOARDS_DIR}/make-pins.py")
480480
set(GEN_PINS_SRC "${CMAKE_BINARY_DIR}/pins_${MICROPY_BOARD}.c")
481481
set(GEN_PINS_HDR "${MICROPY_GENHDR_DIR}/pins.h")
482482
set(GEN_PINS_AF_CONST "${MICROPY_GENHDR_DIR}/pins_af_const.h")
483-
set(GEN_PINS_AF_PY "${CMAKE_BINARY_DIR}/pins_af.py")
484483
485484
if(EXISTS "${MICROPY_BOARDS_DIR}/${MICROPY_BOARD}/pins.csv")
486485
set(GEN_PINS_BOARD_CSV "${MICROPY_BOARDS_DIR}/${MICROPY_BOARD}/pins.csv")
@@ -495,7 +494,7 @@ target_sources(${MICROPY_TARGET} PRIVATE
495494
add_custom_command(
496495
OUTPUT ${GEN_PINS_HDR} ${GEN_PINS_SRC}
497496
COMMAND ${Python3_EXECUTABLE} ${GEN_PINS_MKPINS} ${GEN_PINS_CSV_ARG} --af ${GEN_PINS_AF_CSV} --prefix ${GEN_PINS_PREFIX}
498-
--hdr ${GEN_PINS_HDR} --af-py ${GEN_PINS_AF_PY} > ${GEN_PINS_SRC}
497+
--hdr ${GEN_PINS_HDR} > ${GEN_PINS_SRC}
499498
DEPENDS
500499
${GEN_PINS_AF_CSV}
501500
${GEN_PINS_BOARD_CSV}

ports/rp2/boards/make-pins.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,6 @@ def print_header(self, hdr_filename, obj_decls):
284284
)
285285
)
286286

287-
def print_af_py(self, af_py_filename):
288-
with open(af_py_filename, "wt") as af_py_file:
289-
print("PINS_AF = (", file=af_py_file)
290-
for named_pin in self.board_pins:
291-
print(" ('%s', " % named_pin.name(), end="", file=af_py_file)
292-
for af in named_pin.pin().alt_fn:
293-
if af.is_supported():
294-
print("(%d, '%s'), " % (af.idx, af.af_str), end="", file=af_py_file)
295-
print("),", file=af_py_file)
296-
print(")", file=af_py_file)
297-
298287

299288
def main():
300289
parser = argparse.ArgumentParser(
@@ -309,12 +298,6 @@ def main():
309298
help="Specifies the alternate function file for the chip",
310299
default="rp2_af.csv",
311300
)
312-
parser.add_argument(
313-
"--af-py",
314-
dest="af_py_filename",
315-
help="Specifies the filename for the python alternate function mappings.",
316-
default="build/pins_af.py",
317-
)
318301
parser.add_argument(
319302
"-b",
320303
"--board",
@@ -356,7 +339,6 @@ def main():
356339
print(prefix_file.read())
357340
pins.print()
358341
pins.print_header(args.hdr_filename, True)
359-
pins.print_af_py(args.af_py_filename)
360342

361343

362344
if __name__ == "__main__":

ports/stm32/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ GEN_PINS_SRC = $(BUILD)/pins_$(BOARD).c
7272
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
7373
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
7474
GEN_PINS_AF_DEFS = $(HEADER_BUILD)/pins_af_defs.h
75-
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
7675

7776
INSERT_USB_IDS = $(TOP)/tools/insert-usb-ids.py
7877
FILE2H = $(TOP)/tools/file2h.py
@@ -678,7 +677,7 @@ $(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(HEADER_
678677
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) \
679678
--prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --hdr-obj-decls \
680679
--af-const $(GEN_PINS_AF_CONST) --af-defs $(GEN_PINS_AF_DEFS) \
681-
--af-defs-cmp-strings --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)
680+
--af-defs-cmp-strings > $(GEN_PINS_SRC)
682681

683682
modmachine.c: $(GEN_PLLFREQTABLE_HDR)
684683
$(GEN_PLLFREQTABLE_HDR): $(PLLVALUES) | $(HEADER_BUILD)

ports/stm32/boards/make-pins.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -503,19 +503,6 @@ def print_af_defs(self, af_defs_filename, cmp_strings):
503503
print("\n".join(sorted(pins)), file=af_defs_file)
504504
print(" (0xffffffffffffffffULL))\n", file=af_defs_file)
505505

506-
def print_af_py(self, af_py_filename):
507-
with open(af_py_filename, "wt") as af_py_file:
508-
print("PINS_AF = (", file=af_py_file)
509-
for named_pin in self.board_pins:
510-
if named_pin.is_hidden():
511-
continue
512-
print(" ('%s', " % named_pin.name(), end="", file=af_py_file)
513-
for af in named_pin.pin().alt_fn:
514-
if af.is_supported():
515-
print("(%d, '%s'), " % (af.idx, af.af_str), end="", file=af_py_file)
516-
print("),", file=af_py_file)
517-
print(")", file=af_py_file)
518-
519506

520507
def main():
521508
parser = argparse.ArgumentParser(
@@ -536,12 +523,6 @@ def main():
536523
help="Specifies header file for alternate function constants.",
537524
default="build/pins_af_const.h",
538525
)
539-
parser.add_argument(
540-
"--af-py",
541-
dest="af_py_filename",
542-
help="Specifies the filename for the python alternate function mappings.",
543-
default="build/pins_af.py",
544-
)
545526
parser.add_argument(
546527
"--af-defs",
547528
dest="af_defs_filename",
@@ -604,7 +585,6 @@ def main():
604585
pins.print_adc(i)
605586
pins.print_header(args.hdr_filename, args.hdr_obj_decls)
606587
pins.print_af_hdr(args.af_const_filename)
607-
pins.print_af_py(args.af_py_filename)
608588
pins.print_af_defs(args.af_defs_filename, args.af_defs_cmp_strings)
609589

610590

0 commit comments

Comments
 (0)