Closed
Description
Zig Version
0.12.0-dev.3475+71d878ba5
Steps to Reproduce and Observed Behavior
- Clone
https://github.com/ZigEmbeddedGroup/microzig.git
- Check out
zig-master
branch - Build with
zig build -Doptimize=ReleaseSmall
Expected Behavior
I expected it to compile without error. Here is one of the failing examples, each is a use of rp2040.pio.assemble()
:
const squarewave_program = blk: {
@setEvalBranchQuota(2000);
break :blk rp2040.pio.assemble(
\\;
\\; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
\\;
\\; SPDX-License-Identifier: BSD-3-Clause
\\;
\\.program squarewave
\\ set pindirs, 1 ; Set pin to output
\\again:
\\ set pins, 1 [1] ; Drive pin high and then delay for one cycle
\\ set pins, 0 ; Drive pin low
\\ jmp again ; Set PC to label `again`
, .{}).get_program_by_name("squarewave");
};
This uses a comptime assembler that has been correctly working for about a year, including the embedded Zig workshop I ran in the Vancouver SYCL conf (Fun fact, this comptime assembler was part of getting the sound to work for the synthesizers). Despite it sounding insane, it's implemented sanely. There are two uses of comptime var
under rp2040.pio.assemble()
and removing them produces the same error message so AFAICT this is a compiler bug.