Sylvain Munaut | 21b03ba | 2020-09-14 10:01:45 +0200 | [diff] [blame] | 1 | CROSS = riscv-none-embed- |
| 2 | |
| 3 | CC := $(CROSS)gcc |
| 4 | OBJCOPY := $(CROSS)objcopy |
| 5 | |
| 6 | CFLAGS=-Wall -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section |
| 7 | |
| 8 | all: boot.hex |
| 9 | |
| 10 | boot.elf: lnk-boot.lds boot.S |
| 11 | $(CC) $(CFLAGS) -Wl,-Bstatic,-T,lnk-boot.lds,--strip-debug -DAPP_FLASH_ADDR=0x000a0000 -o $@ boot.S |
| 12 | |
| 13 | %.bin: %.elf |
| 14 | $(OBJCOPY) -O binary $< $@ |
| 15 | |
| 16 | %.hex: %.bin |
| 17 | ./bin2hex.py $< $@ |
| 18 | |
| 19 | clean: |
| 20 | rm -f *.bin *.hex *.elf *.o |
| 21 | |
| 22 | .PHONY: clean |