Skip to content

Commit

Permalink
it's called firmware.ELF thank you very much
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Tralamazza committed Jun 19, 2019
1 parent bc6bfd7 commit a16d960
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ MAKEFLAGS += --no-builtin-variables
BUILD_FLAGS = --release-small -target thumbv7m-freestanding-none
LINKER_SCRIPT = arm_cm3.ld
OBJS = startup.o main.o
PROG = firmware

%.o: %.zig
zig build-obj ${BUILD_FLAGS} $<

firmware: ${OBJS}
# zig build-exe ${BUILD_FLAGS} $(OBJS:%=--object %) --name $@ --linker-script ${LINKER_SCRIPT}
arm-none-eabi-ld ${OBJS} -o $@ -T ${LINKER_SCRIPT} -Map [email protected] --gc-sections
${PROG}: ${OBJS}
# zig build-exe ${BUILD_FLAGS} $(OBJS:%=--object %) --name $@.elf --linker-script ${LINKER_SCRIPT}
arm-none-eabi-ld ${OBJS} -o $@.elf -T ${LINKER_SCRIPT} -Map [email protected] --gc-sections

clean:
rm -rf firmware firmware.map ${OBJS} $(OBJS:%.o=%.h) zig-cache
rm -rf ${PROG}.* ${OBJS} $(OBJS:%.o=%.h) zig-cache

.PHONY: clean
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const builtin = @import("builtin");
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();

const exe = b.addExecutable("firmware", "main.zig");
const exe = b.addExecutable("firmware.elf", "main.zig");
exe.setTarget(builtin.Arch { .thumb = .v7m }, builtin.Os.freestanding, builtin.Abi.none);

const main_o = b.addObject("startup", "startup.zig");
Expand Down

0 comments on commit a16d960

Please sign in to comment.