Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Better support for creating user board targets

Aperta
#919 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma

Direzione di ricerca

The payload centres on the custom board setup in build.zig, which calls mb.ports.rp2xxx.chips.rp2040.derive with pico_board.imports, and on boards/xiao_rp2040.zig, which imports shared/rp2040_bootrom.zig. Start by reading how the pico board's bootrom import is exposed through MicroBuild, then decide how a user board could reuse the generated bootrom without copying the file. Done means a design decision on the API, which the thread has not yet reached.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When attempting to create a custom, project-specific board target for the XIAO RP2040 I found that it was very difficult to reuse parts from predefined boards that use the RP2040 chip. More specifically, it required a very roundabout way to setup the bootloader.

build.zig:

const std = @import("std");
const microzig = @import("microzig");

const MicroBuild = microzig.MicroBuild(.{
    .rp2xxx = true,
});

pub fn build(b: *std.Build) void {
    const mz_dep = b.dependency("microzig", .{});
    const mb = MicroBuild.init(b, mz_dep) orelse return;

    const pico_board = mb.ports.rp2xxx.boards.raspberrypi.pico.board orelse return;
    const target = mb.ports.rp2xxx.chips.rp2040.derive(.{
        .board = .{
            .name = "XIAO RP2040",
            .root_source_file = b.path("boards/xiao_rp2040.zig"),
            .imports = pico_board.imports,
        },
    });

    const firmware = mb.add_firmware(.{
        .name = "main",
        .target = target,
        .optimize = .ReleaseSmall,
        .root_source_file = b.path("src/main.zig"),
    });

    mb.install_firmware(firmware, .{});
}

boards/xiao_rp2040.zig:

const microzig = @import("microzig");
const hal = microzig.hal;

pub const xosc_freq = 12_000_000;

pub const bootrom = @import("shared/rp2040_bootrom.zig");

comptime {
    _ = bootrom;
}

pub const pin_config = hal.pins.GlobalConfiguration{
    .GPIO12 = .{ .name = "rgb_led", .direction = .out },
    .GPIO17 = .{ .name = "user_led_r", .direction = .out },
    .GPIO16 = .{ .name = "user_led_g", .direction = .out },
    .GPIO25 = .{ .name = "user_led_b", .direction = .out },
};

I find I'm having to reference the generated bootloader for rp2040 boards though other boards (here the rp pico) and copy over the rp2040_bootrom.zig to my project for it to compile, which feels convoluted. Is it possible to streamline this process by, for example, exposing the bootloader generation to the user?

Lingua principale
Zig
Stelle
2.3k
Fork
198
Merge medio
1g 8h
PR unite (30g)
37

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ZigEmbeddedGroup/microzig

Tutte le issue di ZigEmbeddedGroup/microzig

Issue simili

Altre issue su Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.