rp2040

RP2040 Programming without SDK
Log | Files | Refs

Makefile (680B)


      1 AS = arm-none-eabi-as
      2 LD = arm-none-eabi-ld
      3 OBJCOPY = arm-none-eabi-objcopy
      4 BINCRC = ../tools/bincrc
      5 BIN2UF2 = ../tools/bin2uf2
      6 
      7 MCPU = -mcpu=cortex-m0plus
      8 ASFLAGS = $(MCPU)
      9 CFLAGS = $(MCPU) -ffreestanding -nostartfiles -O0 -fpic -mthumb -c
     10 LDFLAGS = --no-relax -nostdlib
     11 
     12 all: tools a.uf2
     13 
     14 clean:
     15 	rm -f *.o *.elf *.uf2 *.bin
     16 	cd ../tools && make clean
     17 
     18 .s.o:
     19 	$(AS) $(ASFLAGS) -o $@ $<
     20 
     21 a.elf: boot2.o main.o memmap.ld
     22 	$(LD) $(LDFLAGS) -o $@ -T memmap.ld boot2.o main.o 
     23 
     24 a.bin: a.elf
     25 	$(OBJCOPY) -O binary a.elf $@
     26 
     27 a.uf2: a.bin
     28 	$(BINCRC) a.bin a_crc.bin
     29 	$(BIN2UF2) a_crc.bin $@
     30 
     31 flash: all
     32 	mount /dev/disk/by-label/RPI-RP2 /mnt
     33 	cp a.uf2 /mnt
     34 
     35 tools:
     36 	cd ../tools && make