Skip to content

Commit

Permalink
Use microzig and stmicro-stm32 with ziglang/zig #17882 workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
marnix committed Nov 6, 2023
1 parent b0648ad commit 1175ebd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ Since then, this project has been updated to build on top of
To build the ELF file just run:

```
zig build
zig build -Drelease=true
```

(This results in a debug build.
_Open issue._ Note that the `-Drelease=true` binary does not currently work,
for a still unknown reason.)

## Flashing

The easiest way to flash the board is to install [`stlink`
Expand All @@ -35,7 +31,7 @@ repos, the build system will try to use the `st-flash` program.
The command to flash the board is:

```
zig build flash
zig build flash -Drelease=true
```

After flashing the board, as you tilt it,
Expand Down
1 change: 0 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn build(b: *std.Build) !void {
const firmware = microzig.addFirmware(b, .{
.name = "zig-stm32f3discovery-play",
.target = stm32.boards.stm32f3discovery,
// TODO: Make -Drelease=true actually work... Microzig or Zig 0.11.0 bug?
.optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSmall }),
.source_file = .{ .path = "src/main.zig" },
});
Expand Down
8 changes: 4 additions & 4 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
.version = "0.1.0",
.dependencies = .{
.microzig = .{
.url = "https://github.com/ZigEmbeddedGroup/microzig/archive/b60a45c3162e8ca76c0f6c23424316abe5c2464e.tar.gz",
.hash = "122098a603fec40519f78c2dc2aeaf715956c6315cbfa6cae6334bf28b74c5416fc0",
.url = "https://github.com/ZigEmbeddedGroup/microzig/archive/fdb0d185588b847cd8efc98f6d8675fec481bfdc.tar.gz",
.hash = "12205afa78531c7ef1598ccaaaa2c5548966b58a3c0972ca8224d1f3d7b89a1b0651",
},
.stm32 = .{
.url = "https://github.com/ZigEmbeddedGroup/stmicro-stm32/archive/ec38467975b6271fc791f1c25aeb8ef2b483612a.tar.gz",
.hash = "122064447fcb06c149094e027a4a4e4ce152adabaae3755500459339109d91d3b8e2",
.url = "https://github.com/ZigEmbeddedGroup/stmicro-stm32/archive/d7e9abf9c55bb0cc1809b48736c9256295d48763.tar.gz",
.hash = "1220cf19944dc3590501d64aa727de8a1a58cba88484a621be8fffab232df45ea648",
},
},
}

0 comments on commit 1175ebd

Please sign in to comment.