rp2040

RP2040 Programming without SDK
Log | Files | Refs

Makefile (702B)


      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 led.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 led.elf: boot2.o main.o memmap.ld
     22 	$(LD) $(LDFLAGS) -o $@ -T memmap.ld boot2.o main.o 
     23 
     24 led.bin: led.elf
     25 	$(OBJCOPY) -O binary led.elf $@
     26 
     27 led.uf2: led.bin
     28 	$(BINCRC) led.bin led_crc.bin
     29 	$(BIN2UF2) led_crc.bin $@
     30 
     31 flash: all
     32 	mount /dev/disk/by-label/RPI-RP2 /mnt
     33 	cp led.uf2 /mnt
     34 
     35 tools:
     36 	cd ../tools && make