2023-08-09 23:00:44 +08:00
|
|
|
TARGET = firmware
|
|
|
|
OVERLAY = sram-overlay
|
|
|
|
BLOB_OVERLAY = blob-overlay
|
|
|
|
LINK_OVERLAY = link-overlay
|
|
|
|
|
|
|
|
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
|
|
|
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
|
|
|
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
|
|
|
|
|
|
|
OBJS =
|
|
|
|
# Startup files
|
|
|
|
OBJS += start.o
|
|
|
|
OBJS += init.o
|
|
|
|
OBJS += overlay.o
|
|
|
|
OBJS += $(LINK_OVERLAY).o
|
|
|
|
OBJS += $(BLOB_OVERLAY).o
|
2023-08-14 19:00:08 +08:00
|
|
|
OBJS += external/printf/printf.o
|
2023-08-09 23:00:44 +08:00
|
|
|
|
|
|
|
# Drivers
|
2023-08-10 18:42:41 +08:00
|
|
|
OBJS += driver/adc.o
|
2023-08-13 00:40:05 +08:00
|
|
|
OBJS += driver/backlight.o
|
2023-08-10 18:46:22 +08:00
|
|
|
OBJS += driver/bk1080.o
|
2023-08-10 18:57:44 +08:00
|
|
|
OBJS += driver/bk4819.o
|
2023-08-09 23:00:44 +08:00
|
|
|
OBJS += driver/crc.o
|
|
|
|
OBJS += driver/eeprom.o
|
|
|
|
OBJS += driver/flash.o
|
|
|
|
OBJS += driver/gpio.o
|
|
|
|
OBJS += driver/i2c.o
|
2023-08-11 04:34:28 +08:00
|
|
|
OBJS += driver/keyboard.o
|
2023-08-09 23:00:44 +08:00
|
|
|
OBJS += driver/spi.o
|
|
|
|
OBJS += driver/st7565.o
|
|
|
|
OBJS += driver/system.o
|
|
|
|
OBJS += driver/systick.o
|
|
|
|
OBJS += driver/uart.o
|
|
|
|
|
|
|
|
# Main
|
2023-08-14 06:27:35 +08:00
|
|
|
OBJS += aircopy.o
|
2023-08-13 04:33:27 +08:00
|
|
|
OBJS += audio.o
|
2023-08-13 00:50:08 +08:00
|
|
|
OBJS += battery.o
|
2023-08-15 20:57:20 +08:00
|
|
|
OBJS += bitmaps.o
|
2023-08-09 23:00:44 +08:00
|
|
|
OBJS += board.o
|
2023-08-11 22:41:23 +08:00
|
|
|
OBJS += dcs.o
|
2023-08-11 00:51:57 +08:00
|
|
|
OBJS += dtmf.o
|
|
|
|
OBJS += fm.o
|
2023-08-14 06:08:01 +08:00
|
|
|
OBJS += font.o
|
2023-08-11 00:51:57 +08:00
|
|
|
OBJS += frequencies.o
|
2023-08-14 05:40:33 +08:00
|
|
|
OBJS += functions.o
|
2023-08-14 06:08:01 +08:00
|
|
|
OBJS += gui.o
|
2023-08-14 06:27:35 +08:00
|
|
|
OBJS += helper.o
|
2023-08-11 00:51:57 +08:00
|
|
|
OBJS += misc.o
|
2023-08-11 18:51:17 +08:00
|
|
|
OBJS += radio.o
|
2023-08-15 06:38:59 +08:00
|
|
|
OBJS += scheduler.o
|
2023-08-11 00:51:57 +08:00
|
|
|
OBJS += settings.o
|
2023-08-15 06:38:59 +08:00
|
|
|
|
2023-08-09 23:00:44 +08:00
|
|
|
OBJS += main.o
|
|
|
|
|
|
|
|
TOP := $(shell pwd)
|
|
|
|
|
|
|
|
AS = arm-none-eabi-as
|
|
|
|
CC = arm-none-eabi-gcc
|
|
|
|
LD = arm-none-eabi-gcc
|
|
|
|
OBJCOPY = arm-none-eabi-objcopy
|
2023-08-13 04:19:34 +08:00
|
|
|
SIZE = arm-none-eabi-size
|
2023-08-09 23:00:44 +08:00
|
|
|
|
|
|
|
ASFLAGS = -mcpu=cortex-m0
|
2023-08-15 05:52:55 +08:00
|
|
|
CFLAGS = -O2 -Wall -Werror -mcpu=cortex-m0 -fno-builtin -std=c11 -MMD
|
2023-08-14 19:00:08 +08:00
|
|
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
2023-08-09 23:00:44 +08:00
|
|
|
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
|
|
|
|
|
|
|
OVERLAY_CFLAGS = $(CFLAGS) -fno-inline -fno-toplevel-reorder
|
|
|
|
OVERLAY_LD = arm-none-eabi-ld
|
|
|
|
OVERLAY_LDFLAGS = -T $(OVERLAY).ld -S
|
|
|
|
|
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
ASFLAGS += -g
|
|
|
|
CFLAGS += -g
|
|
|
|
LDFLAGS += -g
|
|
|
|
endif
|
|
|
|
|
|
|
|
INC =
|
|
|
|
INC += -I $(TOP)
|
|
|
|
INC += -I $(TOP)/external/CMSIS_5/CMSIS/Core/Include/
|
|
|
|
INC += -I $(TOP)/external/CMSIS_5/Device/ARM/ARMCM0/Include
|
|
|
|
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
DEPS = $(OBJS:.o=.d)
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
$(OBJCOPY) -O binary $< $<.bin
|
2023-08-13 04:19:34 +08:00
|
|
|
$(SIZE) $<
|
2023-08-09 23:00:44 +08:00
|
|
|
|
|
|
|
$(OVERLAY).bin: $(OVERLAY)
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
|
|
|
$(OVERLAY): $(OVERLAY).o
|
|
|
|
$(OVERLAY_LD) $(OVERLAY_LDFLAGS) $< -o $@
|
|
|
|
|
|
|
|
$(OVERLAY).o: $(OVERLAY).c
|
|
|
|
$(CC) $(OVERLAY_CFLAGS) $(INC) -c $< -o $@
|
|
|
|
|
|
|
|
$(LINK_OVERLAY).o: $(LINK_OVERLAY).S
|
|
|
|
$(AS) $(ASFLAGS) $< -o $@
|
|
|
|
|
|
|
|
$(LINK_OVERLAY).S: $(OVERLAY)
|
|
|
|
./gen-overlay-symbols.sh $< $@
|
|
|
|
|
2023-08-10 00:28:21 +08:00
|
|
|
$(BLOB_OVERLAY).S: $(OVERLAY).bin
|
2023-08-09 23:00:44 +08:00
|
|
|
|
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)
|
|
|
|
|
|
|
|
bsp/dp32g030/%.h: hardware/dp32g030/%.def
|
|
|
|
|
|
|
|
%.o: %.c | $(BSP_HEADERS)
|
|
|
|
$(CC) $(CFLAGS) $(INC) -c $< -o $@
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(AS) $(ASFLAGS) $< -o $@
|
|
|
|
|
|
|
|
-include $(DEPS)
|
|
|
|
|
|
|
|
clean:
|
2023-08-10 00:28:21 +08:00
|
|
|
rm -f $(TARGET).bin $(TARGET) $(OBJS) $(DEPS) $(OVERLAY).bin $(OVERLAY) $(OVERLAY).o $(OVERLAY).d $(LINK_OVERLAY).o $(LINK_OVERLAY).S $(BLOB_OVERLAY).o
|
2023-08-09 23:00:44 +08:00
|
|
|
|