kamilsss655/Makefile

222 lines
4.5 KiB
Makefile
Raw Normal View History

2023-09-09 07:03:56 +00:00
TARGET = firmware
2023-09-14 08:56:30 +00:00
ENABLE_AIRCOPY := 0
ENABLE_FMRADIO := 0
ENABLE_OVERLAY := 1
ENABLE_UART := 1
ENABLE_NOAA := 0
ENABLE_VOICE := 0
ENABLE_ALARM := 0
ENABLE_BIG_FREQ := 0
ENABLE_KEEP_MEM_NAME := 1
ENABLE_CHAN_NAME_FREQ := 1
ENABLE_WIDE_RX := 1
ENABLE_TX_WHEN_AM := 0
#ENABLE_SINGLE_VFO_CHAN := 1
#ENABLE_BAND_SCOPE := 1
2023-09-09 07:03:56 +00:00
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
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_OVERLAY),1)
OBJS += sram-overlay.o
endif
2023-09-09 07:03:56 +00:00
OBJS += external/printf/printf.o
# Drivers
OBJS += driver/adc.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_UART),1)
OBJS += driver/aes.o
endif
2023-09-09 07:03:56 +00:00
OBJS += driver/backlight.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_FMRADIO),1)
OBJS += driver/bk1080.o
endif
2023-09-09 07:03:56 +00:00
OBJS += driver/bk4819.o
2023-09-14 08:56:30 +00:00
ifeq ($(filter $(ENABLE_AIRCOPY) $(ENABLE_UART),1),1)
OBJS += driver/crc.o
endif
2023-09-09 07:03:56 +00:00
OBJS += driver/eeprom.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_OVERLAY),1)
2023-09-09 07:03:56 +00:00
OBJS += driver/flash.o
2023-09-14 08:56:30 +00:00
endif
2023-09-09 07:03:56 +00:00
OBJS += driver/gpio.o
OBJS += driver/i2c.o
OBJS += driver/keyboard.o
OBJS += driver/spi.o
OBJS += driver/st7565.o
OBJS += driver/system.o
OBJS += driver/systick.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_UART),1)
OBJS += driver/uart.o
endif
2023-09-09 07:03:56 +00:00
# Main
OBJS += app/action.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_AIRCOPY),1)
OBJS += app/aircopy.o
endif
2023-09-09 07:03:56 +00:00
OBJS += app/app.o
OBJS += app/dtmf.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_FMRADIO),1)
OBJS += app/fm.o
endif
2023-09-09 07:03:56 +00:00
OBJS += app/generic.o
OBJS += app/main.o
OBJS += app/menu.o
OBJS += app/scanner.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_UART),1)
OBJS += app/uart.o
endif
2023-09-09 07:03:56 +00:00
OBJS += audio.o
OBJS += bitmaps.o
OBJS += board.o
OBJS += dcs.o
OBJS += font.o
OBJS += frequencies.o
OBJS += functions.o
OBJS += helper/battery.o
OBJS += helper/boot.o
OBJS += misc.o
OBJS += radio.o
OBJS += scheduler.o
OBJS += settings.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_AIRCOPY),1)
OBJS += ui/aircopy.o
endif
2023-09-09 07:03:56 +00:00
OBJS += ui/battery.o
2023-09-14 08:56:30 +00:00
ifeq ($(ENABLE_FMRADIO),1)
OBJS += ui/fmradio.o
endif
2023-09-09 07:03:56 +00:00
OBJS += ui/helper.o
OBJS += ui/inputbox.o
OBJS += ui/lock.o
OBJS += ui/main.o
OBJS += ui/menu.o
OBJS += ui/rssi.o
OBJS += ui/scanner.o
OBJS += ui/status.o
OBJS += ui/ui.o
OBJS += ui/welcome.o
OBJS += version.o
OBJS += main.o
ifeq ($(OS),Windows_NT)
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
else
TOP := $(shell pwd)
endif
2023-09-14 08:56:30 +00:00
AS = arm-none-eabi-gcc
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
2023-09-09 07:03:56 +00:00
OBJCOPY = arm-none-eabi-objcopy
2023-09-14 08:56:30 +00:00
SIZE = arm-none-eabi-size
2023-09-09 07:03:56 +00:00
2023-09-14 08:56:30 +00:00
GIT_HASH := $(shell git rev-parse --short HEAD)
2023-09-09 07:03:56 +00:00
2023-09-14 08:56:30 +00:00
ASFLAGS = -c -mcpu=cortex-m0
ifeq ($(ENABLE_OVERLAY),1)
ASFLAGS += -DENABLE_OVERLAY
endif
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
2023-09-09 07:03:56 +00:00
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
2023-09-14 08:56:30 +00:00
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
ifeq ($(ENABLE_AIRCOPY),1)
CFLAGS += -DENABLE_AIRCOPY
endif
ifeq ($(ENABLE_FMRADIO),1)
CFLAGS += -DENABLE_FMRADIO
endif
ifeq ($(ENABLE_OVERLAY),1)
CFLAGS += -DENABLE_OVERLAY
endif
ifeq ($(ENABLE_UART),1)
CFLAGS += -DENABLE_UART
endif
ifeq ($(ENABLE_BIG_FREQ),1)
CFLAGS += -DENABLE_BIG_FREQ
endif
ifeq ($(ENABLE_NOAA),1)
CFLAGS += -DENABLE_NOAA
endif
ifeq ($(ENABLE_VOICE),1)
CFLAGS += -DENABLE_VOICE
endif
ifeq ($(ENABLE_ALARM),1)
CFLAGS += -DENABLE_ALARM
endif
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
CFLAGS += -DKEEP_MEM_NAME
endif
ifeq ($(ENABLE_CHAN_NAME_FREQ),1)
CFLAGS += -DENABLE_CHAN_NAME_FREQ
endif
ifeq ($(ENABLE_WIDE_RX),1)
CFLAGS += -DENABLE_WIDE_RX
endif
ifeq ($(ENABLE_TX_WHEN_AM),1)
CFLAGS += -DENABLE_TX_WHEN_AM
endif
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
CFLAGS += -DENABLE_SINGLE_VFO_CHAN
endif
ifeq ($(ENABLE_BAND_SCOPE),1)
CFLAGS += -DENABLE_BAND_SCOPE
endif
2023-09-10 08:57:49 +00:00
2023-09-09 07:03:56 +00:00
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
ifeq ($(DEBUG),1)
ASFLAGS += -g
2023-09-14 08:56:30 +00:00
CFLAGS += -g
2023-09-09 07:03:56 +00:00
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
# -python fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
# -python3 fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
$(SIZE) $<
debug:
/opt/openocd/bin/openocd -c "bindto 0.0.0.0" -f interface/jlink.cfg -f dp32g030.cfg
flash:
/opt/openocd/bin/openocd -c "bindto 0.0.0.0" -f interface/jlink.cfg -f dp32g030.cfg -c "write_image firmware.bin 0; shutdown;"
version.o: .FORCE
$(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 $@
.FORCE:
-include $(DEPS)
clean:
rm -f $(TARGET).bin $(TARGET) $(OBJS) $(DEPS)