Files
uv-k1-k5v3-firmware-custom/App/CMakeLists.txt
T

290 lines
8.5 KiB
CMake

add_library(App INTERFACE)
target_include_directories(App INTERFACE .)
target_link_libraries(App INTERFACE PY32F071_Driver)
target_compile_definitions(App INTERFACE PRINTF_INCLUDE_CONFIG_H)
target_sources(App INTERFACE
# Drivers
driver/backlight.c
driver/bk4829.c
driver/py25q16.c
driver/gpio.c
driver/i2c.c
driver/keyboard.c
driver/st7565.c
driver/system.c
driver/systick.c
# Main
app/action.c
app/app.c
app/chFrScanner.c
app/common.c
app/dtmf.c
app/generic.c
app/main.c
app/menu.c
app/scanner.c
audio.c
bitmaps.c
board.c
dcs.c
font.c
frequencies.c
functions.c
helper/battery.c
helper/boot.c
misc.c
radio.c
scheduler.c
settings.c
ui/battery.c
ui/helper.c
ui/inputbox.c
ui/main.c
ui/menu.c
ui/scanner.c
ui/status.c
ui/ui.c
ui/welcome.c
"version.c"
main.c
external/printf/printf.c
)
macro(enable_feature feature)
if(${feature})
target_compile_definitions(App INTERFACE ${feature})
if(${ARGC} GREATER 1)
target_sources(App INTERFACE ${ARGN})
endif()
endif()
endmacro()
# compile options (see README.md for descriptions)
if(ENABLE_FEAT_F4HWN)
target_compile_definitions(App INTERFACE
"AUTHOR_STRING_1=\"${AUTHOR_STRING_1}\""
"AUTHOR_STRING_2=\"${AUTHOR_STRING_2}\""
"VERSION_STRING_1=\"${VERSION_STRING_1}\""
"VERSION_STRING_2=\"${VERSION_STRING_2}\""
"DISPLAY_VERSION_STRING_2=\"${DISPLAY_VERSION_STRING_2}\""
"EDITION_STRING=\"${EDITION_STRING}\""
ALERT_TOT=10
)
endif()
target_compile_definitions(App INTERFACE
"AUTHOR_STRING=\"${AUTHOR_STRING}\""
"VERSION_STRING=\"${VERSION_STRING}\""
"BUILD_COMMIT=\"${BUILD_COMMIT}\""
)
if(NOT SQL_TONE)
set(SQL_TONE 550) # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open
endif()
target_compile_definitions(App INTERFACE SQL_TONE=${SQL_TONE})
if(ENABLE_AIRCOPY OR ENABLE_UART OR ENABLE_USB)
target_sources(App INTERFACE
driver/crc.c
driver/eeprom_compat.c
)
endif()
enable_feature(ENABLE_UART
driver/uart.c
# driver/aes.c
)
if(ENABLE_USB)
target_link_libraries(App INTERFACE CherryUSB)
target_compile_definitions(App INTERFACE ENABLE_USB)
target_include_directories(App INTERFACE usb)
target_sources(App INTERFACE
driver/vcp.c
usb/usbd_cdc_if.c
)
endif()
if(ENABLE_UART OR ENABLE_USB)
target_sources(App INTERFACE
app/uart.c
)
endif()
# ---- STOCK QUANSHENG FEATURES ----
# ENABLE_FMRADIO compiles the BK1080 driver and the FM logic/helpers (fm.c).
# The resident FM *screen* (ui/fmradio.c) is redundant with the FM overlay app,
# so it is dropped when OVERLAY_APPS is on - the overlay app reaches the driver
# and the fm.c helpers through the ABI instead, and ACTION_FM's launcher body is
# neutralised in action.c so the resident screen can never open.
enable_feature(ENABLE_FMRADIO
driver/bk1080.c
app/fm.c
)
if(ENABLE_FMRADIO AND NOT ENABLE_FEAT_F4HWN_OVERLAY_APPS)
target_sources(App INTERFACE ui/fmradio.c)
endif()
enable_feature(ENABLE_AIRCOPY
app/aircopy.c
ui/aircopy.c
)
enable_feature(ENABLE_NOAA)
enable_feature(ENABLE_VOICE
driver/voice.c
)
enable_feature(ENABLE_VOX)
enable_feature(ENABLE_TX1750)
enable_feature(ENABLE_PWRON_PASSWORD
ui/lock.c
)
enable_feature(ENABLE_DTMF_CALLING)
enable_feature(ENABLE_FLASHLIGHT
app/flashlight.c
)
# ---- CUSTOM MODS ----
enable_feature(ENABLE_SPECTRUM
app/spectrum.c
)
enable_feature(ENABLE_BIG_FREQ)
enable_feature(ENABLE_SMALL_BOLD)
enable_feature(ENABLE_CUSTOM_MENU_LAYOUT)
enable_feature(ENABLE_KEEP_MEM_NAME)
enable_feature(ENABLE_WIDE_RX)
enable_feature(ENABLE_F_CAL_MENU)
enable_feature(ENABLE_CTCSS_TAIL_PHASE_SHIFT)
enable_feature(ENABLE_BOOT_BEEPS)
enable_feature(ENABLE_SHOW_CHARGE_LEVEL)
enable_feature(ENABLE_REVERSE_BAT_SYMBOL)
enable_feature(ENABLE_NO_CODE_SCAN_TIMEOUT)
enable_feature(ENABLE_SQUELCH_MORE_SENSITIVE)
enable_feature(ENABLE_FASTER_CHANNEL_SCAN)
enable_feature(ENABLE_RSSI_BAR)
enable_feature(ENABLE_AUDIO_BAR)
enable_feature(ENABLE_FEAT_F4HWN_AUDIO_SCOPE)
enable_feature(ENABLE_COPY_CHAN_TO_VFO)
enable_feature(ENABLE_REDUCE_LOW_MID_TX_POWER)
enable_feature(ENABLE_BYP_RAW_DEMODULATORS)
enable_feature(ENABLE_SCAN_RANGES)
# ---- CONTRIB MODS ----
# Thank you @reppad
enable_feature(ENABLE_EXTRA_UART_CMD)
# ---- F4HWN MODS ----
if(NOT ENABLE_UART AND NOT ENABLE_USB)
if(ENABLE_FEAT_F4HWN_K5VIEWER OR ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER)
message(STATUS "Disabling K5Viewer because both ENABLE_UART and ENABLE_USB are OFF.")
endif()
set(ENABLE_FEAT_F4HWN_K5VIEWER OFF)
set(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER OFF)
endif()
enable_feature(ENABLE_FEAT_F4HWN)
# GAME keeps the F+7 hook; the resident breakout.c is compiled only when the
# overlay does NOT provide Breakout as an app (that is the flash we recover).
if(ENABLE_FEAT_F4HWN_GAME)
target_compile_definitions(App INTERFACE ENABLE_FEAT_F4HWN_GAME)
if(NOT ENABLE_FEAT_F4HWN_OVERLAY_APPS)
target_sources(App INTERFACE app/breakout.c)
endif()
endif()
enable_feature(ENABLE_FEAT_F4HWN_OVERLAY_APPS
apps/app_overlay.c
apps/app_menu.c
)
if(ENABLE_FEAT_F4HWN_OVERLAY_APPS AND NOT ENABLE_FEAT_F4HWN_MULTIBOOT_OVERLAY)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_OVERLAY_APPS requires ENABLE_FEAT_F4HWN_MULTIBOOT_OVERLAY (the 4 KiB overlay workspace).")
endif()
enable_feature(ENABLE_FEAT_F4HWN_K5VIEWER
k5viewer.c
)
enable_feature(ENABLE_FEAT_F4HWN_SPECTRUM)
enable_feature(ENABLE_FEAT_F4HWN_RX_TX_TIMER)
enable_feature(ENABLE_FEAT_F4HWN_CHARGING_C)
enable_feature(ENABLE_FEAT_F4HWN_SLEEP)
enable_feature(ENABLE_FEAT_F4HWN_RESUME_STATE)
enable_feature(ENABLE_FEAT_F4HWN_NARROWER)
enable_feature(ENABLE_FEAT_F4HWN_INV)
enable_feature(ENABLE_FEAT_F4HWN_CTR)
enable_feature(ENABLE_FEAT_F4HWN_SCAN_PROGRESS)
enable_feature(ENABLE_FEAT_F4HWN_SCAN_FASTER)
enable_feature(ENABLE_FEAT_F4HWN_SCAN_RSSI)
enable_feature(ENABLE_FEAT_F4HWN_SCAN_SUBAUDIBLE)
enable_feature(ENABLE_FEAT_F4HWN_RESCUE_OPS)
enable_feature(ENABLE_FEAT_F4HWN_VOL)
enable_feature(ENABLE_FEAT_F4HWN_AUDIO)
enable_feature(ENABLE_FEAT_F4HWN_RESET_VFO)
enable_feature(ENABLE_FEAT_F4HWN_PMR)
enable_feature(ENABLE_FEAT_F4HWN_GMRS_FRS_MURS)
enable_feature(ENABLE_FEAT_F4HWN_CA)
enable_feature(ENABLE_FEAT_F4HWN_DEBUG)
enable_feature(ENABLE_FEAT_F4HWN_MEM)
enable_feature(ENABLE_FEAT_F4HWN_BEAM
app/beam.c
)
enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG
app/rxtx_log.c
)
enable_feature(ENABLE_FEAT_F4HWN_FOXHUNT
app/foxhunt.c
)
enable_feature(ENABLE_FEAT_F4HWN_ACTION_PICKER)
if(ENABLE_FEAT_F4HWN_ACTION_PICKER AND NOT ENABLE_FEAT_F4HWN)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_ACTION_PICKER requires ENABLE_FEAT_F4HWN.")
endif()
enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG_WRAP)
enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER)
if(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER AND NOT (ENABLE_FEAT_F4HWN_RXTX_LOG AND ENABLE_FEAT_F4HWN_K5VIEWER))
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER requires ENABLE_FEAT_F4HWN_RXTX_LOG (log data) and ENABLE_FEAT_F4HWN_K5VIEWER (serial transport).")
endif()
if(ENABLE_FEAT_F4HWN_BEAM AND NOT ENABLE_AIRCOPY)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_BEAM requires ENABLE_AIRCOPY (it reuses g_FSK_Buffer, AIRCOPY_Obfuscate and the FSK packet plumbing).")
endif()
enable_feature(ENABLE_FEAT_F4HWN_MULTIBOOT
driver/mb_flash.c
ui/multiboot.c
)
if(ENABLE_FEAT_F4HWN_MULTIBOOT AND NOT ENABLE_FEAT_F4HWN)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_MULTIBOOT requires ENABLE_FEAT_F4HWN (the SetCfg menu, SysInfo badge and multiboot UI all live under ENABLE_FEAT_F4HWN).")
endif()
enable_feature(ENABLE_FEAT_F4HWN_MULTIBOOT_OVERLAY)
if(ENABLE_FEAT_F4HWN_MULTIBOOT_OVERLAY AND NOT ENABLE_FEAT_F4HWN_MULTIBOOT)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_MULTIBOOT_OVERLAY requires ENABLE_FEAT_F4HWN_MULTIBOOT.")
endif()
enable_feature(ENABLE_FEAT_F4HWN_QRCODE)
enable_feature(ENABLE_FEAT_F4HWN_LOGO)
enable_feature(ENABLE_FEAT_F4HWN_LOGO_SAV)
enable_feature(ENABLE_FEAT_F4HWN_MENU_CAT)
if(ENABLE_FEAT_F4HWN_LOGO_SAV AND NOT ENABLE_FEAT_F4HWN_LOGO)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_LOGO_SAV requires ENABLE_FEAT_F4HWN_LOGO.")
endif()
if(ENABLE_FEAT_F4HWN_MENU_CAT AND NOT ENABLE_FEAT_F4HWN)
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_MENU_CAT requires ENABLE_FEAT_F4HWN.")
endif()
# ---- DEBUGGING ----
enable_feature(ENABLE_AGC_SHOW_DATA)
enable_feature(ENABLE_UART_RW_BK_REGS)
# ---- COMPILER/LINKER OPTIONS ----
enable_feature(ENABLE_SWD)