commit 488cb11650bea6350ddc2ffe6a0db15a89627ae0 Author: Matt Knight Date: Sat Feb 18 17:06:25 2023 -0500 Initial commit diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 0000000..7767bbb --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,4 @@ +steps: + - group: Build + steps: + - command: zig build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c82b07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +zig-cache +zig-out diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..32e895c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/microzig"] + path = deps/microzig + url = https://github.com/ZigEmbeddedGroup/microzig.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c1cc5ec --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2022 + +This software is provided 'as-is', without any express or implied warranty. In +no event will the authors be held liable for any damages arising from the use +of this software. + +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim +that you wrote the original software. If you use this software in a product, an +acknowledgment in the product documentation would be appreciated but is not +required. + +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..46ca057 --- /dev/null +++ b/README.adoc @@ -0,0 +1,6 @@ += Hardware Support Package Template + +1. Update LICENSE file +2. Update `microzig` submodule under `deps/` +3. Add chips/boards/hals +4. Set up buildkite pipeline diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..3b787fe --- /dev/null +++ b/build.zig @@ -0,0 +1,35 @@ +const std = @import("std"); +const microzig = @import("deps/microzig/src/main.zig"); +const boards = @import("src/boards.zig"); +const chips = @import("src/chips.zig"); + +pub fn build(b: *std.build.Builder) void { + const optimize = b.standardOptimizeOption(.{}); + inline for (@typeInfo(boards).Struct.decls) |decl| { + if (!decl.is_pub) + continue; + + const exe = microzig.addEmbeddedExecutable( + b, + @field(boards, decl.name).name ++ ".minimal", + "test/programs/minimal.zig", + .{ .board = @field(boards, decl.name) }, + .{ .optimize = optimize }, + ); + exe.install(); + } + + inline for (@typeInfo(chips).Struct.decls) |decl| { + if (!decl.is_pub) + continue; + + const exe = microzig.addEmbeddedExecutable( + b, + @field(chips, decl.name).name ++ ".minimal", + "test/programs/minimal.zig", + .{ .chip = @field(chips, decl.name) }, + .{ .optimize = optimize }, + ); + exe.install(); + } +} diff --git a/deps/microzig b/deps/microzig new file mode 160000 index 0000000..97ca549 --- /dev/null +++ b/deps/microzig @@ -0,0 +1 @@ +Subproject commit 97ca5497da0f22d025e18bced9311efed088d893 diff --git a/src/boards.zig b/src/boards.zig new file mode 100644 index 0000000..2cb647a --- /dev/null +++ b/src/boards.zig @@ -0,0 +1,6 @@ +const std = @import("std"); +const microzig = @import("../deps/microzig/src/main.zig"); + +fn root_dir() []const u8 { + return std.fs.path.dirname(@src().file) orelse "."; +} diff --git a/src/chips.zig b/src/chips.zig new file mode 100644 index 0000000..2cb647a --- /dev/null +++ b/src/chips.zig @@ -0,0 +1,6 @@ +const std = @import("std"); +const microzig = @import("../deps/microzig/src/main.zig"); + +fn root_dir() []const u8 { + return std.fs.path.dirname(@src().file) orelse "."; +} diff --git a/test/programs/minimal.zig b/test/programs/minimal.zig new file mode 100644 index 0000000..5258ce3 --- /dev/null +++ b/test/programs/minimal.zig @@ -0,0 +1,5 @@ +const micro = @import("microzig"); + +pub fn main() void { + // This function will contain the application logic. +}