rp2040

RP2040 Programming without SDK
Log | Files | Refs

Makefile (773B)


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