Added the zig_main project to software for zig based implementation of code for robot

This commit is contained in:
2026-05-05 20:14:04 +12:00
parent 7d752f2534
commit f21f909a71
83 changed files with 13631 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
const sys = @import("sys");
const log = @import("log");
/// panic handler for esp-idf
pub fn panic(msg: []const u8, stack_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn {
sys.esp_log_write(log.default_level, "PANIC", "[%lu ms] PANIC: %.*s\n", sys.esp_log_timestamp(), msg.len, msg.ptr);
// try print stack trace if available
if (stack_trace) |st| {
var i: usize = st.index;
if (i > st.instruction_addresses.len) i = st.instruction_addresses.len;
var idx: usize = 0;
while (idx < i) : (idx += 1) {
sys.esp_log_write(log.default_level, "PANIC", " #%u: 0x%08lx\n", idx, st.instruction_addresses[idx]);
}
}
while (true) {
asm volatile ("" ::: .{ .memory = true });
}
}