Skip to content

Commit 96cbe8b

Browse files
committed
add public_labels to pio_kwargs
fix black formater
1 parent 2bc0deb commit 96cbe8b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

adafruit_pioasm.py

Lines changed: 8 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,10 @@ 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(
85+
instructions
86+
)
8287
elif line:
8388
# Only add as an instruction if the line isn't empty
8489
instructions.append(line)
@@ -241,6 +246,9 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
241246
if wrap_target is not None:
242247
self.pio_kwargs["wrap_target"] = wrap_target
243248

249+
if public_labels:
250+
self.pio_kwargs["public_labels"] = public_labels
251+
244252
self.assembled = array.array("H", assembled)
245253

246254
if build_debuginfo:

0 commit comments

Comments
 (0)