onyx/Makefile

27 lines
572 B
Makefile
Raw Normal View History

.PHONY: all clean upload
2020-01-26 00:14:40 +00:00
SRC = $(shell find src/) memory.x Cargo.toml build.rs
CARGO_CONF = .cargo/config
CARGO_FLAGS = --release
BOSSA_FLAGS = -ewvRo 0x2000
TARGET_DIR = target
2020-01-27 19:25:15 +00:00
TARGET_ARCH = $(shell grep -oP '^target\s+=\s"\K[\w\-]+' $(CARGO_CONF))
CARGO_BIN = $(TARGET_DIR)/$(TARGET_ARCH)/release/onyx
FLASH_IMG = $(TARGET_DIR)/onyx.bin
all: $(FLASH_IMG)
$(FLASH_IMG): $(CARGO_BIN)
arm-none-eabi-objcopy -O binary $< $@
$(CARGO_BIN): $(SRC)
cargo build $(CARGO_FLAGS)
upload: $(FLASH_IMG)
bossac $(BOSSA_FLAGS) $<
clean:
$(RM) -r $(TARGET_DIR)