Skip to content

Commit 27d3d59

Browse files
GebhartjJan Gebhart
authored and
Jan Gebhart
committed
add public_labels to pio_kwargs
1 parent 2bc0deb commit 27d3d59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

adafruit_pioasm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
4646
assembled = []
4747
program_name = None
4848
labels = {}
49+
public_labels = {}
4950
linemap = []
5051
instructions = []
5152
sideset_count = 0
@@ -79,6 +80,8 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
7980
if label in labels:
8081
raise SyntaxError(f"Duplicate label {repr(label)}")
8182
labels[label] = len(instructions)
83+
if line.startswith("public "):
84+
public_labels[(line.split("public ")[1]).split(":")[0]] = len(instructions)
8285
elif line:
8386
# Only add as an instruction if the line isn't empty
8487
instructions.append(line)
@@ -240,6 +243,9 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
240243
self.pio_kwargs["wrap"] = wrap
241244
if wrap_target is not None:
242245
self.pio_kwargs["wrap_target"] = wrap_target
246+
247+
if public_labels:
248+
self.pio_kwargs["public_labels"] = public_labels
243249

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

0 commit comments

Comments
 (0)