Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 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,10 @@ 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 @@ -241,6 +246,9 @@ def __init__(self, text_program: str, *, build_debuginfo=False) -> None:
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)

if build_debuginfo:
Expand Down