2020-01-26 01:38:24 +00:00
|
|
|
.PHONY: all clean upload
|
2020-01-26 00:14:40 +00:00
|
|
|
|
2020-01-26 01:38:24 +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))
|
2020-01-26 01:38:24 +00:00
|
|
|
|
|
|
|
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)
|