mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
uvm32 initial version
This commit is contained in:
commit
c9d30b6d28
34 changed files with 2088 additions and 0 deletions
51
apps/zig-mandel/build.zig
Normal file
51
apps/zig-mandel/build.zig
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
const std = @import("std");
|
||||
const CrossTarget = @import("std").zig.CrossTarget;
|
||||
const Target = @import("std").Target;
|
||||
const Feature = @import("std").Target.Cpu.Feature;
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const features = Target.riscv.Feature;
|
||||
var disabled_features = Feature.Set.empty;
|
||||
var enabled_features = Feature.Set.empty;
|
||||
|
||||
// disable all CPU extensions
|
||||
disabled_features.addFeature(@intFromEnum(features.a));
|
||||
disabled_features.addFeature(@intFromEnum(features.c));
|
||||
disabled_features.addFeature(@intFromEnum(features.d));
|
||||
disabled_features.addFeature(@intFromEnum(features.e));
|
||||
disabled_features.addFeature(@intFromEnum(features.f));
|
||||
// except multiply
|
||||
enabled_features.addFeature(@intFromEnum(features.m));
|
||||
|
||||
const target = b.resolveTargetQuery(.{
|
||||
.cpu_arch = Target.Cpu.Arch.riscv32,
|
||||
.os_tag = Target.Os.Tag.freestanding,
|
||||
.abi = Target.Abi.none,
|
||||
.cpu_model = .{ .explicit = &std.Target.riscv.cpu.generic_rv32},
|
||||
.cpu_features_sub = disabled_features,
|
||||
.cpu_features_add = enabled_features
|
||||
});
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "mandel",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = .ReleaseSmall,
|
||||
}),
|
||||
});
|
||||
|
||||
b.installArtifact(exe);
|
||||
|
||||
exe.addAssemblyFile(b.path("../crt0.s"));
|
||||
exe.setLinkerScript(b.path("../linker.ld"));
|
||||
exe.addIncludePath(b.path("../../common"));
|
||||
|
||||
const bin = b.addObjCopy(exe.getEmittedBin(), .{
|
||||
.format = .bin,
|
||||
});
|
||||
bin.step.dependOn(&exe.step);
|
||||
|
||||
const copy_bin = b.addInstallBinFile(bin.getOutput(), "mandel.bin");
|
||||
b.default_step.dependOn(©_bin.step);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue