2023-09-09 07:03:56 +00:00
|
|
|
|
2023-09-25 12:27:52 +00:00
|
|
|
# compile options (see README.md for descriptions)
|
|
|
|
# 0 = disable
|
|
|
|
# 1 = enable
|
2023-11-29 16:55:47 +00:00
|
|
|
|
|
|
|
# ---- COMPILER/LINKER OPTIONS ----
|
2023-10-05 11:22:09 +00:00
|
|
|
ENABLE_CLANG := 0
|
2023-09-16 06:08:18 +00:00
|
|
|
ENABLE_SWD := 0
|
2023-10-01 16:19:38 +00:00
|
|
|
ENABLE_OVERLAY := 0
|
2023-10-01 18:56:04 +00:00
|
|
|
ENABLE_LTO := 1
|
2023-11-29 16:55:47 +00:00
|
|
|
|
|
|
|
# ---- STOCK QUANSHENG FERATURES ----
|
2023-09-14 10:16:45 +00:00
|
|
|
ENABLE_UART := 1
|
2023-09-16 06:55:09 +00:00
|
|
|
ENABLE_AIRCOPY := 0
|
2024-01-26 10:26:05 +00:00
|
|
|
ENABLE_FMRADIO := 1
|
2023-09-14 10:16:45 +00:00
|
|
|
ENABLE_NOAA := 0
|
2023-09-28 13:09:45 +00:00
|
|
|
ENABLE_VOICE := 0
|
2023-10-04 16:43:28 +00:00
|
|
|
ENABLE_VOX := 1
|
2023-09-14 10:16:45 +00:00
|
|
|
ENABLE_ALARM := 0
|
2023-10-05 13:10:12 +00:00
|
|
|
ENABLE_TX1750 := 0
|
2024-01-13 14:47:42 +00:00
|
|
|
ENABLE_PWRON_PASSWORD := 1
|
2023-12-15 14:48:24 +00:00
|
|
|
ENABLE_DTMF_CALLING := 0
|
2023-11-29 16:55:47 +00:00
|
|
|
|
|
|
|
# ---- CUSTOM MODS ----
|
2024-01-11 10:26:58 +00:00
|
|
|
ENABLE_BIG_FREQ := 1
|
|
|
|
ENABLE_SMALL_BOLD := 1
|
|
|
|
ENABLE_KEEP_MEM_NAME := 1
|
|
|
|
ENABLE_WIDE_RX := 1
|
|
|
|
ENABLE_TX_WHEN_AM := 0
|
|
|
|
ENABLE_F_CAL_MENU := 0
|
2024-01-21 11:58:38 +00:00
|
|
|
ENABLE_SHOW_CHARGE_LEVEL := 0
|
2024-01-11 10:26:58 +00:00
|
|
|
ENABLE_REVERSE_BAT_SYMBOL := 0
|
|
|
|
ENABLE_NO_CODE_SCAN_TIMEOUT := 1
|
|
|
|
ENABLE_SQUELCH_MORE_SENSITIVE := 0
|
|
|
|
ENABLE_FASTER_CHANNEL_SCAN := 1
|
|
|
|
ENABLE_RSSI_BAR := 1
|
|
|
|
ENABLE_AUDIO_BAR := 1
|
|
|
|
ENABLE_COPY_CHAN_TO_VFO := 1
|
|
|
|
ENABLE_SPECTRUM := 1
|
|
|
|
ENABLE_REDUCE_LOW_POWER := 1
|
|
|
|
ENABLE_BYP_RAW_DEMODULATORS := 0
|
|
|
|
ENABLE_BLMIN_TMP_OFF := 0
|
|
|
|
ENABLE_SCAN_RANGES := 1
|
|
|
|
ENABLE_SPECTRUM_COPY_VFO := 1
|
|
|
|
ENABLE_SPECTRUM_SHOW_CHANNEL_NAME := 1
|
|
|
|
ENABLE_SPECTRUM_CHANNEL_SCAN := 1
|
2024-01-12 16:04:29 +00:00
|
|
|
ENABLE_MESSENGER := 1
|
|
|
|
ENABLE_MESSENGER_DELIVERY_NOTIFICATION := 1
|
2024-02-02 17:51:17 +00:00
|
|
|
ENABLE_MESSENGER_FSK_MUTE := 1
|
2024-01-12 16:04:29 +00:00
|
|
|
ENABLE_MESSENGER_NOTIFICATION := 1
|
2024-01-11 10:34:14 +00:00
|
|
|
ENABLE_MESSENGER_UART := 0
|
2024-01-22 22:15:26 +00:00
|
|
|
ENABLE_ENCRYPTION := 1
|
2023-11-29 16:55:47 +00:00
|
|
|
|
2023-10-01 13:34:51 +00:00
|
|
|
#############################################################
|
2023-09-14 10:16:45 +00:00
|
|
|
|
|
|
|
TARGET = firmware
|
2023-09-14 08:56:30 +00:00
|
|
|
|
2023-10-05 11:22:09 +00:00
|
|
|
ifeq ($(ENABLE_CLANG),1)
|
|
|
|
# GCC's linker, ld, doesn't understand LLVM's generated bytecode
|
|
|
|
ENABLE_LTO := 0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ENABLE_LTO),1)
|
2023-10-03 09:13:22 +00:00
|
|
|
# can't have LTO and OVERLAY enabled at same time
|
2023-10-01 13:34:51 +00:00
|
|
|
ENABLE_OVERLAY := 0
|
|
|
|
endif
|
|
|
|
|
2023-09-09 07:03:56 +00:00
|
|
|
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
2023-09-14 18:38:28 +00:00
|
|
|
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
|
|
|
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
2023-09-09 07:03:56 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
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 10:16:45 +00:00
|
|
|
ifeq ($(ENABLE_OVERLAY),1)
|
|
|
|
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
|
2023-11-03 18:28:34 +00:00
|
|
|
OBJS += app/chFrScanner.o
|
|
|
|
OBJS += app/common.o
|
2023-09-09 07:03:56 +00:00
|
|
|
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
|
2023-09-29 13:01:26 +00:00
|
|
|
ifeq ($(ENABLE_SPECTRUM), 1)
|
|
|
|
OBJS += app/spectrum.o
|
|
|
|
endif
|
2023-09-09 07:03:56 +00:00
|
|
|
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
|
2023-10-05 23:18:47 +00:00
|
|
|
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
|
|
|
OBJS += ui/lock.o
|
|
|
|
endif
|
2023-09-09 07:03:56 +00:00
|
|
|
OBJS += ui/main.o
|
|
|
|
OBJS += ui/menu.o
|
|
|
|
OBJS += ui/scanner.o
|
|
|
|
OBJS += ui/status.o
|
|
|
|
OBJS += ui/ui.o
|
|
|
|
OBJS += ui/welcome.o
|
|
|
|
OBJS += version.o
|
|
|
|
OBJS += main.o
|
2024-01-11 10:26:58 +00:00
|
|
|
ifeq ($(ENABLE_MESSENGER),1)
|
|
|
|
OBJS += app/messenger.o
|
|
|
|
OBJS += ui/messenger.o
|
|
|
|
endif
|
2024-01-22 22:15:26 +00:00
|
|
|
ifeq ($(ENABLE_ENCRYPTION),1)
|
|
|
|
OBJS += external/chacha/chacha.o
|
2024-01-23 12:13:21 +00:00
|
|
|
OBJS += helper/crypto.o
|
2024-01-22 22:15:26 +00:00
|
|
|
endif
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-10-03 09:13:22 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2023-09-09 07:03:56 +00:00
|
|
|
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
else
|
|
|
|
TOP := $(shell pwd)
|
|
|
|
endif
|
|
|
|
|
2023-11-26 20:04:01 +00:00
|
|
|
ifdef OS # windows
|
|
|
|
RM = del /Q
|
|
|
|
FixPath = $(subst /,\,$1)
|
|
|
|
WHERE = where
|
|
|
|
NULL_OUTPUT = nul
|
|
|
|
else # unix
|
|
|
|
ifeq ($(shell uname), Linux)
|
|
|
|
RM = rm -f
|
|
|
|
FixPath = $1
|
|
|
|
WHERE = which
|
|
|
|
NULL_OUTPUT = /dev/null
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
AS = arm-none-eabi-gcc
|
2023-10-05 11:22:09 +00:00
|
|
|
|
|
|
|
CC =
|
2023-09-14 08:56:30 +00:00
|
|
|
LD = arm-none-eabi-gcc
|
2023-10-05 12:42:14 +00:00
|
|
|
|
2023-10-05 11:22:09 +00:00
|
|
|
ifeq ($(ENABLE_CLANG),0)
|
|
|
|
CC += arm-none-eabi-gcc
|
|
|
|
# Use GCC's linker to avoid undefined symbol errors
|
|
|
|
# LD += arm-none-eabi-gcc
|
|
|
|
else
|
|
|
|
# May need to adjust this to match your system
|
|
|
|
CC += clang --sysroot=/usr/arm-none-eabi --target=arm-none-eabi
|
|
|
|
# Bloats binaries to 512MB
|
|
|
|
# LD = ld.lld
|
|
|
|
endif
|
|
|
|
|
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-12-15 14:22:02 +00:00
|
|
|
AUTHOR_STRING := NUNU
|
2023-09-21 06:31:29 +00:00
|
|
|
# the user might not have/want git installed
|
2023-09-29 19:48:23 +00:00
|
|
|
# can set own version string here (max 7 chars)
|
2023-11-26 20:04:01 +00:00
|
|
|
ifneq (, $(shell $(WHERE) git))
|
|
|
|
VERSION_STRING := $(shell git describe --tags --exact-match 2>$(NULL_OUTPUT))
|
|
|
|
ifeq (, $(VERSION_STRING))
|
|
|
|
VERSION_STRING := $(shell git rev-parse --short HEAD)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
#VERSION_STRING := 230930b
|
2023-09-25 12:27:52 +00:00
|
|
|
|
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
|
2023-09-14 10:16:45 +00:00
|
|
|
|
2023-10-05 11:22:09 +00:00
|
|
|
CFLAGS =
|
|
|
|
ifeq ($(ENABLE_CLANG),0)
|
2024-01-26 10:26:05 +00:00
|
|
|
# Highest optimization settings (possible breaking changes):
|
2024-01-31 15:33:11 +00:00
|
|
|
CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-delete-null-pointer-checks -std=c11 -MMD
|
2024-01-26 10:26:05 +00:00
|
|
|
# Standard settings:
|
|
|
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
2023-10-05 12:42:14 +00:00
|
|
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
|
|
|
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
|
|
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
2023-10-05 11:22:09 +00:00
|
|
|
else
|
2023-10-05 12:42:14 +00:00
|
|
|
# Oz needed to make it fit on flash
|
2023-10-05 11:22:09 +00:00
|
|
|
CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
|
|
|
endif
|
2023-09-29 19:48:23 +00:00
|
|
|
|
2023-10-05 11:22:09 +00:00
|
|
|
ifeq ($(ENABLE_LTO),1)
|
2023-10-01 23:38:59 +00:00
|
|
|
CFLAGS += -flto=2
|
2023-10-04 21:24:07 +00:00
|
|
|
else
|
2023-10-05 12:42:14 +00:00
|
|
|
# We get most of the space savings if LTO creates problems
|
2023-10-04 21:24:07 +00:00
|
|
|
CFLAGS += -ffunction-sections -fdata-sections
|
2023-10-01 11:44:22 +00:00
|
|
|
endif
|
|
|
|
|
2023-10-04 21:24:07 +00:00
|
|
|
# May cause unhelpful build failures
|
2023-10-04 19:14:01 +00:00
|
|
|
#CFLAGS += -Wpadded
|
2023-10-04 21:24:07 +00:00
|
|
|
|
2023-10-05 15:28:20 +00:00
|
|
|
# catch any and all warnings
|
2023-10-16 14:52:32 +00:00
|
|
|
CFLAGS += -Wextra
|
2023-10-30 12:26:16 +00:00
|
|
|
#CFLAGS += -Wpedantic
|
2023-10-04 21:24:07 +00:00
|
|
|
|
2023-09-09 07:03:56 +00:00
|
|
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
2023-11-26 20:04:01 +00:00
|
|
|
CFLAGS += -DAUTHOR_STRING=\"$(AUTHOR_STRING)\" -DVERSION_STRING=\"$(VERSION_STRING)\"
|
2023-09-29 13:01:26 +00:00
|
|
|
|
|
|
|
ifeq ($(ENABLE_SPECTRUM),1)
|
|
|
|
CFLAGS += -DENABLE_SPECTRUM
|
|
|
|
endif
|
2023-09-16 06:08:18 +00:00
|
|
|
ifeq ($(ENABLE_SWD),1)
|
|
|
|
CFLAGS += -DENABLE_SWD
|
|
|
|
endif
|
2023-10-01 11:44:22 +00:00
|
|
|
ifeq ($(ENABLE_OVERLAY),1)
|
|
|
|
CFLAGS += -DENABLE_OVERLAY
|
|
|
|
endif
|
2023-09-14 08:56:30 +00:00
|
|
|
ifeq ($(ENABLE_AIRCOPY),1)
|
|
|
|
CFLAGS += -DENABLE_AIRCOPY
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_FMRADIO),1)
|
|
|
|
CFLAGS += -DENABLE_FMRADIO
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_UART),1)
|
|
|
|
CFLAGS += -DENABLE_UART
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_BIG_FREQ),1)
|
|
|
|
CFLAGS += -DENABLE_BIG_FREQ
|
|
|
|
endif
|
2023-09-24 00:36:43 +00:00
|
|
|
ifeq ($(ENABLE_SMALL_BOLD),1)
|
|
|
|
CFLAGS += -DENABLE_SMALL_BOLD
|
|
|
|
endif
|
2023-09-14 08:56:30 +00:00
|
|
|
ifeq ($(ENABLE_NOAA),1)
|
|
|
|
CFLAGS += -DENABLE_NOAA
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_VOICE),1)
|
|
|
|
CFLAGS += -DENABLE_VOICE
|
|
|
|
endif
|
2023-10-04 10:57:34 +00:00
|
|
|
ifeq ($(ENABLE_VOX),1)
|
|
|
|
CFLAGS += -DENABLE_VOX
|
|
|
|
endif
|
2023-09-14 08:56:30 +00:00
|
|
|
ifeq ($(ENABLE_ALARM),1)
|
|
|
|
CFLAGS += -DENABLE_ALARM
|
|
|
|
endif
|
2023-10-01 18:17:51 +00:00
|
|
|
ifeq ($(ENABLE_TX1750),1)
|
|
|
|
CFLAGS += -DENABLE_TX1750
|
2023-10-01 16:19:38 +00:00
|
|
|
endif
|
2023-10-05 23:18:47 +00:00
|
|
|
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
|
|
|
CFLAGS += -DENABLE_PWRON_PASSWORD
|
|
|
|
endif
|
2023-09-14 08:56:30 +00:00
|
|
|
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
2023-10-02 01:02:34 +00:00
|
|
|
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
2023-09-14 08:56:30 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_WIDE_RX),1)
|
|
|
|
CFLAGS += -DENABLE_WIDE_RX
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
|
|
|
CFLAGS += -DENABLE_TX_WHEN_AM
|
|
|
|
endif
|
2023-10-02 19:52:18 +00:00
|
|
|
ifeq ($(ENABLE_F_CAL_MENU),1)
|
|
|
|
CFLAGS += -DENABLE_F_CAL_MENU
|
|
|
|
endif
|
2023-09-18 17:41:26 +00:00
|
|
|
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
|
|
|
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
|
|
|
endif
|
2023-09-19 09:57:14 +00:00
|
|
|
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
|
|
|
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
|
|
|
endif
|
2023-11-06 22:18:24 +00:00
|
|
|
ifeq ($(ENABLE_NO_CODE_SCAN_TIMEOUT),1)
|
2023-10-01 09:27:10 +00:00
|
|
|
CFLAGS += -DENABLE_CODE_SCAN_TIMEOUT
|
2023-09-25 06:12:08 +00:00
|
|
|
endif
|
2023-10-03 10:32:04 +00:00
|
|
|
ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1)
|
|
|
|
CFLAGS += -DENABLE_SQUELCH_MORE_SENSITIVE
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1)
|
|
|
|
CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN
|
2023-09-22 18:48:17 +00:00
|
|
|
endif
|
2023-10-03 12:02:43 +00:00
|
|
|
ifeq ($(ENABLE_BACKLIGHT_ON_RX),1)
|
|
|
|
CFLAGS += -DENABLE_BACKLIGHT_ON_RX
|
2023-09-22 18:48:17 +00:00
|
|
|
endif
|
2023-09-29 07:43:05 +00:00
|
|
|
ifeq ($(ENABLE_RSSI_BAR),1)
|
|
|
|
CFLAGS += -DENABLE_RSSI_BAR
|
|
|
|
endif
|
2023-09-21 06:31:29 +00:00
|
|
|
ifeq ($(ENABLE_AUDIO_BAR),1)
|
|
|
|
CFLAGS += -DENABLE_AUDIO_BAR
|
|
|
|
endif
|
2023-09-26 23:26:58 +00:00
|
|
|
ifeq ($(ENABLE_COPY_CHAN_TO_VFO),1)
|
|
|
|
CFLAGS += -DENABLE_COPY_CHAN_TO_VFO
|
|
|
|
endif
|
2023-09-14 08:56:30 +00:00
|
|
|
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
|
|
|
|
CFLAGS += -DENABLE_SINGLE_VFO_CHAN
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_BAND_SCOPE),1)
|
|
|
|
CFLAGS += -DENABLE_BAND_SCOPE
|
|
|
|
endif
|
2023-12-30 12:06:33 +00:00
|
|
|
ifeq ($(ENABLE_REDUCE_LOW_POWER),1)
|
|
|
|
CFLAGS += -DENABLE_REDUCE_LOW_POWER
|
2023-10-30 15:40:03 +00:00
|
|
|
endif
|
2023-11-03 11:51:06 +00:00
|
|
|
ifeq ($(ENABLE_BYP_RAW_DEMODULATORS),1)
|
|
|
|
CFLAGS += -DENABLE_BYP_RAW_DEMODULATORS
|
|
|
|
endif
|
2023-11-06 14:51:40 +00:00
|
|
|
ifeq ($(ENABLE_BLMIN_TMP_OFF),1)
|
|
|
|
CFLAGS += -DENABLE_BLMIN_TMP_OFF
|
|
|
|
endif
|
2023-11-27 21:52:54 +00:00
|
|
|
ifeq ($(ENABLE_SCAN_RANGES),1)
|
|
|
|
CFLAGS += -DENABLE_SCAN_RANGES
|
|
|
|
endif
|
2023-12-09 16:02:53 +00:00
|
|
|
ifeq ($(ENABLE_SPECTRUM_COPY_VFO),1)
|
|
|
|
CFLAGS += -DENABLE_SPECTRUM_COPY_VFO
|
|
|
|
endif
|
2023-12-15 17:27:47 +00:00
|
|
|
ifeq ($(ENABLE_SPECTRUM_SHOW_CHANNEL_NAME),1)
|
|
|
|
CFLAGS += -DENABLE_SPECTRUM_SHOW_CHANNEL_NAME
|
|
|
|
endif
|
2023-11-28 19:11:03 +00:00
|
|
|
ifeq ($(ENABLE_DTMF_CALLING),1)
|
|
|
|
CFLAGS += -DENABLE_DTMF_CALLING
|
|
|
|
endif
|
2023-12-25 01:52:12 +00:00
|
|
|
ifeq ($(ENABLE_SPECTRUM_CHANNEL_SCAN),1)
|
|
|
|
CFLAGS += -DENABLE_SPECTRUM_CHANNEL_SCAN
|
|
|
|
endif
|
2024-01-11 10:26:58 +00:00
|
|
|
ifeq ($(ENABLE_MESSENGER),1)
|
|
|
|
CFLAGS += -DENABLE_MESSENGER
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_MESSENGER_DELIVERY_NOTIFICATION),1)
|
|
|
|
CFLAGS += -DENABLE_MESSENGER_DELIVERY_NOTIFICATION
|
|
|
|
endif
|
2024-02-02 17:51:17 +00:00
|
|
|
ifeq ($(ENABLE_MESSENGER_FSK_MUTE),1)
|
|
|
|
CFLAGS += -DENABLE_MESSENGER_FSK_MUTE
|
|
|
|
endif
|
2024-01-11 10:26:58 +00:00
|
|
|
ifeq ($(ENABLE_MESSENGER_NOTIFICATION),1)
|
|
|
|
CFLAGS += -DENABLE_MESSENGER_NOTIFICATION
|
|
|
|
endif
|
|
|
|
ifeq ($(ENABLE_MESSENGER_UART),1)
|
|
|
|
CFLAGS += -DENABLE_MESSENGER_UART
|
|
|
|
endif
|
2024-01-22 22:15:26 +00:00
|
|
|
ifeq ($(ENABLE_ENCRYPTION),1)
|
|
|
|
CFLAGS += -DENABLE_ENCRYPTION
|
|
|
|
endif
|
2023-09-10 08:57:49 +00:00
|
|
|
|
2023-10-05 11:22:09 +00:00
|
|
|
LDFLAGS =
|
|
|
|
ifeq ($(ENABLE_CLANG),0)
|
|
|
|
LDFLAGS += -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
|
|
|
else
|
|
|
|
# Fix warning about implied executable stack
|
2023-12-22 22:27:45 +00:00
|
|
|
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld, -V
|
2023-10-05 11:22:09 +00:00
|
|
|
endif
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-10-04 13:55:58 +00:00
|
|
|
# Use newlib-nano instead of newlib
|
|
|
|
LDFLAGS += --specs=nano.specs
|
|
|
|
|
2023-10-05 11:22:09 +00:00
|
|
|
ifeq ($(ENABLE_LTO),0)
|
2023-10-05 12:42:14 +00:00
|
|
|
# Throw away unneeded func/data sections like LTO does
|
2023-10-04 21:24:07 +00:00
|
|
|
LDFLAGS += -Wl,--gc-sections
|
|
|
|
endif
|
|
|
|
|
2023-09-09 07:03:56 +00:00
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
ASFLAGS += -g
|
2023-10-05 12:42:14 +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)
|
|
|
|
|
2023-11-26 20:04:01 +00:00
|
|
|
|
2023-11-01 19:05:59 +00:00
|
|
|
|
|
|
|
ifneq (, $(shell $(WHERE) python))
|
|
|
|
MY_PYTHON := python
|
|
|
|
else ifneq (, $(shell $(WHERE) python3))
|
|
|
|
MY_PYTHON := python3
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef MY_PYTHON
|
|
|
|
HAS_CRCMOD := $(shell $(MY_PYTHON) -c "import crcmod" 2>&1)
|
|
|
|
endif
|
|
|
|
|
2023-09-09 07:03:56 +00:00
|
|
|
all: $(TARGET)
|
|
|
|
$(OBJCOPY) -O binary $< $<.bin
|
2023-11-01 19:05:59 +00:00
|
|
|
|
|
|
|
ifndef MY_PYTHON
|
|
|
|
$(info )
|
|
|
|
$(info !!!!!!!! PYTHON NOT FOUND, *.PACKED.BIN WON'T BE BUILT)
|
|
|
|
$(info )
|
|
|
|
else ifneq (,$(HAS_CRCMOD))
|
|
|
|
$(info )
|
|
|
|
$(info !!!!!!!! CRCMOD NOT INSTALLED, *.PACKED.BIN WON'T BE BUILT)
|
|
|
|
$(info !!!!!!!! run: pip install crcmod)
|
|
|
|
$(info )
|
|
|
|
else
|
2023-11-26 20:04:01 +00:00
|
|
|
-$(MY_PYTHON) fw-pack.py $<.bin $(AUTHOR_STRING) $(VERSION_STRING) $<.packed.bin
|
2023-11-01 19:05:59 +00:00
|
|
|
endif
|
|
|
|
|
2023-09-09 07:03:56 +00:00
|
|
|
$(SIZE) $<
|
|
|
|
|
|
|
|
debug:
|
|
|
|
/opt/openocd/bin/openocd -c "bindto 0.0.0.0" -f interface/jlink.cfg -f dp32g030.cfg
|
|
|
|
|
|
|
|
flash:
|
2023-12-26 13:07:44 +00:00
|
|
|
k5prog -F -YYY -b compiled-firmware/firmware.bin
|
|
|
|
|
|
|
|
docker:
|
|
|
|
./compile-with-docker.sh
|
2023-12-01 09:59:42 +00:00
|
|
|
|
|
|
|
flash-openocd:
|
2023-09-09 07:03:56 +00:00
|
|
|
/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:
|
2023-11-01 19:05:59 +00:00
|
|
|
$(RM) $(call FixPath, $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS))
|
2023-12-18 11:46:23 +00:00
|
|
|
|
|
|
|
run:
|
2023-12-26 13:07:44 +00:00
|
|
|
make docker && make flash
|