kopia lustrzana https://github.com/OpenRTX/OpenRTX
update
rodzic
2fccb747ff
commit
35e9630ca5
|
@ -0,0 +1,153 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
#
|
||||
# Zephyr build system imposes to have a fixed folder structure for the target-specific
|
||||
# files, that is [...]/boards/ARCH/BOARDNAME because it infers the target
|
||||
# architecture by looking at the name of the parent folder of the board folder.
|
||||
#
|
||||
# This does not make sense, because:
|
||||
# 1) The folder with the target-specific files should be put anywhere, given that
|
||||
# the project using Zephyr may have its own conventions.
|
||||
# 2) Inferring the target architecture only from the folder tree is an idiocy.
|
||||
#
|
||||
# So: to make Zephyr play happily in his sandpit without complaints, we create a
|
||||
# board_root subfolder inside the build one and we copy the board-specific config
|
||||
# files there from our platform/targets tree creating the necessary folder tree.
|
||||
#
|
||||
# NOTE: the board-specific CMakeLists.txt files have to use the ${OPENRTX_ROOT}
|
||||
# variable as the base path. E.g. ${OPENRTX_ROOT}/platform/drivers/somedriver.c
|
||||
#
|
||||
if (${BOARD} STREQUAL "ttwrplus")
|
||||
set(ARCH xtensa)
|
||||
set(CONF_FILE ${CMAKE_CURRENT_LIST_DIR}/platform/mcu/ESP32S3/zephyr.conf)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Create the board_root folder and the proper folder tree for the targets
|
||||
#
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/platform/targets/${BOARD}
|
||||
${CMAKE_CURRENT_LIST_DIR}/build/board_root/boards/${ARCH}/${BOARD})
|
||||
|
||||
#
|
||||
# Set the BOARD_ROOT and OPENRTX_ROOT variables
|
||||
#
|
||||
set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR}/build/board_root)
|
||||
set(OPENRTX_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
#
|
||||
# Finally, set up the project
|
||||
#
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(openrtx)
|
||||
|
||||
execute_process(COMMAND git describe --tags --dirty --always
|
||||
OUTPUT_VARIABLE GIT_VER_ID
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
target_compile_definitions(app
|
||||
PRIVATE
|
||||
_GNU_SOURCE
|
||||
FONT_UBUNTU_REGULAR
|
||||
CODEC2_MODE_EN_DEFAULT=0
|
||||
FREEDV_MODE_EN_DEFAULT=0
|
||||
CODEC2_MODE_3200_EN=1
|
||||
M_PI=3.14159265358979323846f
|
||||
GIT_VERSION="${GIT_VER_ID}"
|
||||
)
|
||||
|
||||
target_include_directories(app
|
||||
PRIVATE
|
||||
|
||||
openrtx/include
|
||||
openrtx/include/rtx
|
||||
openrtx/include/core
|
||||
openrtx/include/calibration
|
||||
openrtx/include/protocols
|
||||
openrtx/include/fonts/adafruit
|
||||
openrtx/include/fonts/symbols
|
||||
platform/drivers/ADC
|
||||
platform/drivers/NVM
|
||||
platform/drivers/GPS
|
||||
platform/drivers/USB
|
||||
platform/drivers/tones
|
||||
platform/drivers/baseband
|
||||
platform/drivers/backlight
|
||||
platform/drivers/chSelector
|
||||
|
||||
subprojects/codec2
|
||||
subprojects/codec2/src
|
||||
|
||||
lib/minmea/include
|
||||
lib/qdec/include
|
||||
)
|
||||
|
||||
target_sources(app
|
||||
PRIVATE
|
||||
|
||||
openrtx/src/main.c
|
||||
openrtx/src/core/state.c
|
||||
openrtx/src/core/threads.c
|
||||
openrtx/src/core/battery.c
|
||||
openrtx/src/core/graphics.c
|
||||
openrtx/src/core/input.c
|
||||
openrtx/src/core/utils.c
|
||||
openrtx/src/core/queue.c
|
||||
openrtx/src/core/chan.c
|
||||
openrtx/src/core/gps.c
|
||||
openrtx/src/core/dsp.cpp
|
||||
openrtx/src/core/cps.c
|
||||
openrtx/src/core/crc.c
|
||||
openrtx/src/core/datetime.c
|
||||
openrtx/src/core/openrtx.c
|
||||
openrtx/src/core/audio_codec.c
|
||||
openrtx/src/core/audio_stream.c
|
||||
openrtx/src/core/audio_path.cpp
|
||||
openrtx/src/core/data_conversion.c
|
||||
openrtx/src/core/memory_profiling.cpp
|
||||
openrtx/src/core/voicePrompts.c
|
||||
openrtx/src/core/voicePromptUtils.c
|
||||
openrtx/src/core/voicePromptData.S
|
||||
openrtx/src/core/nvmem_access.c
|
||||
openrtx/src/rtx/rtx.cpp
|
||||
openrtx/src/rtx/OpMode_FM.cpp
|
||||
openrtx/src/rtx/OpMode_M17.cpp
|
||||
openrtx/src/protocols/M17/M17DSP.cpp
|
||||
openrtx/src/protocols/M17/M17Golay.cpp
|
||||
openrtx/src/protocols/M17/M17Callsign.cpp
|
||||
openrtx/src/protocols/M17/M17Modulator.cpp
|
||||
openrtx/src/protocols/M17/M17Demodulator.cpp
|
||||
openrtx/src/protocols/M17/M17FrameEncoder.cpp
|
||||
openrtx/src/protocols/M17/M17FrameDecoder.cpp
|
||||
openrtx/src/protocols/M17/M17LinkSetupFrame.cpp
|
||||
|
||||
openrtx/src/ui/default/ui.c
|
||||
openrtx/src/ui/default/ui_main.c
|
||||
openrtx/src/ui/default/ui_menu.c
|
||||
openrtx/src/ui/default/ui_strings.c
|
||||
|
||||
subprojects/codec2/src/dump.c
|
||||
subprojects/codec2/src/lpc.c
|
||||
subprojects/codec2/src/nlp.c
|
||||
subprojects/codec2/src/phase.c
|
||||
subprojects/codec2/src/quantise.c
|
||||
subprojects/codec2/src/postfilter.c
|
||||
subprojects/codec2/src/codec2.c
|
||||
subprojects/codec2/src/codec2_fft.c
|
||||
subprojects/codec2/src/lsp.c
|
||||
subprojects/codec2/src/sine.c
|
||||
subprojects/codec2/src/interp.c
|
||||
subprojects/codec2/src/kiss_fft.c
|
||||
subprojects/codec2/src/kiss_fftr.c
|
||||
subprojects/codec2/src/newamp1.c
|
||||
subprojects/codec2/src/codebook.c
|
||||
subprojects/codec2/src/codebookd.c
|
||||
subprojects/codec2/src/pack.c
|
||||
subprojects/codec2/src/codebooknewamp1.c
|
||||
subprojects/codec2/src/codebooknewamp1_energy.c
|
||||
|
||||
lib/minmea/minmea.c
|
||||
)
|
|
@ -1,4 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
include(cmake/ConfigureTarget.cmake)
|
||||
project(OpenRTX)
|
||||
|
||||
|
@ -7,6 +9,13 @@ find_program(BIN2SGL "bin2sgl.${CMAKE_HOST_SYSTEM_NAME}"
|
|||
PATHS scripts
|
||||
)
|
||||
|
||||
if(NOT OPENRTX_LINUX_FLAVOR)
|
||||
set(OPENRTX_LINUX_FLAVOR "default")
|
||||
endif()
|
||||
if(NOT OPENRTX_UI)
|
||||
set(OPENRTX_UI "default")
|
||||
endif()
|
||||
|
||||
include(cmake/TargetOptions.cmake)
|
||||
|
||||
# These should not be global
|
||||
|
@ -40,11 +49,13 @@ add_subdirectory(platform)
|
|||
add_subdirectory(openrtx)
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(subprojects)
|
||||
#add_subdirectory(tests)
|
||||
|
||||
add_executable(OpenRTX
|
||||
openrtx/src/main.c
|
||||
)
|
||||
|
||||
|
||||
target_link_libraries(OpenRTX PUBLIC Core Protocols RTX UI codec2 minmea)
|
||||
|
||||
if(OPENRTX_TARGET STREQUAL "linux")
|
||||
|
@ -75,6 +86,20 @@ elseif( OPENRTX_TARGET STREQUAL "gd77"
|
|||
-Wl,--print-memory-usage
|
||||
)
|
||||
|
||||
add_custom_target(OpenRTX_bin ALL
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary OpenRTX OpenRTX.bin
|
||||
DEPENDS OpenRTX
|
||||
BYPRODUCTS OpenRTX.bin
|
||||
COMMENT "Objcopy OpenRTX -> OpenRTX.bin"
|
||||
)
|
||||
elseif( OPENRTX_TARGET STREQUAL "module17")
|
||||
target_link_libraries(OpenRTX PUBLIC Miosix)
|
||||
|
||||
target_link_options(OpenRTX PUBLIC
|
||||
-Wl,-T../platform/mcu/STM32F4xx/linker_script_Mod17.ld
|
||||
-Wl,--print-memory-usage
|
||||
)
|
||||
|
||||
add_custom_target(OpenRTX_bin ALL
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary OpenRTX OpenRTX.bin
|
||||
DEPENDS OpenRTX
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set(OPENRTX_AVAILABLE_TARGETS linux md3x0 mduv3x0 md9600 gd77 dm1801 mod17)
|
||||
set(OPENRTX_AVAILABLE_TARGETS linux md3x0 mduv3x0 md9600 gd77 dm1801 module17)
|
||||
set(OPENRTX_TARGET linux CACHE STRING "Specify the build target")
|
||||
set_property(CACHE OPENRTX_TARGET PROPERTY STRINGS ${OPENRTX_AVAILABLE_TARGETS})
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
if(OPENRTX_TARGET STREQUAL "linux")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address,undefined")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address,undefined")
|
||||
|
||||
|
@ -6,7 +10,39 @@ if(OPENRTX_TARGET STREQUAL "linux")
|
|||
find_package(Codec2 REQUIRED)
|
||||
|
||||
add_compile_definitions(-DPLATFORM_LINUX)
|
||||
add_compile_definitions(-DSCREEN_WIDTH=160 -DSCREEN_HEIGHT=128 -DPIX_FMT_RGB565)
|
||||
add_compile_definitions(-Dsniprintf=snprintf -Dvsniprintf=vsnprintf)
|
||||
|
||||
if(OPENRTX_LINUX_FLAVOR STREQUAL "default")
|
||||
add_compile_definitions(
|
||||
-DCONFIG_SCREEN_WIDTH=160
|
||||
-DCONFIG_SCREEN_HEIGHT=128
|
||||
-DCONFIG_PIX_FMT_RGB565
|
||||
-DCONFIG_GPS
|
||||
-DCONFIG_RTC
|
||||
)
|
||||
elseif(OPENRTX_LINUX_FLAVOR STREQUAL "small")
|
||||
add_compile_definitions(
|
||||
-DCONFIG_SCREEN_WIDTH=128
|
||||
-DCONFIG_SCREEN_HEIGHT=64
|
||||
-DCONFIG_PIX_FMT_BW
|
||||
-DCONFIG_GPS
|
||||
-DCONFIG_RTC
|
||||
)
|
||||
elseif(OPENRTX_LINUX_FLAVOR STREQUAL "module17")
|
||||
set(OPENRTX_UI module17)
|
||||
add_compile_definitions(
|
||||
-DCONFIG_SCREEN_WIDTH=128
|
||||
-DCONFIG_SCREEN_HEIGHT=64
|
||||
-DCONFIG_PIX_FMT_BW
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Invalid variable OPENRTX_LINUX_FLAVOR. "
|
||||
"Please choose one between: default, small, module17.")
|
||||
endif()
|
||||
|
||||
message("Using linux flavor: ${OPENRTX_LINUX_FLAVOR}")
|
||||
|
||||
elseif(OPENRTX_TARGET STREQUAL "md3x0")
|
||||
add_compile_definitions(-DPLATFORM_MD3x0 -Dtimegm=mktime)
|
||||
add_compile_definitions(STM32F405xx HSE_VALUE=8000000)
|
||||
|
@ -35,5 +71,6 @@ elseif(OPENRTX_TARGET STREQUAL "dm1801")
|
|||
|
||||
set(TARGET_WRAP DM-1801)
|
||||
set(TARGET_LOAD_ADDR 0x0800C000)
|
||||
elseif(OPENRTX_TARGET STREQUAL "mod17")
|
||||
elseif(OPENRTX_TARGET STREQUAL "module17")
|
||||
add_compile_definitions(-DPLATFORM_MOD17)
|
||||
endif()
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
file(GLOB_RECURSE SOURCE_FILES default/*.c default/*.cpp)
|
||||
file(GLOB_RECURSE DEFAULT_SRC default/*.c default/*.cpp)
|
||||
file(GLOB_RECURSE MODULE17_SRC module17/*.c module17/*.cpp)
|
||||
|
||||
add_library(UI STATIC ${SOURCE_FILES})
|
||||
if(OPENRTX_TARGET STREQUAL "linux")
|
||||
# Hack: build UI anyway for testing
|
||||
add_library(UIDefault STATIC ${DEFAULT_SRC})
|
||||
endif()
|
||||
|
||||
add_library(UI STATIC)
|
||||
|
||||
if(NOT OPENRTX_UI)
|
||||
set(OPENRTX_UI "default")
|
||||
endif()
|
||||
|
||||
if(OPENRTX_UI STREQUAL "default")
|
||||
target_sources(UI INTERFACE ${DEFAULT_SRC})
|
||||
elseif(OPENRTX_UI STREQUAL "module17")
|
||||
target_sources(UI PRIVATE ${MODULE17_SRC})
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid OPENRTX_UI '${OPENRTX_UI}'."
|
||||
"Please choose one between: default, module17.")
|
||||
endif()
|
||||
|
||||
message("Using OpenRTX UI: ${OPENRTX_UI}")
|
||||
target_link_libraries(UI PRIVATE Core Platform)
|
||||
|
|
|
@ -192,6 +192,27 @@ set(dm1801_sources
|
|||
targets/DM-1801/platform.c
|
||||
)
|
||||
|
||||
##
|
||||
## Module 17
|
||||
##
|
||||
set(module17_includes targets/Module17)
|
||||
set(module17_defines -DPLATFORM_MOD17)
|
||||
set(module17_sources
|
||||
drivers/ADC/ADC1_Mod17.c
|
||||
drivers/CPS/cps_io_native_Mod17.c
|
||||
drivers/NVM/nvmem_Mod17.c
|
||||
drivers/audio/MAX9814_Mod17.cpp
|
||||
drivers/audio/audio_Mod17.c
|
||||
drivers/baseband/MCP4551_Mod17.cpp
|
||||
drivers/baseband/radio_Mod17.cpp
|
||||
drivers/display/SH110x_Mod17.c
|
||||
drivers/keyboard/keyboard_Mod17.c
|
||||
targets/Module17/platform.c
|
||||
)
|
||||
|
||||
##
|
||||
## Linux
|
||||
##
|
||||
set(linux_sources
|
||||
drivers/CPS/cps_io_libc.c
|
||||
drivers/GPS/GPS_linux.c
|
||||
|
@ -218,43 +239,36 @@ target_include_directories(Platform PUBLIC ${general_includes})
|
|||
target_link_libraries(Platform PUBLIC Core)
|
||||
|
||||
if(OPENRTX_TARGET STREQUAL "md3x0")
|
||||
|
||||
target_sources(Platform PRIVATE ${md3x0_sources} ${stm32f405_sources})
|
||||
target_include_directories(Platform PUBLIC ${md3x0_includes} ${stm32f405_includes})
|
||||
target_compile_definitions(Platform PUBLIC ${md3x0_defines} ${stm32f405_defines})
|
||||
target_link_libraries(Platform PUBLIC Miosix)
|
||||
|
||||
elseif(OPENRTX_TARGET STREQUAL "mduv3x0")
|
||||
|
||||
target_sources(Platform PRIVATE ${mduv3x0_sources} ${stm32f405_sources})
|
||||
target_include_directories(Platform PUBLIC ${mduv3x0_includes} ${stm32f405_includes})
|
||||
target_compile_definitions(Platform PUBLIC ${mduv3x0_defines} ${stm32f405_defines})
|
||||
target_link_libraries(Platform PUBLIC Miosix qdec)
|
||||
|
||||
elseif(OPENRTX_TARGET STREQUAL "md9600")
|
||||
|
||||
target_sources(Platform PRIVATE ${md9600_sources} ${stm32f405_sources})
|
||||
target_include_directories(Platform PUBLIC ${md9600_includes} ${stm32f405_includes})
|
||||
target_compile_definitions(Platform PUBLIC ${md9600_defines} ${stm32f405_defines})
|
||||
target_link_libraries(Platform PUBLIC Miosix qdec)
|
||||
|
||||
elseif(OPENRTX_TARGET STREQUAL "gd77")
|
||||
|
||||
target_sources(Platform PRIVATE ${gd77_sources} ${mk22fn512_sources})
|
||||
target_include_directories(Platform PUBLIC ${gd77_includes} ${mk22fn512_includes})
|
||||
target_compile_definitions(Platform PUBLIC ${gd77_defines} ${mk22fn512_defines})
|
||||
target_link_libraries(Platform PUBLIC Miosix qdec)
|
||||
|
||||
elseif(OPENRTX_TARGET STREQUAL "dm1801")
|
||||
|
||||
target_sources(Platform PRIVATE ${dm1801_sources} ${mk22fn512_sources})
|
||||
target_include_directories(Platform PUBLIC ${dm1801_includes} ${mk22fn512_includes})
|
||||
target_compile_definitions(Platform PUBLIC ${dm1801_defines} ${mk22fn512_defines})
|
||||
target_link_libraries(Platform PUBLIC Miosix qdec)
|
||||
|
||||
elseif(OPENRTX_TARGET STREQUAL "module17")
|
||||
target_sources(Platform PRIVATE ${module17_sources} ${stm32f405_sources})
|
||||
target_include_directories(Platform PUBLIC ${module17_includes} ${stm32f405_includes})
|
||||
target_compile_definitions(Platform PUBLIC ${module17_defines} ${stm32f405_defines})
|
||||
target_link_libraries(Platform PUBLIC Miosix qdec)
|
||||
elseif(OPENRTX_TARGET STREQUAL "linux")
|
||||
|
||||
target_sources(Platform PRIVATE ${linux_sources})
|
||||
target_include_directories(Platform PUBLIC ${linux_includes})
|
||||
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
if(OPENRTX_TARGET STREQUAL "linux")
|
||||
enable_testing()
|
||||
add_subdirectory(unit)
|
||||
endif()
|
|
@ -0,0 +1,25 @@
|
|||
find_package(Threads REQUIRED)
|
||||
|
||||
function(add_unit_test test_name test_file)
|
||||
add_executable(${test_name} ${test_file})
|
||||
add_test(${test_name} ${test_name})
|
||||
target_compile_definitions(${test_name} PUBLIC -DPLATFORM_LINUX)
|
||||
target_link_libraries(${test_name} PUBLIC
|
||||
Core
|
||||
Protocols
|
||||
RTX
|
||||
UIDefault
|
||||
SDL2::SDL2
|
||||
Threads::Threads
|
||||
codec2
|
||||
)
|
||||
endfunction()
|
||||
|
||||
add_unit_test(m17_golay_test M17_golay.cpp)
|
||||
add_unit_test(m17_viterbi_test M17_viterbi.cpp)
|
||||
add_unit_test(m17_rrc_test M17_rrc.cpp)
|
||||
add_unit_test(cps_test cps.c)
|
||||
#add_unit_test(linux_inputStream linux_inputStream_test.cpp)
|
||||
add_unit_test(sine_test play_sine.c)
|
||||
#add_unit_test(m17_demodulator_test M17_demodulator.cpp)
|
||||
#add_unit_test(vp_test voice_prompts.c)
|
Ładowanie…
Reference in New Issue