Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Using comptime function that require option will end in declaration loop

Abierto
#797 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
22/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Área
embedded-iot

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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);
            }
        }
       ...
    }
 ...
}
Lenguaje dominante
Zig
Estrellas
2.3k
Forks
198
Merge medio
1 d 8 h
PR fusionados (30 d)
37

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ZigEmbeddedGroup/microzig

Todos los issues de ZigEmbeddedGroup/microzig

Issues similares

Más issues de Embedded & IoT

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.