mirror of
https://github.com/im-tomu/fomu-workshop.git
synced 2024-09-19 19:00:18 +00:00
zig: updates for 0.9.0 (#610)
This commit is contained in:
parent
3af9a2424a
commit
24fd943692
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -45,8 +45,8 @@ jobs:
|
||||
- name: Install (Ubuntu)
|
||||
if: matrix.os == 'ubuntu'
|
||||
run: |
|
||||
curl -L https://ziglang.org/download/0.8.0/zig-linux-x86_64-0.8.0.tar.xz | tar -xJf -
|
||||
echo "$(pwd)/zig-linux-x86_64-0.8.0" >> $GITHUB_PATH
|
||||
curl -L https://ziglang.org/download/0.9.0/zig-linux-x86_64-0.9.0.tar.xz | tar -xJf -
|
||||
echo "$(pwd)/zig-linux-x86_64-0.9.0" >> $GITHUB_PATH
|
||||
|
||||
- name: Install (Mac OS)
|
||||
if: matrix.os == 'macos'
|
||||
@ -55,7 +55,7 @@ jobs:
|
||||
- name: Install (Windows)
|
||||
if: matrix.os == 'windows'
|
||||
run: |
|
||||
choco install zig --version 0.8.0
|
||||
choco install zig --version 0.9.0
|
||||
ln -s $(which python) /usr/bin/python3
|
||||
|
||||
- run: python ./get-toolchain.py
|
||||
|
@ -1,12 +1,12 @@
|
||||
# riscv-zig-blink
|
||||
|
||||
Written against zig 0.8.0
|
||||
Written against zig 0.9.0
|
||||
|
||||
You can obtain the zig compiler via https://ziglang.org/download/
|
||||
e.g. a linux user might run:
|
||||
```
|
||||
curl -L https://ziglang.org/download/0.8.0/zig-linux-x86_64-0.8.0.tar.xz | tar -xJf -
|
||||
alias zig=./zig-linux-x86_64-0.8.0/zig
|
||||
curl -L https://ziglang.org/download/0.9.0/zig-linux-x86_64-0.9.0.tar.xz | tar -xJf -
|
||||
alias zig=./zig-linux-x86_64-0.9.0/zig
|
||||
```
|
||||
|
||||
Run `zig build --help` from this directory for usage and options.
|
||||
|
@ -14,7 +14,7 @@ pub fn build(b: *Builder) void {
|
||||
.explicit = &std.Target.riscv.cpu.generic_rv32,
|
||||
},
|
||||
});
|
||||
elf.setLinkerScriptPath("ld/linker.ld");
|
||||
elf.setLinkerScriptPath(.{ .path = "ld/linker.ld" });
|
||||
elf.setBuildMode(mode);
|
||||
// The ELF file contains debug symbols and can be passed to gdb for remote debugging
|
||||
if (b.option(bool, "emit-elf", "Should an ELF file be emitted in the current directory?") orelse false) {
|
||||
|
@ -17,6 +17,7 @@ comptime {
|
||||
/// Panic function that sets LED to red and flashing + prints the panic message over messible
|
||||
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn {
|
||||
@setCold(true);
|
||||
_ = stack_trace;
|
||||
|
||||
// Put LED into non-raw flashing mode
|
||||
RGB.CTRL.* = .{
|
||||
@ -49,6 +50,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noretur
|
||||
|
||||
const WriteError = error{};
|
||||
fn messibleWrite(self: void, bytes: []const u8) WriteError!usize {
|
||||
_ = self;
|
||||
while (true) {
|
||||
const bytes_written = MESSIBLE.write(bytes);
|
||||
if (bytes_written != 0) return bytes_written;
|
||||
@ -58,6 +60,7 @@ pub const messibleWriter = std.io.Writer(void, WriteError, messibleWrite){ .cont
|
||||
|
||||
const ReadError = error{};
|
||||
fn messibleRead(self: void, buffer: []u8) ReadError!usize {
|
||||
_ = self;
|
||||
while (true) {
|
||||
const bytes_read = MESSIBLE.read(buffer);
|
||||
if (bytes_read != 0) return bytes_read;
|
||||
|
@ -14,7 +14,7 @@ pub const RGB = struct {
|
||||
/// Writing to this register has no immediate effect – data isn’t written until the DAT register is written.
|
||||
pub const ADDR = @intToPtr(*volatile u4, base + 0x4);
|
||||
|
||||
pub const Register = enum {
|
||||
pub const Register = enum(u4) {
|
||||
PWRR = 1,
|
||||
PWRG = 2,
|
||||
PWRB = 3,
|
||||
|
Loading…
Reference in New Issue
Block a user