Skip to content

Commit

Permalink
Merge main into zig-master and fix rp2350 build (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
tact1m4n3 authored Feb 17, 2025
1 parent be87991 commit ef35c3c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 101 deletions.
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ pub fn MicroBuild(port_select: PortSelect) type {
.linkage = .static,
.root_source_file = mb.core_dep.path("src/start.zig"),
.strip = options.strip,
.unwind_tables = true,
.unwind_tables = .sync,
}),
.app_mod = app_mod,
.target = target,
Expand Down
4 changes: 2 additions & 2 deletions drivers/stepper/stepper.zig
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub fn Stepper(comptime Driver: type) type {
.constant_speed => {
self.steps_to_cruise = 0;
self.steps_to_brake = 0;
self.cruise_step_pulse = step_pulse(self.motor_steps, self.microsteps, self.rpm);
self.cruise_step_pulse = get_step_pulse(self.motor_steps, self.microsteps, self.rpm);
self.step_pulse = self.cruise_step_pulse;
if (@intFromEnum(time) > self.steps_remaining * @intFromEnum(self.step_pulse)) {
self.step_pulse = mdf.time.Duration.from_us(@intFromFloat(@as(f64, @floatFromInt(time.to_us())) /
Expand All @@ -243,7 +243,7 @@ pub fn Stepper(comptime Driver: type) type {
}
}

inline fn step_pulse(steps: i32, microsteps: u8, rpm: f64) mdf.time.Duration {
inline fn get_step_pulse(steps: i32, microsteps: u8, rpm: f64) mdf.time.Duration {
return @enumFromInt(@as(u64, @intFromFloat(60.0 * 1000000 /
@as(f64, @floatFromInt(steps)) /
@as(f64, @floatFromInt(microsteps)) / rpm)));
Expand Down
11 changes: 9 additions & 2 deletions port/raspberrypi/rp2xxx/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn init(dep: *std.Build.Dependency) Self {
.{ .kind = .flash, .offset = 0x10000000, .length = 2048 * 1024 },
.{ .kind = .ram, .offset = 0x20000000, .length = 256 * 1024 },
},
.patches = @import("patches/rp2350_arm.zig").patches,
.patches = @import("patches/rp2350.zig").patches,
},
.hal = hal,
.linker_script = b.path("rp2350_arm.ld"),
Expand Down Expand Up @@ -105,7 +105,14 @@ pub fn init(dep: *std.Build.Dependency) Self {
.{ .kind = .flash, .offset = 0x10000000, .length = 256 },
.{ .kind = .ram, .offset = 0x20000000, .length = 256 * 1024 },
},
.patches = @import("patches/rp2350_riscv.zig").patches,
.patches = @import("patches/rp2350.zig").patches ++ [_]microzig.Patch{
.{
.override_arch = .{
.device_name = "RP2350",
.arch = .hazard3,
},
},
},
},
.hal = hal,
.linker_script = b.path("rp2350_riscv.ld"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
pub const patches = &.{
const microzig = @import("microzig/build-internals");
const Patch = microzig.Patch;

pub const patches: []const Patch = &.{
.{ .add_enum = .{
.parent = "types.peripherals.USB_DPRAM",
.@"enum" = .{
Expand Down
95 changes: 0 additions & 95 deletions port/raspberrypi/rp2xxx/patches/rp2350_riscv.zig

This file was deleted.

0 comments on commit ef35c3c

Please sign in to comment.