pico-acm-cfw/Makefile

42 lines
961 B
Makefile
Raw Permalink Normal View History

2025-03-24 09:33:49 +01:00
CPU=cortex-m0plus
TC=arm-none-eabi
CC_OPTS=-fno-builtin -fno-pie -no-pie -nolibc -nostartfiles -mcpu=$(CPU)
ELF2UF2=tools/elf2uf2/elf2uf2
PAD_CHECKSUM=tools/pad_checksum.py
all: firmware.uf2
firmware.uf2: firmware.elf
$(ELF2UF2) $^ $@
boot2.o: src/boot/boot2.S
$(TC)-gcc $(CC_OPTS) -c -o boot2.o $^
boot2_crc32.o: boot2.o
$(TC)-objcopy -O binary boot2.o boot2.bin
$(PAD_CHECKSUM) -p 256 -s 0xFFFFFFFF boot2.bin boot2_crc32.S
$(TC)-gcc -c -o boot2_crc32.o boot2_crc32.S
%.o: src/boot/%.S
$(TC)-gcc $(CC_OPTS) -c -o $@ $^
%.o: src/%.c
$(TC)-gcc $(CC_OPTS) -c -o $@ $^
%.o: src/libs/%.c
$(TC)-gcc $(CC_OPTS) -c -o $@ $^
%.o: src/libs/usb/%.c
$(TC)-gcc $(CC_OPTS) -c -o $@ $^
firmware.elf: boot2_crc32.o main.o crt0.o interrupts.o lock.o gpio.o utils.o clock.o cusb.o cdc-acm.o tty.o
$(TC)-ld -T linker.ld -Map=$@.map -o $@ $^
clean:
@rm -f ./*.o ./*crc32.S ./*.elf ./*.bin ./*.map
mrproper: clean
@rm -f firmware.uf2
.PHONY: clean mrproper