Skip to content

Commit

Permalink
add public_labels to pio_kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gebhartj authored and gebhart0666 committed Jan 24, 2024
1 parent 2bc0deb commit 27d3d59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions adafruit_pioasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
assembled = []
program_name = None
labels = {}
public_labels = {}
linemap = []
instructions = []
sideset_count = 0
Expand Down Expand Up @@ -79,6 +80,8 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
if label in labels:
raise SyntaxError(f"Duplicate label {repr(label)}")
labels[label] = len(instructions)
if line.startswith("public "):
public_labels[(line.split("public ")[1]).split(":")[0]] = len(instructions)
elif line:
# Only add as an instruction if the line isn't empty
instructions.append(line)
Expand Down Expand Up @@ -240,6 +243,9 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
self.pio_kwargs["wrap"] = wrap
if wrap_target is not None:
self.pio_kwargs["wrap_target"] = wrap_target

if public_labels:
self.pio_kwargs["public_labels"] = public_labels

self.assembled = array.array("H", assembled)

Expand Down

0 comments on commit 27d3d59

Please sign in to comment.