Skip to content

Commit 12ff1b7

Browse files
committed
updates for zig 0.12.0
1 parent 09542f5 commit 12ff1b7

File tree

117 files changed

+47523
-45699
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+47523
-45699
lines changed

.github/workflows/build.yml

+23-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ name: Build
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, zig-master]
66
pull_request:
77
branches: [main]
8+
schedule:
9+
- cron: "0 0 * * *"
810

911
jobs:
1012
build:
@@ -23,10 +25,27 @@ jobs:
2325
- name: Setup Zig
2426
uses: goto-bus-stop/setup-zig@v2
2527
with:
26-
version: master
28+
version: 0.12.0
2729

2830
- name: Build
2931
run: zig build -Doptimize=ReleaseSmall
30-
32+
33+
- name: Unit Test BSPs
34+
run: zig build run-bsp-tests -Doptimize=ReleaseSmall
35+
3136
- name: Dry run packaging
32-
run: zig build package -- https://example.com
37+
if: ${{ matrix.os == 'macos-latest' }}
38+
run: |
39+
MICROZIG_VERSION=$(zig build package -- get-version)
40+
echo microzig version: $MICROZIG_VERSION
41+
zig build package -- http://localhost:8000
42+
python3 -m http.server 8000 --directory boxzer-out &
43+
sleep 1
44+
45+
cd tools/package-test
46+
zig fetch --save=microzig http://localhost:8000/microzig-${MICROZIG_VERSION}.tar.gz
47+
zig build -Doptimize=ReleaseSmall
48+
zig build run-bsp-tests
49+
50+
# clean up server
51+
jobs -p | xargs kill

.github/workflows/deploy.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,41 @@ on:
1010

1111
jobs:
1212
deploy-packages:
13-
runs-on: ubuntu-latest
13+
runs-on: macos-latest
1414
steps:
1515
- name: Extract tag name
1616
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
1717

1818
- name: Checkout
1919
uses: actions/checkout@v4
2020
with:
21-
fetch-tags: true # required for "git describe"
2221
fetch-depth: 0
2322

2423
- name: Setup Zig
2524
uses: goto-bus-stop/setup-zig@v2
2625
with:
27-
version: master
26+
version: 0.12.0
27+
28+
- name: Extract version
29+
run: echo "MICROZIG_VERSION=$(zig build package -- get-version)" >> $GITHUB_ENV
2830

2931
- name: Assemble Packages
3032
run: zig build package -- "${{ secrets.DOWNLOADS_URL }}"
3133

32-
# TODO: Validation
33-
3434
- name: Deploy
3535
uses: easingthemes/ssh-deploy@main
3636
with:
3737
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }}
3838
ARGS: "-vzrli"
39-
SOURCE: "boxzer-out/${{ env.TAG_NAME }}/"
39+
SOURCE: "boxzer-out/"
4040
REMOTE_HOST: ${{ secrets.DEPLOY_HOST }}
4141
REMOTE_USER: ${{ secrets.DEPLOY_USER }}
4242
REMOTE_PORT: ${{ secrets.DEPLOY_PORT }}
4343
TARGET: "."
4444

45+
- name: Create Release Draft
46+
uses: ncipollo/release-action@v1
47+
with:
48+
artifactErrorsFailBuild: true
49+
draft: true
50+
generateReleaseNotes: true

LICENSE

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
MIT License
1+
Copyright (c) Zig Embedded Group contributors
22

3-
Copyright (c) 2022 Zig Embedded Group
3+
This software is provided 'as-is', without any express or implied warranty. In
4+
no event will the authors be held liable for any damages arising from the use
5+
of this software.
46

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
7+
Permission is granted to anyone to use this software for any purpose, including
8+
commercial applications, and to alter it and redistribute it freely, subject to
9+
the following restrictions:
1110

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
11+
1. The origin of this software must not be misrepresented; you must not claim
12+
that you wrote the original software. If you use this software in a product,
13+
an acknowledgment in the product documentation would be appreciated but is
14+
not required.
1415

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
16+
2. Altered source versions must be plainly marked as such, and must not be
17+
misrepresented as being the original software.
18+
19+
3. This notice may not be removed or altered from any source distribution.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
## What version of Zig to use
1010

11-
Zig master/nightly
11+
Zig 0.12.0
1212

1313
## Getting Started With MicroZig
1414

bsp/espressif/esp/LICENSE

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
MIT License
1+
Copyright (c) Zig Embedded Group contributors
22

