summaryrefslogtreecommitdiff
path: root/src/esp32p4
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 17:35:06 -0300
committerGabriel Schneider <[email protected]>2026-10-30 17:35:06 -0300
commit6d8da8721141284cf33bb901168b26135893eb86 (patch)
tree791d63401d4e85fbca1d597a8ce0326e70efd545 /src/esp32p4
parentefd43a3a2cf03bb741366331158b368abf9ac583 (diff)
parentbf6810a8f9d6cc82050e7d9c0cfb06358301b574 (diff)
downloadpardes-6d8da8721141284cf33bb901168b26135893eb86.tar.gz
pardes-6d8da8721141284cf33bb901168b26135893eb86.zip
Merge latest upstream into the macOS branch for Zig 0.17
Retain the macOS branch history and local Acme selection color while adopting upstream's current core and platform changes. Pin Zig and ZLS to 0.17.0, and fetch the existing zstbi compatibility commit through upstream after its original fork was removed.
Diffstat (limited to 'src/esp32p4')
-rw-r--r--src/esp32p4/app.zig6
-rw-r--r--src/esp32p4/input_rescue.zig2
-rw-r--r--src/esp32p4/selftest.zig2
-rw-r--r--src/esp32p4/uart.zig18
4 files changed, 6 insertions, 22 deletions
diff --git a/src/esp32p4/app.zig b/src/esp32p4/app.zig
index 4ee131ec..800e7597 100644
--- a/src/esp32p4/app.zig
+++ b/src/esp32p4/app.zig
@@ -235,17 +235,17 @@ var gpa_heap: heapmod.Heap = undefined;
fn cAlloc(_: ?*anyopaque, len: usize, log2_align: u8) callconv(.c) ?[*]u8 {
const a = gpa_heap.allocator();
- return a.vtable.alloc(a.ptr, len, @enumFromInt(log2_align), @returnAddress());
+ return a.vtable.alloc(a.ptr, len, @fromBackingInt(@intCast(log2_align)), @returnAddress());
}
fn cResize(_: ?*anyopaque, ptr: [*]u8, len: usize, log2_align: u8, new_len: usize) callconv(.c) bool {
const a = gpa_heap.allocator();
- return a.vtable.resize(a.ptr, ptr[0..len], @enumFromInt(log2_align), new_len, @returnAddress());
+ return a.vtable.resize(a.ptr, ptr[0..len], @fromBackingInt(@intCast(log2_align)), new_len, @returnAddress());
}
fn cFree(_: ?*anyopaque, ptr: [*]u8, len: usize, log2_align: u8) callconv(.c) void {
const a = gpa_heap.allocator();
- a.vtable.free(a.ptr, ptr[0..len], @enumFromInt(log2_align), @returnAddress());
+ a.vtable.free(a.ptr, ptr[0..len], @fromBackingInt(@intCast(log2_align)), @returnAddress());
}
const editor_allocator: Allocator = .{
diff --git a/src/esp32p4/input_rescue.zig b/src/esp32p4/input_rescue.zig
index ba6974d2..d7556d46 100644
--- a/src/esp32p4/input_rescue.zig
+++ b/src/esp32p4/input_rescue.zig
@@ -245,7 +245,7 @@ test "a long transmit does not lose the input that arrives during it" {
defer port.sent.deinit(std.testing.allocator);
var ring: Ring = .{};
- const frame = "\x1b[1;1H" ++ "x" ** 400;
+ const frame = "\x1b[1;1H" ++ &@as([400]u8, @splat('x'));
try std.testing.expectEqual(@as(u32, 0), pump(&port, &ring, frame, 1_000_000));
// Every output byte went out, in order.
diff --git a/src/esp32p4/selftest.zig b/src/esp32p4/selftest.zig
index 97b43059..19b71e90 100644
--- a/src/esp32p4/selftest.zig
+++ b/src/esp32p4/selftest.zig
@@ -270,7 +270,7 @@ export fn zig_main() noreturn {
const typed = "the quick brown fox jumps over the lazy dog, and then some more besides";
var port: FakePort = .{ .tx_cap = 2, .incoming = typed };
var ring: input_rescue.Ring = .{};
- const frame = "\x1b[1;1H" ++ "x" ** 300;
+ const frame = "\x1b[1;1H" ++ &@as([300]u8, @splat('x'));
const abandoned = input_rescue.pump(&port, &ring, frame, 1_000_000);
check("the frame went out whole", abandoned == 0 and port.sent == frame.len);
diff --git a/src/esp32p4/uart.zig b/src/esp32p4/uart.zig
index 15599423..a185737d 100644
--- a/src/esp32p4/uart.zig
+++ b/src/esp32p4/uart.zig
@@ -100,7 +100,7 @@ pub fn writeSome(bytes: []const u8) usize {
/// running on. Nothing is touched when it is not.
///
/// THE ONE EXCEPTION to this file's rule, and see the header for who may call it: not this file, not
-/// `app.zig`, only an image whose host side is opened at the same rate. `docs/registry.typ`
+/// `app.zig`, only an image whose host side is opened at the same rate. `docs/registry.pdf`
/// `BOARD-1` has the numbers — 921600 is one `UART_CLKDIV_SYNC` write on the existing 40 MHz XTAL,
/// int 43 frag 6, +0.064% error, and it takes a byte from 86.8 µs to 10.85 µs.
///
@@ -126,22 +126,6 @@ pub fn writeByte(b: u8) void {
uart0.pushByte(b);
}
-/// Emit `n` bytes read from `addr` as two hex digits each, computing the digits arithmetically so
-/// nothing here reads a lookup table. Used to answer "does a load from this address return what the
-/// linker put there", which is not a question a string literal can be trusted to ask.
-pub fn dumpHex(addr: u32, n: u32) void {
- const p: [*]const volatile u8 = @ptrFromInt(addr);
- var i: u32 = 0;
- while (i < n) : (i += 1) {
- const byte = p[i];
- for ([2]u8{ byte >> 4, byte & 0xf }) |nib| {
- writeByte(if (nib < 10) '0' + nib else 'a' + (nib - 10));
- }
- }
- writeByte('\r');
- writeByte('\n');
-}
-
/// A u32 as eight hex digits, reading no memory at all.
pub fn dumpWord(v: u32) void {
var shift: u5 = 28;