build.zig and memory.x as ld file for tivatm4c123g

This commit is contained in:
Filipriec
2026-03-09 09:06:04 +01:00
parent 27704a2f16
commit d8b4c8e8cf
8 changed files with 153 additions and 13 deletions

35
tiva/build.zig Normal file
View File

@@ -0,0 +1,35 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.resolveTargetQuery(.{
.cpu_arch = .thumb,
.os_tag = .freestanding,
.abi = .eabi,
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
});
const optimize = b.standardOptimizeOption(.{});
// Create the module separately
const tiva_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const elf = b.addExecutable(.{
.name = "tiva-app",
.root_module = tiva_module,
});
// Disable red zone for bare metal
elf.root_module.red_zone = false;
// Provide basic built-in functions
elf.bundle_compiler_rt = true;
// Use your custom linker script
elf.setLinkerScript(b.path("layout.ld"));
b.installArtifact(elf);
}