3-
Copyright (c) 2022 Zig Embedded Group
3+
This software is provided 'as-is', without any express or implied warranty. In
4+
no event will the authors be held liable for any damages arising from the use
5+
of this software.
46

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
7+
Permission is granted to anyone to use this software for any purpose, including
8+
commercial applications, and to alter it and redistribute it freely, subject to
9+
the following restrictions:
1110

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
11+
1. The origin of this software must not be misrepresented; you must not claim
12+
that you wrote the original software. If you use this software in a product,
13+
an acknowledgment in the product documentation would be appreciated but is
14+
not required.
1415

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
16+
2. Altered source versions must be plainly marked as such, and must not be
17+
misrepresented as being the original software.
18+
19+
3. This notice may not be removed or altered from any source distribution.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
= ESP MicroZig Package
1+
# ESP MicroZig Package
22

33
[WIP]
44

55
SVD is copied from https://github.com/esp-rs/esp-pacs
6-
7-
== What version of Zig to use
8-
9-
0.11.0

bsp/espressif/esp/build.zig

+4-30
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const std = @import("std");
22
const MicroZig = @import("microzig/build");
33

4-
pub const microzig_board_support = MicroZig.registerBoardSupport(@This());
5-
64
fn path(comptime suffix: []const u8) std.Build.LazyPath {
75
return .{
86
.cwd_relative = comptime ((std.fs.path.dirname(@src().file) orelse ".") ++ suffix),
@@ -11,7 +9,7 @@ fn path(comptime suffix: []const u8) std.Build.LazyPath {
119

1210
const esp_riscv = .{
1311
.name = "Espressif RISC-V",
14-
.source_file = path("/src/cpus/espressif-riscv.zig"),
12+
.root_source_file = path("/src/cpus/espressif-riscv.zig"),
1513
.target = std.zig.CrossTarget{
1614
.cpu_arch = .riscv32,
1715
.cpu_model = .{ .explicit = &std.Target.riscv.cpu.generic_rv32 },
@@ -25,7 +23,7 @@ const esp_riscv = .{
2523
};
2624

2725
const hal = .{
28-
.source_file = path("/src/hals/ESP32_C3.zig"),
26+
.root_source_file = path("/src/hals/ESP32_C3.zig"),
2927
};
3028

3129
pub const chips = struct {
@@ -50,32 +48,8 @@ pub const chips = struct {
5048
};
5149
};
5250

53-
pub const boards = struct {
54-
// empty right now
55-
};
51+
pub const boards = struct {};
5652

5753
pub fn build(b: *std.Build) void {
58-
_ = b;
59-
// const optimize = b.standardOptimizeOption(.{});
60-
61-
// var exe = microzig.addEmbeddedExecutable(b, .{
62-
// .name = "esp-bringup",
63-
// .source_file = .{
64-
// .path = "src/example/blinky.zig",
65-
// },
66-
// .backing = .{ .chip = chips.esp32_c3 },
67-
// .optimize = optimize,
68-
// });
69-
70-
// const fw_objcopy = b.addObjCopy(exe.inner.getEmittedBin(), .{
71-
// .format = .bin,
72-
// });
73-
74-
// const fw_bin = fw_objcopy.getOutput();
75-
76-
// const install_fw_bin = b.addInstallFile(fw_bin, "firmware/blinky.bin");
77-
78-
// b.getInstallStep().dependOn(&install_fw_bin.step);
79-
80-
// b.installArtifact(exe.inner);
54+
_ = b.step("test", "Run platform agnostic unit tests");
8155
}

bsp/espressif/esp/build.zig.zon

+4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
.@"microzig/build" = .{ .path = "../../../build" },
66
},
77
.paths = .{
8+
"LICENSE",
9+
"README.md",
810
"build.zig",
911
"build.zig.zon",
12+
"src",
13+
"docs",
1014
},
1115
}

bsp/gigadevice/gd32/LICENSE

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 Zig Embedded Group Contributors
1+
Copyright (c) Zig Embedded Group contributors
22

33
This software is provided 'as-is', without any express or implied warranty. In
44
no event will the authors be held liable for any damages arising from the use
@@ -9,11 +9,11 @@ commercial applications, and to alter it and redistribute it freely, subject to
99
the following restrictions:
1010

1111
1. The origin of this software must not be misrepresented; you must not claim
12-
that you wrote the original software. If you use this software in a product, an
13-
acknowledgment in the product documentation would be appreciated but is not
14-
required.
12+
that you wrote the original software. If you use this software in a product,
13+
an acknowledgment in the product documentation would be appreciated but is
14+
not required.
1515

1616
2. Altered source versions must be plainly marked as such, and must not be
17-
misrepresented as being the original software.
17+
misrepresented as being the original software.
1818

1919
3. This notice may not be removed or altered from any source distribution.

bsp/gigadevice/gd32/README.adoc

-6
This file was deleted.

bsp/gigadevice/gd32/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# GigaDevice GD32 Hardware Support Package

bsp/gigadevice/gd32/build.zig

+3-35
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ const std = @import("std");
22
const Build = std.Build;
33
const MicroZig = @import("microzig/build");
44

5-
pub const microzig_board_support = MicroZig.registerBoardSupport(@This());
6-
75
fn path(comptime suffix: []const u8) std.Build.LazyPath {
86
return .{
97
.cwd_relative = comptime ((std.fs.path.dirname(@src().file) orelse ".") ++ suffix),
108
};
119
}
1210

1311
const hal = .{
14-
.source_file = path("/src/hals/GD32VF103.zig"),
12+
.root_source_file = path("/src/hals/GD32VF103.zig"),
1513
};
1614

1715
pub const chips = struct {
@@ -57,42 +55,12 @@ pub const boards = struct {
5755
.board = .{
5856
.name = "Longan Nano",
5957
.url = "https://longan.sipeed.com/en/",
60-
.source_file = path("/src/boards/longan_nano.zig"),
58+
.root_source_file = path("/src/boards/longan_nano.zig"),
6159
},
6260
};
6361
};
6462
};
6563

6664
pub fn build(b: *Build) void {
67-
_ = b;
68-
// const optimize = b.standardOptimizeOption(.{});
69-
// inline for (@typeInfo(boards).Struct.decls) |decl| {
70-
// if (!decl.is_pub)
71-
// continue;
72-
73-
// const exe = microzig.addEmbeddedExecutable(b, .{
74-
// .name = @field(boards, decl.name).name ++ ".minimal",
75-
// .source_file = .{
76-
// .path = "test/programs/minimal.zig",
77-
// },
78-
// .backing = .{ .board = @field(boards, decl.name) },
79-
// .optimize = optimize,
80-
// });
81-
// exe.installArtifact(b);
82-
// }
83-
84-
// inline for (@typeInfo(chips).Struct.decls) |decl| {
85-
// if (!decl.is_pub)
86-
// continue;
87-
88-
// const exe = microzig.addEmbeddedExecutable(b, .{
89-
// .name = @field(chips, decl.name).name ++ ".minimal",
90-
// .source_file = .{
91-
// .path = "test/programs/minimal.zig",
92-
// },
93-
// .backing = .{ .chip = @field(chips, decl.name) },
94-
// .optimize = optimize,
95-
// });
96-
// exe.installArtifact(b);
97-
// }
65+
_ = b.step("test", "Run platform agnostic unit tests");
9866
}

bsp/gigadevice/gd32/build.zig.zon

+4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
.@"microzig/build" = .{ .path = "../../../build" },
66
},
77
.paths = .{
8+
"LICENSE",
9+
"README.md",
810
"build.zig",
911
"build.zig.zon",
12+
"src",
13+
"test",
1014
},
1115
}

bsp/microchip/atsam/LICENSE

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 Zig Embedded Group Contributors
1+
Copyright (c) Zig Embedded Group contributors
22

33
This software is provided 'as-is', without any express or implied warranty. In
44
no event will the authors be held liable for any damages arising from the use
@@ -9,11 +9,11 @@ commercial applications, and to alter it and redistribute it freely, subject to
99
the following restrictions:
1010

1111
1. The origin of this software must not be misrepresented; you must not claim
12-
that you wrote the original software. If you use this software in a product, an
13-
acknowledgment in the product documentation would be appreciated but is not
14-
required.
12+
that you wrote the original software. If you use this software in a product,
13+
an acknowledgment in the product documentation would be appreciated but is
14+
not required.
1515

1616
2. Altered source versions must be plainly marked as such, and must not be
17-
misrepresented as being the original software.
17+
misrepresented as being the original software.
1818

1919
3. This notice may not be removed or altered from any source distribution.

0 commit comments

Comments
 (0)