Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnite committed Feb 26, 2024
1 parent edc3ef9 commit b519ca2
Show file tree
Hide file tree
Showing 278 changed files with 1,113 additions and 2,290 deletions.
67 changes: 5 additions & 62 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
name: Continuous Integration

env:
# Specify the current Zig version MicroZig uses:
ZIG_VERSION: 0.11.0
DEPLOYMENT_URL: "https://download.microzig.tech"
name: Build

on:
push:
Expand All @@ -12,68 +7,16 @@ on:
branches: [main]

jobs:
generate-packages:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true # required for "git describe"
fetch-depth: 0

- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}

- name: Install PIP packages
run: |
pip install -r tools/requirements.txt
- name: Generate and validate packages
run: |
./tools/bundle.py
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: microzig-deploy/

validate-packages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true # required for "git describe"
fetch-depth: 0

- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}

- name: Install PIP packages
run: |
pip install -r tools/requirements.txt
- name: Generate packages
run: |
./tools/bundle.py --debug
- name: Spawn local web server
uses: Eun/http-server-action@v1
with:
directory: "${{ github.workspace }}/microzig-deploy"
port: 8080
content-types: |
{
"gz": "application/gzip",
"json": "application/json"
}
version: master

- name: Validate examples
run: |
mkdir -p "${{ github.workspace }}/microzig-test"
./tools/validate-all-examples.sh --build-root "${{ github.workspace }}/microzig-test"
- name: Build
run: zig build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ microzig-deploy/
.direnv/
__pycache__/
.venv
boxzer-out
File renamed without changes.
41 changes: 0 additions & 41 deletions board-support/microchip-atsam/build.zig

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const MicroZig = @import("microzig-build");
const MicroZig = @import("microzig/build");

pub const microzig_board_support = MicroZig.registerBoardSupport(@This());

