Makes AVR example fit, but still crashes compiler

wch-ch32v003
Felix "xq" Queißner 8 months ago
parent 2878ae6e19
commit 1643c30d7d

@ -44,3 +44,37 @@ jobs:
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"
- name: Fetch more data from git
run: |
# fetch everything back till the $(ZIG_VERSION) tag.
# https://stackoverflow.com/a/58082274
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
git fetch --deepen=2
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Install PIP packages
run: |
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec
- name: Generate and validate packages
run: |
./tools/bundle.py
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: microzig-deploy/

@ -523,6 +523,7 @@ pub const BuildEnvironment = struct {
if (options.target.configure) |configure| {
configure(fw.env, fw);
}
return fw;
}

@ -102,13 +102,13 @@ fn make_isr_handler(comptime name: []const u8, comptime func: anytype) type {
}
pub const startup_logic = struct {
export fn microzig_unhandled_vector() callconv(.Naked) noreturn {
export fn microzig_unhandled_vector() callconv(.C) noreturn {
@panic("Unhandled interrupt");
}
extern fn microzig_main() noreturn;
export fn microzig_start() callconv(.Naked) noreturn {
export fn microzig_start() callconv(.C) noreturn {
// At startup the stack pointer is at the end of RAM
// so, no need to set it manually!

@ -1,14 +0,0 @@
.{
.name = "microzig-microchip-atmega-examples",
.version = "0.1.0",
.dependencies = .{
.microzig = .{
.url = "https://github.com/ZigEmbeddedGroup/microzig/archive/c6c9ec4516f57638e751141085c9d76120990312.tar.gz",
.hash = "1220af58bdaa721b8189f3a7adfda660517dd354463463388e96d69fe4ceccf80b92",
},
.atmega = .{
.url = "https://github.com/ZigEmbeddedGroup/microchip-atmega/archive/feefcb87a63c0aae31afb783d4e388e90c4d922f.tar.gz",
.hash = "1220048dc5d22729ee119a496f8b8ca3556838af1f3bd32ce6acd5f76480ec942965",
},
},
}

@ -1,15 +1,21 @@
const std = @import("std");
const atmega = @import("atmega");
const MicroZig = @import("microzig-build");
const available_examples = [_]Example{
// TODO: .{ .name = "arduino-nano_blinky", .target = atmega.boards.arduino.nano, .file = "src/blinky.zig" },
.{ .target = "board:arduino/nano", .name = "arduino-nano_blinky", .file = "src/blinky.zig" },
.{ .target = "board:arduino/uno_rev3", .name = "arduino-nano_blinky", .file = "src/blinky.zig" },
};
pub fn build(b: *std.Build) void {
const microzig = @import("microzig").init(b, "microzig");
const optimize = .ReleaseSmall; // The others are not really an option on AVR
const microzig = MicroZig.createBuildEnvironment(b, .{});
const optimize = b.standardOptimizeOption(.{});
const show_targets_step = b.step("show-targets", "Shows all available MicroZig targets");
show_targets_step.dependOn(microzig.getShowTargetsStep());
for (available_examples) |example| {
const target = microzig.findTarget(example.target).?;
// `addFirmware` basically works like addExecutable, but takes a
// `microzig.Target` for target instead of a `std.zig.CrossTarget`.
//
@ -17,7 +23,7 @@ pub fn build(b: *std.Build) void {
// cpu and potentially the board as well.
const firmware = microzig.addFirmware(b, .{
.name = example.name,
.target = example.target,
.target = target,
.optimize = optimize,
.source_file = .{ .path = example.file },
});
@ -34,7 +40,7 @@ pub fn build(b: *std.Build) void {
}
const Example = struct {
target: @import("microzig").Target,
target: []const u8,
name: []const u8,
file: []const u8,
};

@ -0,0 +1,7 @@
{
"package_name": "microchip/avr",
"package_type": "example",
"inner_dependencies": [
"microchip/avr"
]
}

@ -7,7 +7,7 @@ tmpdir="/tmp/microzig-test"
mkdir -p "${tmpdir}"
examples="espressif/esp stmicro/stm32 nordic/nrf5x gigadevice/gd32 raspberrypi/rp2040 nxp/lpc microchip/atsam"
examples="espressif/esp stmicro/stm32 nordic/nrf5x gigadevice/gd32 raspberrypi/rp2040 nxp/lpc microchip/atsam" # microchip/avr (does not build with 0.11)
for key in ${examples}; do
"${root}/validate-example.py" --build-root "${tmpdir}" --example "$key"

Loading…
Cancel
Save