Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Using comptime function that require option will end in declaration loop

Offen
#797 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
22/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Bereich
embedded-iot

Rechercherichtung

The payload names no file paths. Start from the DMA function in the snippet and from where microzig_options redefines std_option, since the declaration loop comes from that shadowing. Reproduce by putting a DMA_Handler that calls std.fmt.comptimePrint inside microzig_options. Done means that build compiles without the declaration loop error, or the issue records why the shadowed std_option cannot be avoided.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement

Microzig redefine the std_option with specific entry for embedded device. Like interrupt or chip/hal config.
By doing so it allow users to fine tune the MCU. This have some limitation on how microzig_options can be initialized.

std_option is being shadow and whenever attribute inside the microzig_options need std_option it will trigger a declaration loop error.

This happen for example when you want to format string:

pub fn DMA(index: u32, channel: u32) type {

    // /!\   This line will trigger the declaration loop if you include the DMA_Handler
   // inside the microzig_option since this comptimePrint needs std_option.
    const interrupt_name = std.fmt.comptimePrint("DMA{}_Channel{}", .{ index, ch});
    const interrupt_index = blk: for (microzig.chip.interrupts) |*interrupt| {
        if (std.mem.eql(u8, interrupt_name, interrupt.name)) {
            break :blk interrupt.index;
        }
    } else @panic("Interrupt index not found");

    return struct {
        var channel: ?Channel = null;

        pub fn DMA_Handler() callconv(.c) void {
            const event = read_events();
            clear_events(event);
            if (channel) |*init_chan| {
                init_chan.deliver_event(event);
            }
        }
       ...
    }
 ...
}
Vorherrschende Sprache
Zig
Sterne
2.3k
Forks
198
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
37

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ZigEmbeddedGroup/microzig

Alle Issues in ZigEmbeddedGroup/microzig

Ähnliche Issues

Weitere Issues zu Embedded & IoT

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.