Expand Down Expand Up @@ -35,7 +35,7 @@ pub const chips = struct {
.name = "ESP32-C3",
.url = "https://www.espressif.com/en/products/socs/esp32-c3",

.cpu = .{ .custom = &esp_riscv },
.cpu = esp_riscv,

.register_definition = .{
.svd = path("/src/chips/ESP32-C3.svd"),
Expand Down
11 changes: 11 additions & 0 deletions bsp/espressif/esp/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "microzig/bsp/espressif/esp",
.version = "0.0.0",
.dependencies = .{
.@"microzig/build" = .{ .path = "../../../build" },
},
.paths = .{
"build.zig",
"build.zig.zon",
},
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const std = @import("std");
const MicroZig = @import("microzig-build");
const Build = std.Build;
const MicroZig = @import("microzig/build");

pub const microzig_board_support = MicroZig.registerBoardSupport(@This());

Expand All @@ -18,7 +19,7 @@ pub const chips = struct {
.preferred_format = .elf,
.chip = .{
.name = "GD32VF103",
.cpu = .riscv32_imac,
.cpu = MicroZig.cpus.riscv32_imac,
.memory_regions = &.{
.{ .offset = 0x08000000, .length = 128 * 1024, .kind = .flash },
.{ .offset = 0x20000000, .length = 32 * 1024, .kind = .ram },
Expand All @@ -34,7 +35,7 @@ pub const chips = struct {
.preferred_format = .elf,
.chip = .{
.name = "GD32VF103",
.cpu = .riscv32_imac,
.cpu = MicroZig.cpus.riscv32_imac,
.memory_regions = &.{
.{ .offset = 0x08000000, .length = 64 * 1024, .kind = .flash },
.{ .offset = 0x20000000, .length = 20 * 1024, .kind = .ram },
Expand Down Expand Up @@ -62,7 +63,7 @@ pub const boards = struct {
};
};

pub fn build(b: *std.build.Builder) void {
pub fn build(b: *Build) void {
_ = b;
// const optimize = b.standardOptimizeOption(.{});
// inline for (@typeInfo(boards).Struct.decls) |decl| {
Expand Down
11 changes: 11 additions & 0 deletions bsp/gigadevice/gd32/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "microzig/bsp/gigadevice/gd32",
.version = "0.0.0",
.dependencies = .{
.@"microzig/build" = .{ .path = "../../../build" },
},
.paths = .{
"build.zig",
"build.zig.zon",
},
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions bsp/microchip/atsam/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const std = @import("std");
const MicroZig = @import("microzig/build");

pub const microzig_board_support = MicroZig.registerBoardSupport(@This());

pub fn build(b: *std.Build) void {
_ = b;
// Dummy func to make package manager happy
}

fn root() []const u8 {
return comptime (std.fs.path.dirname(@src().file) orelse ".");
}

const build_root = root();

pub const chips = struct {
pub const atsamd51j19 = MicroZig.Target{
.preferred_format = .elf,
.chip = .{
.name = "ATSAMD51J19A",
.url = "https://www.microchip.com/en-us/product/ATSAMD51J19A",
.cpu = MicroZig.cpus.cortex_m4,
.register_definition = .{
.atdf = .{ .path = build_root ++ "/src/chips/ATSAMD51J19A.atdf" },
},
.memory_regions = &.{
.{ .kind = .flash, .offset = 0x00004000, .length = 512 * 1024 }, // Embedded Flash
.{ .kind = .ram, .offset = 0x20000000, .length = 192 * 1024 }, // Embedded SRAM
.{ .kind = .ram, .offset = 0x47000000, .length = 8 * 1024 }, // Backup SRAM
.{ .kind = .flash, .offset = 0x00804000, .length = 512 }, // NVM User Row
},
},
};
};

pub const boards = struct {
// empty right now
};
11 changes: 11 additions & 0 deletions bsp/microchip/atsam/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "microzig/bsp/microchip/atsam",
.version = "0.0.0",
.dependencies = .{
.@"microzig/build" = .{ .path = "../../../build" },
},
.paths = .{
"build.zig",
"build.zig.zon",
},
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const std = @import("std");
const MicroZig = @import("microzig-build");
const Build = std.Build;
const MicroZig = @import("microzig/build");

pub const microzig_board_support = MicroZig.registerBoardSupport(@This());

fn path(comptime suffix: []const u8) std.Build.LazyPath {
fn path(comptime suffix: []const u8) Build.LazyPath {
return .{
.cwd_relative = comptime ((std.fs.path.dirname(@src().file) orelse ".") ++ suffix),
};
Expand All @@ -19,7 +20,7 @@ pub const chips = struct {
.chip = .{
.name = "ATmega328P",
.url = "https://www.microchip.com/en-us/product/atmega328p",
.cpu = .avr5,
.cpu = MicroZig.cpus.avr5,
.register_definition = .{
.json = path("/src/chips/ATmega328P.json"),
},
Expand Down Expand Up @@ -58,7 +59,7 @@ pub const boards = struct {
};
};

pub fn build(b: *std.build.Builder) void {
pub fn build(b: *Build) void {
_ = b;
// const optimize = b.standardOptimizeOption(.{});
// inline for (@typeInfo(boards).Struct.decls) |decl| {
Expand Down
11 changes: 11 additions & 0 deletions bsp/microchip/avr/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "microzig/bsp/microchip/avr",
.version = "0.0.0",
.dependencies = .{
.@"microzig/build" = .{ .path = "../../../build" },
},
.paths = .{
"build.zig",
"build.zig.zon",
},
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const std = @import("std");
const MicroZig = @import("microzig-build");
const Build = std.Build;
const MicroZig = @import("microzig/build");

pub const microzig_board_support = MicroZig.registerBoardSupport(@This());

Expand All @@ -15,7 +16,7 @@ pub const chips = struct {
.chip = .{
.name = "nrf52840",
.url = "https://www.nordicsemi.com/products/nrf52840",
.cpu = .cortex_m4,
.cpu = MicroZig.cpus.cortex_m4,
.register_definition = .{
.json = path("/src/chips/nrf52840.json"),
},
Expand All @@ -37,7 +38,7 @@ pub const chips = struct {
.chip = .{
.name = "nrf52",
.url = "https://www.nordicsemi.com/products/nrf52832",
.cpu = .cortex_m4,
.cpu = MicroZig.cpus.cortex_m4,
.register_definition = .{
.json = path("/src/chips/nrf52.json"),
},
Expand All @@ -63,6 +64,6 @@ pub const boards = struct {
};
};

pub fn build(b: *std.build.Builder) void {
pub fn build(b: *Build) void {
_ = b;
}
12 changes: 12 additions & 0 deletions bsp/nordic/nrf5x/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.{
.name = "microzig/bsp/nordic/nrf5x",
.version = "0.0.0",
.dependencies = .{
.@"microzig/build" = .{ .path = "../../../build" },
},
.paths = .{
"build.zig",
"build.zig.zon",
},
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions board-support/nxp-lpc/build.zig → bsp/nxp/lpc/build.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const MicroZig = @import("microzig-build");
const MicroZig = @import("microzig/build");

pub const microzig_board_support = MicroZig.registerBoardSupport(@This());

Expand All @@ -19,7 +19,7 @@ pub const chips = struct {
.chip = .{
// TODO: Separate over those chips, this is not generic!
.name = "LPC176x5x",
.cpu = .cortex_m3,
.cpu = MicroZig.cpus.cortex_m3,
.memory_regions = &.{
.{ .offset = 0x00000000, .length = 512 * 1024, .kind = .flash },
.{ .offset = 0x10000000, .length = 32 * 1024, .kind = .ram },
Expand Down Expand Up @@ -56,6 +56,7 @@ fn postprocess(b: *std.Build, input: std.Build.LazyPath) std.Build.LazyPath {
const patchelf = b.addExecutable(.{
.name = "lpc176x5x-patchelf",
.root_source_file = path("/src/tools/patchelf.zig"),
.target = b.host,
});

const patch = b.addRunArtifact(patchelf);
Expand Down
11 changes: 11 additions & 0 deletions bsp/nxp/lpc/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "microzig/bsp/nxp/lpc",
.version = "0.0.0",
.dependencies = .{
.@"microzig/build" = .{ .path = "../../../build" },
},
.paths = .{
"build.zig",
"build.zig.zon",
},
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b519ca2

Please sign in to comment.