nrf/boards/make-pins.py: Don't generate qstrs.

The output pins.c can be processed for qstrs like any other C file.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/12211/head
Jim Mussared 2023-08-03 15:25:44 +10:00 zatwierdzone przez Damien George
rodzic fc54d25a45
commit 3f99dbd634
2 zmienionych plików z 4 dodań i 36 usunięć

Wyświetl plik

@ -51,7 +51,7 @@ endif
-include boards/$(BOARD)/modules/boardmodules.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h $(GEN_PINS_QSTR)
QSTR_DEFS = qstrdefsport.h
# MicroPython feature configurations
ifeq ($(DEBUG), 0)
@ -118,7 +118,6 @@ AF_FILE = $(MCU_VARIANT)_af.csv
PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
GEN_PINS_SRC = $(BUILD)/pins_gen.c
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
@ -528,7 +527,7 @@ $(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
$(Q)$(SIZE) $@
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_SHARED_C) $(DRIVERS_SRC_C) $(SRC_BOARD_MODULES)
SRC_QSTR += $(SRC_C) $(SRC_SHARED_C) $(DRIVERS_SRC_C) $(SRC_BOARD_MODULES) $(GEN_PINS_SRC)
# Append any auto-generated sources that are needed by sources listed in
# SRC_QSTR
@ -543,9 +542,9 @@ $(OBJ): | $(HEADER_BUILD)/pins.h
# Use a pattern rule here so that make will only call make-pins.py once to make
# both pins_gen.c and pins.h
$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/%_qstr.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)
$(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)
$(PY_BUILD)/nlr%.o: CFLAGS += -Os -fno-lto

Wyświetl plik

@ -82,9 +82,6 @@ class AlternateFunction(object):
)
)
def qstr_list(self):
return [self.mux_name()]
class Pin(object):
"""Holds the information associated with a pin."""
@ -182,13 +179,6 @@ class Pin(object):
"extern const pin_af_obj_t pin_{:s}_af[];\n".format(self.cpu_pin_name())
)
def qstr_list(self):
result = []
for alt_fn in self.alt_fn:
if alt_fn.is_supported():
result += alt_fn.qstr_list()
return result
class NamedPin(object):
def __init__(self, name, pin):
@ -312,19 +302,6 @@ class Pins(object):
hdr_file.write("extern const pin_obj_t * const pin_adc2[];\n")
hdr_file.write("extern const pin_obj_t * const pin_adc3[];\n")
def print_qstr(self, qstr_filename):
with open(qstr_filename, "wt") as qstr_file:
qstr_set = set([])
for named_pin in self.cpu_pins:
pin = named_pin.pin()
if pin.is_board_pin():
qstr_set |= set(pin.qstr_list())
qstr_set |= set([named_pin.name()])
for named_pin in self.board_pins:
qstr_set |= set([named_pin.name()])
for qstr in sorted(qstr_set):
print("Q({})".format(qstr), file=qstr_file)
def print_af_hdr(self, af_const_filename):
with open(af_const_filename, "wt") as af_const_file:
af_hdr_set = set([])
@ -393,13 +370,6 @@ def main():
help="Specifies beginning portion of generated pins file",
default="nrf52_prefix.c",
)
parser.add_argument(
"-q",
"--qstr",
dest="qstr_filename",
help="Specifies name of generated qstr header file",
default="build/pins_qstr.h",
)
parser.add_argument(
"-r",
"--hdr",
@ -430,7 +400,6 @@ def main():
pins.print_const_table()
pins.print()
pins.print_header(args.hdr_filename)
pins.print_qstr(args.qstr_filename)
pins.print_af_hdr(args.af_const_filename)
pins.print_af_py(args.af_py_filename)