mirror of https://git.eddie.sh/onyx/onyx.git
27 lines
573 B
Makefile
27 lines
573 B
Makefile
.PHONY: all clean upload
|
|
|
|
SRC = $(shell find src/) memory.x Cargo.toml build.rs
|
|
CARGO_CONF = .cargo/config
|
|
CARGO_FLAGS = --release
|
|
BOSSA_FLAGS = -ewvRo 0x2000
|
|
|
|
TARGET_DIR = target
|
|
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)
|