Project

General

Profile

RE: First try with ARM MCU bare betal » Makefile

Runar Tenfjord, 14 August 2024 21:42

 
.SUFFIXES:
MAKEFLAGS += --no-builtin-rules --no-builtin-variables

OB := obarmt32
AS := armt32asm
LK := linkmem
QEMU := qemu-system-arm
DEVICE := mps2-an386 # cortex-m4
ADR := 0x00000000
ECS := /c/EigenCompilerSuite/runtime

RTS = $(ECS)/obarmt32run.lib

.PHONY: all
all : build/test.rom

build/%.obf: src/%.mod
@echo compiling $<
@mkdir -p build
@cd build && cp -f $(addprefix ../, $<) .
@cd build && $(OB) $(notdir $<)

build/stm32f4run.obf : src/stm32f4run.asm
@echo compiling $<
@mkdir -p build
@cd build && cp -f $(addprefix ../, $<) .
@cd build && $(AS) $(notdir $<)

build/test.rom: src/testTrap.mod build/Semihost.obf build/stm32f4run.obf
@echo linking $@
@mkdir -p build
@cd build && cp -f ../src/testTrap.mod .
@cd build && $(OB) testTrap.mod
@cd build && $(LK) testTrap.obf $(RTS) stm32f4run.obf Semihost.obf

run: build/testTrap.rom
@$(QEMU) -M $(DEVICE) -semihosting -nographic -device loader,file=$<,addr=$(ADR)

.PHONY: clean
clean:
@echo Clean
@-rm -rf build
(4-4/5)