This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
generated from ZigEmbeddedGroup/hardware-support-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Microzig Generation 2 Build Interface (#26)
* Drops microzig dependency * Starts to port to MicroZig Build Gen 2 * Drops CI --------- Co-authored-by: Felix "xq" Queißner <[email protected]>
- Loading branch information
Showing
6 changed files
with
78 additions
and
1,459 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,84 @@ | ||
const std = @import("std"); | ||
const microzig = @import("microzig"); | ||
|
||
pub const boards = @import("src/boards.zig"); | ||
pub const chips = @import("src/chips.zig"); | ||
fn path(comptime suffix: []const u8) std.Build.LazyPath { | ||
return .{ | ||
.cwd_relative = comptime ((std.fs.path.dirname(@src().file) orelse ".") ++ suffix), | ||
}; | ||
} | ||
|
||
pub fn build(b: *std.build.Builder) void { | ||
const optimize = b.standardOptimizeOption(.{}); | ||
inline for (@typeInfo(boards).Struct.decls) |decl| { | ||
const exe = microzig.addEmbeddedExecutable(b, .{ | ||
.name = @field(boards, decl.name).name ++ ".minimal", | ||
.source_file = .{ | ||
.path = "test/programs/minimal.zig", | ||
const hal = .{ | ||
.source_file = path("/src/hals/ATmega328P.zig"), | ||
}; | ||
|
||
pub const chips = struct { | ||
pub const atmega328p = .{ | ||
.preferred_format = .hex, | ||
.chip = .{ | ||
.name = "ATmega328P", | ||
.url = "https://www.microchip.com/en-us/product/atmega328p", | ||
.cpu = .avr5, | ||
.register_definition = .{ | ||
.json = path("/src/chips/ATmega328P.json"), | ||
}, | ||
.backing = .{ .board = @field(boards, decl.name) }, | ||
.optimize = optimize, | ||
}); | ||
exe.installArtifact(b); | ||
} | ||
.memory_regions = &.{ | ||
.{ .offset = 0x000000, .length = 32 * 1024, .kind = .flash }, | ||
.{ .offset = 0x800100, .length = 2048, .kind = .ram }, | ||
}, | ||
}, | ||
.hal = hal, | ||
}; | ||
}; | ||
|
||
inline for (@typeInfo(chips).Struct.decls) |decl| { | ||
const exe = microzig.addEmbeddedExecutable(b, .{ | ||
.name = @field(chips, decl.name).name ++ ".minimal", | ||
.source_file = .{ | ||
.path = "test/programs/minimal.zig", | ||
pub const boards = struct { | ||
pub const arduino = struct { | ||
pub const nano = .{ | ||
.preferred_format = .hex, | ||
.chip = chips.atmega328p.chip, | ||
.hal = hal, | ||
.board = .{ | ||
.name = "Arduino Nano", | ||
.url = "https://docs.arduino.cc/hardware/nano", | ||
.source_file = path("/src/boards/arduino_nano.zig"), | ||
}, | ||
.backing = .{ .chip = @field(chips, decl.name) }, | ||
.optimize = optimize, | ||
}); | ||
exe.installArtifact(b); | ||
} | ||
}; | ||
|
||
pub const uno_rev3 = .{ | ||
.preferred_format = .hex, | ||
.chip = chips.atmega328p.chip, | ||
.hal = hal, | ||
.board = .{ | ||
.name = "Arduino Uno", | ||
.url = "https://docs.arduino.cc/hardware/uno-rev3", | ||
.source_file = path("/src/boards/arduino_uno.zig"), | ||
}, | ||
}; | ||
}; | ||
}; | ||
|
||
pub fn build(b: *std.build.Builder) void { | ||
_ = b; | ||
// const optimize = b.standardOptimizeOption(.{}); | ||
// inline for (@typeInfo(boards).Struct.decls) |decl| { | ||
// const exe = microzig.addEmbeddedExecutable(b, .{ | ||
// .name = @field(boards, decl.name).name ++ ".minimal", | ||
// .source_file = .{ | ||
// .path = "test/programs/minimal.zig", | ||
// }, | ||
// .backing = .{ .board = @field(boards, decl.name) }, | ||
// .optimize = optimize, | ||
// }); | ||
// exe.installArtifact(b); | ||
// } | ||
|
||
// inline for (@typeInfo(chips).Struct.decls) |decl| { | ||
// const exe = microzig.addEmbeddedExecutable(b, .{ | ||
// .name = @field(chips, decl.name).name ++ ".minimal", | ||
// .source_file = .{ | ||
// .path = "test/programs/minimal.zig", | ||
// }, | ||
// .backing = .{ .chip = @field(chips, decl.name) }, | ||
// .optimize = optimize, | ||
// }); | ||
// exe.installArtifact(b); | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
.{ | ||
.name = "microzig-espressif-esp", | ||
.version = "0.1.0", | ||
.dependencies = .{ | ||
.microzig = .{ | ||
.url = "https://github.com/ZigEmbeddedGroup/microzig/archive/0b3be0a4cc7e6d45714cb09961efc771e364723c.tar.gz", | ||
.hash = "1220ada6d01db7b3d0aa8642df89b1af9ee71b681438249e9a7efb2275fc4cf32152", | ||
}, | ||
}, | ||
.dependencies = .{}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.