refactor: bootloader & cmake cleanup (#5232)
This commit is contained in:
@@ -254,6 +254,11 @@ if(SDCARD)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC})
|
||||
endif()
|
||||
|
||||
if(BLUETOOTH)
|
||||
add_definitions(-DBLUETOOTH)
|
||||
set(SRC ${SRC} bluetooth.cpp)
|
||||
endif()
|
||||
|
||||
if(SHUTDOWN_CONFIRMATION)
|
||||
add_definitions(-DSHUTDOWN_CONFIRMATION)
|
||||
endif()
|
||||
@@ -431,11 +436,11 @@ endif()
|
||||
|
||||
if(USBJ_EX)
|
||||
add_definitions(-DUSBJ_EX)
|
||||
set(SRC
|
||||
${SRC}
|
||||
set(SRC ${SRC}
|
||||
usb_joystick.cpp
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(FILE ${TARGET_SRC})
|
||||
set(SRC targets/${TARGET_DIR}/${FILE} ${SRC})
|
||||
endforeach()
|
||||
@@ -463,7 +468,6 @@ else()
|
||||
endif()
|
||||
|
||||
if(NATIVE_BUILD)
|
||||
|
||||
set(RADIOLIB_NATIVE_SRC ${SRC})
|
||||
if(SIMU_DISKIO)
|
||||
set(RADIOLIB_NATIVE_SRC ${RADIOLIB_NATIVE_SRC}
|
||||
@@ -472,7 +476,8 @@ if(NATIVE_BUILD)
|
||||
|
||||
# Pack all radio sources into an object lib
|
||||
add_library(radiolib_native OBJECT EXCLUDE_FROM_ALL
|
||||
${RADIOLIB_NATIVE_SRC})
|
||||
${RADIOLIB_NATIVE_SRC}
|
||||
)
|
||||
|
||||
# Add -DSIMU here PUBLIC, so it can be imported by other targets
|
||||
# via INTERFACE_COMPILE_OPTIONS
|
||||
|
||||
@@ -13,6 +13,7 @@ set(MINIMAL_BOARD_LIB_SRC
|
||||
|
||||
boards/generic_stm32/inputs.cpp
|
||||
boards/generic_stm32/i2c_bus.cpp
|
||||
boards/generic_stm32/bl_keys.cpp
|
||||
)
|
||||
|
||||
# Dependencies only used in firmware
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "board.h"
|
||||
#include "hal/key_driver.h"
|
||||
|
||||
#if defined(BOOTLOADER_KEYS)
|
||||
|
||||
bool boardBLStartCondition()
|
||||
{
|
||||
// Trims combo activated
|
||||
bool result = (readTrims() == BOOTLOADER_KEYS);
|
||||
#if defined(SECONDARY_BOOTLOADER_KEYS)
|
||||
result |= (readTrims() == SECONDARY_BOOTLOADER_KEYS);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#elif (defined(RADIO_T8) || defined(RADIO_COMMANDO8)) && !defined(RADIOMASTER_RELEASE)
|
||||
|
||||
bool boardBLStartCondition()
|
||||
{
|
||||
// Bind button pressed
|
||||
return (KEYS_GPIO_REG_BIND->IDR & KEYS_GPIO_PIN_BIND) == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -2,10 +2,13 @@
|
||||
# LVGL fonts
|
||||
#
|
||||
|
||||
set(LVGL_FONT_DIR fonts/lvgl)
|
||||
|
||||
file(GLOB LVGL_FONTS
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
lvgl/lv_font_*.c)
|
||||
|
||||
set(LVGL_FONT_SOURCES ${LVGL_FONTS} PARENT_SCOPE)
|
||||
|
||||
set(LVGL_FONT_SOURCES_MINIMAL
|
||||
fonts/lvgl/lv_font_roboto_bl_16.c
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -19,20 +19,30 @@ set(GUI_SRC
|
||||
radio_calibration.cpp
|
||||
view_main.cpp
|
||||
view_statistics.cpp
|
||||
)
|
||||
)
|
||||
|
||||
if(FLIGHT_MODES)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
set(GUI_SRC ${GUI_SRC}
|
||||
model_flightmodes.cpp
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(GVARS)
|
||||
set(GUI_SRC ${GUI_SRC}
|
||||
model_gvars.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LUA_MIXER)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
set(GUI_SRC ${GUI_SRC}
|
||||
model_custom_scripts.cpp
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
include(gui/common/stdlcd/CMakeLists.txt)
|
||||
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
${RADIO_SRC_DIR}/gui/128x64/lcd.cpp
|
||||
${RADIO_SRC_DIR}/gui/common/stdlcd/fonts.cpp
|
||||
${RADIO_SRC_DIR}/gui/common/stdlcd/utf8.cpp
|
||||
)
|
||||
|
||||
@@ -28,6 +28,12 @@ if(FLIGHT_MODES)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(GVARS)
|
||||
set(GUI_SRC ${GUI_SRC}
|
||||
model_gvars.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LUA_MIXER)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
@@ -36,3 +42,9 @@ if(LUA_MIXER)
|
||||
endif()
|
||||
|
||||
include(gui/common/stdlcd/CMakeLists.txt)
|
||||
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
${RADIO_SRC_DIR}/gui/212x64/lcd.cpp
|
||||
${RADIO_SRC_DIR}/gui/common/stdlcd/fonts.cpp
|
||||
${RADIO_SRC_DIR}/gui/common/stdlcd/utf8.cpp
|
||||
)
|
||||
|
||||
@@ -113,13 +113,6 @@ set(GUI_SRC
|
||||
radio_version.cpp
|
||||
)
|
||||
|
||||
if(FUNCTION_SWITCHES)
|
||||
set(GUI_SRC ${GUI_SRC}
|
||||
function_switches.cpp
|
||||
radio_diagcustswitches.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
macro(add_gui_src src)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
@@ -141,6 +134,15 @@ if(LUA_MIXER)
|
||||
add_gui_src(model_mixer_scripts.cpp)
|
||||
endif()
|
||||
|
||||
if(FUNCTION_SWITCHES)
|
||||
add_gui_src(function_switches.cpp)
|
||||
add_gui_src(radio_diagcustswitches.cpp)
|
||||
endif()
|
||||
|
||||
if(GVARS)
|
||||
add_gui_src(model_gvars.cpp)
|
||||
endif()
|
||||
|
||||
if(HELI)
|
||||
add_gui_src(model_heli.cpp)
|
||||
endif()
|
||||
@@ -187,6 +189,10 @@ if(BLUETOOTH)
|
||||
add_gui_src(hw_bluetooth.cpp)
|
||||
endif()
|
||||
|
||||
if(USBJ_EX)
|
||||
add_gui_src(model_usbjoystick.cpp)
|
||||
endif()
|
||||
|
||||
set(SRC ${SRC} storage/modelslist.cpp)
|
||||
|
||||
option(WINDOWS_INSPECT_BORDERS "Draw bounding boxes around windows" OFF)
|
||||
@@ -206,10 +212,28 @@ set(LVGL_SRC_DIR ${LIBOPENUI_SRC_DIR}/thirdparty/lvgl/src)
|
||||
include(${LIBOPENUI_SRC_DIR}/src/CMakeLists.txt)
|
||||
include(${LIBOPENUI_SRC_DIR}/thirdparty/CMakeLists.txt)
|
||||
|
||||
set(SRC ${SRC} ${LVGL_FONT_SOURCES})
|
||||
list(TRANSFORM LVGL_SOURCES_MINIMAL PREPEND ${RADIO_SRC_DIR}/)
|
||||
list(TRANSFORM LVGL_FONT_SOURCES_MINIMAL PREPEND ${RADIO_SRC_DIR}/)
|
||||
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
${LVGL_SOURCES_MINIMAL}
|
||||
${LVGL_FONT_SOURCES_MINIMAL}
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/lcd.cpp
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/fonts.cpp
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/colors.cpp
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/bitmaps.cpp
|
||||
${RADIO_SRC_DIR}/${LIBOPENUI_SRC_DIR}/thirdparty/lz4/lz4.c
|
||||
${RADIO_SRC_DIR}/${LIBOPENUI_SRC_DIR}/src/bitmapbuffer.cpp
|
||||
)
|
||||
|
||||
set(SRC ${SRC}
|
||||
${LVGL_SOURCES}
|
||||
${LVGL_FONT_SOURCES}
|
||||
${LIBOPENUI_SOURCES}
|
||||
)
|
||||
|
||||
foreach(LVGL_FILE ${LVGL_SOURCES})
|
||||
SET_SOURCE_FILES_PROPERTIES(${LVGL_FILE} PROPERTIES COMPILE_FLAGS -O3)
|
||||
endforeach()
|
||||
|
||||
add_definitions(-DLIBOPENUI)
|
||||
|
||||
if(USBJ_EX)
|
||||
add_gui_src(model_usbjoystick.cpp)
|
||||
endif()
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
|
||||
AddHWGenTarget(${HW_DESC_JSON} hal_keys hal_keys.inc)
|
||||
# add_library(hal_keys OBJECT EXCLUDE_FROM_ALL
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/hal_keys.inc
|
||||
# hal/key_driver.cpp
|
||||
# )
|
||||
|
||||
set(SRC ${SRC}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hal_keys.inc
|
||||
|
||||
hal/key_driver.cpp
|
||||
hal/module_port.cpp
|
||||
hal/adc_driver.cpp
|
||||
hal/key_driver.cpp
|
||||
hal/switch_driver.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -117,26 +117,8 @@ if(NOT NATIVE_BUILD)
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:stm32_drivers_w_dbg_bl>)
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/rtc_driver.cpp
|
||||
../common/arm/stm32/delays_driver.cpp
|
||||
../common/arm/stm32/trainer_driver.cpp
|
||||
../common/arm/stm32/flash_driver.cpp
|
||||
../common/arm/stm32/stm32_softserial_driver.cpp
|
||||
../common/arm/stm32/stm32_pulse_driver.cpp
|
||||
../common/arm/stm32/module_timer_driver.cpp
|
||||
../common/arm/stm32/stm32_switch_driver.cpp
|
||||
../common/arm/stm32/mixer_scheduler_driver.cpp
|
||||
../common/arm/stm32/pwr_driver.cpp
|
||||
../common/arm/stm32/watchdog_driver.cpp
|
||||
../common/arm/stm32/abnormal_reboot.cpp
|
||||
)
|
||||
|
||||
if(IMU)
|
||||
add_definitions(-DIMU)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/lsm6ds_driver.cpp
|
||||
)
|
||||
set(SRC ${SRC} gyro.cpp)
|
||||
endif()
|
||||
|
||||
@@ -164,10 +146,6 @@ if(DEBUG OR CLI OR USB_SERIAL)
|
||||
message("-- Adding support for USB serial")
|
||||
endif()
|
||||
|
||||
if(GVARS)
|
||||
set(GUI_SRC ${GUI_SRC} ${GVAR_SCREEN})
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} syscalls.c)
|
||||
|
||||
set(TARGET_SRC ${TARGET_SRC} ../common/arm/stm32/cpu_id.cpp)
|
||||
|
||||
@@ -4,115 +4,23 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
AddHardwareDefTarget(${HW_DESC_JSON})
|
||||
AddHWGenTarget(${HW_DESC_JSON} hal_keys hal_keys.inc)
|
||||
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../gui/${GUI_DIR}/lcd.cpp
|
||||
../../../../../keys.cpp
|
||||
../../../../../strhelpers.cpp
|
||||
../../../../../stamp.cpp
|
||||
../../../../../syscalls.c
|
||||
../../../../../targets/${TARGET_DIR}/${LCD_DRIVER}
|
||||
../../../../../targets/${TARGET_DIR}/backlight_driver.cpp
|
||||
../../../../../targets/${TARGET_DIR}/board.cpp
|
||||
../../../../../targets/${TARGET_DIR}/bootloader/boot_menu.cpp
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hal_keys.inc
|
||||
../pwr_driver.cpp
|
||||
../delays_driver.cpp
|
||||
../flash_driver.cpp
|
||||
../watchdog_driver.cpp
|
||||
../abnormal_reboot.cpp
|
||||
${RADIO_SRC_DIR}/keys.cpp
|
||||
${RADIO_SRC_DIR}/strhelpers.cpp
|
||||
${RADIO_SRC_DIR}/stamp.cpp
|
||||
${RADIO_SRC_DIR}/syscalls.c
|
||||
${RADIO_SRC_DIR}/crc.cpp
|
||||
boot.cpp
|
||||
bin_files.cpp
|
||||
)
|
||||
|
||||
if(ROTARY_ENCODER)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../targets/common/arm/stm32/rotary_encoder_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BLUETOOTH)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../targets/common/arm/stm32/bluetooth_driver.cpp
|
||||
)
|
||||
endif()
|
||||
)
|
||||
|
||||
if(DEBUG_SEGGER_RTT)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../thirdparty/Segger_RTT/RTT/SEGGER_RTT.c
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
${RADIO_SRC_DIR}/thirdparty/Segger_RTT/RTT/SEGGER_RTT.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14 OR PCB STREQUAL PL18)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../gui/colorlcd/fonts.cpp
|
||||
../../../../../gui/colorlcd/colors.cpp
|
||||
../../../../../gui/colorlcd/bitmaps.cpp
|
||||
../../../../../fonts/lvgl/lv_font_roboto_bl_16.c
|
||||
../../../../../thirdparty/libopenui/src/bitmapbuffer.cpp
|
||||
../../../../../thirdparty/libopenui/thirdparty/lz4/lz4.c
|
||||
../../../../../targets/common/arm/stm32/dma2d.cpp
|
||||
../../../../../targets/common/arm/stm32/rtc_driver.cpp
|
||||
../../../../../targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
../../../../../targets/common/arm/stm32/spi_flash.cpp
|
||||
../../../../../drivers/frftl.cpp
|
||||
../../../../../crc.cpp
|
||||
../../../../../targets/common/arm/stm32/sdram_driver.cpp
|
||||
../../../../../targets/${TARGET_DIR}/haptic_driver.cpp
|
||||
)
|
||||
|
||||
if(PCB STREQUAL PL18)
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
../../../../../targets/pl18/key_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PCBREV STREQUAL F16)
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
|
||||
../../../../../targets/horus/videoswitch_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add LVGL sources
|
||||
foreach(LVGL_FILE ${LVGL_SRC_FILES_MINIMAL})
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} ../../../../../${LVGL_FILE})
|
||||
endforeach()
|
||||
|
||||
if(NOT (PCB STREQUAL NV14 OR PCB STREQUAL PL18))
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../targets/${TARGET_DIR}/led_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGER)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../targets/${TARGET_DIR}/usb_charger_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DEBUG)
|
||||
set(ENABLE_BOOTLOADER_DEBUG true)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../serial.cpp
|
||||
../../../../../boards/generic_stm32/aux_ports.cpp
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../gui/common/stdlcd/fonts.cpp
|
||||
../../../../../gui/common/stdlcd/utf8.cpp
|
||||
../../../../../crc.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# TODO: this shouldn't be needed at all
|
||||
remove_definitions(-DDISK_CACHE)
|
||||
remove_definitions(-DLUA)
|
||||
@@ -121,8 +29,6 @@ remove_definitions(-DSEMIHOSTING)
|
||||
remove_definitions(-DUSB_SERIAL)
|
||||
remove_definitions(-DUSE_WATCHDOG)
|
||||
|
||||
add_definitions(-DBOOT)
|
||||
|
||||
if(NOT NO_LTO)
|
||||
message("-- Use LTO to compile bootloader")
|
||||
target_compile_options(stm32cube_ll PRIVATE -flto)
|
||||
@@ -136,10 +42,13 @@ endif()
|
||||
add_executable(bootloader EXCLUDE_FROM_ALL ${BOOTLOADER_SRC})
|
||||
add_dependencies(bootloader ${BITMAPS_TARGET})
|
||||
|
||||
target_link_options(bootloader PRIVATE
|
||||
-lm -T${LINKER_DIR}/bootloader.ld
|
||||
target_compile_definitions(bootloader PRIVATE BOOT)
|
||||
target_compile_definitions(board_bl PRIVATE BOOT)
|
||||
|
||||
target_link_options(bootloader BEFORE PRIVATE
|
||||
-T${LINKER_DIR}/bootloader.ld
|
||||
-Wl,-Map=bootloader.map,--cref,--no-warn-mismatch,--gc-sections
|
||||
--specs=nano.specs
|
||||
-lm --specs=nano.specs
|
||||
)
|
||||
|
||||
if (DEFINED TARGET_SDRAM_START)
|
||||
@@ -156,7 +65,7 @@ if (DEFINED TARGET_SDRAM_SIZE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (DEFINED ENABLE_BOOTLOADER_DEBUG)
|
||||
if (ENABLE_BOOTLOADER_DEBUG)
|
||||
target_compile_definitions(bootloader PUBLIC -DDEBUG)
|
||||
# uncomment to enable TRACE in drivers
|
||||
# target_compile_definitions(stm32_drivers_w_dbg_bl PRIVATE -DDEBUG)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#if !defined(SIMU)
|
||||
#include "stm32_hal_ll.h"
|
||||
#include "stm32_hal.h"
|
||||
#include "stm32_timer.h"
|
||||
#endif
|
||||
|
||||
@@ -45,19 +46,7 @@
|
||||
#include "thirdparty/Segger_RTT/RTT/SEGGER_RTT.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
#define BOOTLOADER_KEYS 0x0F
|
||||
#elif defined(RADIO_MT12)
|
||||
#define BOOTLOADER_KEYS 0x06
|
||||
#else
|
||||
#define BOOTLOADER_KEYS 0x42
|
||||
#endif
|
||||
|
||||
#if defined(RADIO_FAMILY_T20)
|
||||
#define SECONDARY_BOOTLOADER_KEYS 0x1200
|
||||
#endif
|
||||
|
||||
#define APP_START_ADDRESS (uint32_t)(FIRMWARE_ADDRESS + BOOTLOADER_SIZE)
|
||||
#define APP_START_ADDRESS (uint32_t)(FIRMWARE_ADDRESS + BOOTLOADER_SIZE)
|
||||
|
||||
#if defined(EEPROM) || defined(SPI_FLASH)
|
||||
#define MAIN_MENU_LEN 3
|
||||
@@ -70,16 +59,6 @@
|
||||
#define SEL_CLEAR_FLASH_STORAGE_MENU_LEN 2
|
||||
#endif
|
||||
|
||||
typedef void (*voidFunction)(void);
|
||||
|
||||
#define jumpTo(addr) do { \
|
||||
SCB->VTOR = addr; \
|
||||
__set_MSP(*(__IO uint32_t*)addr); \
|
||||
uint32_t jumpAddress = *(uint32_t*)(addr + 4); \
|
||||
voidFunction jumpFn = (voidFunction)jumpAddress; \
|
||||
jumpFn(); \
|
||||
} while(0)
|
||||
|
||||
#if !defined(SIMU)
|
||||
// Bootloader marker:
|
||||
// -> used to detect valid bootloader files
|
||||
@@ -180,6 +159,7 @@ int menuFlashFile(uint32_t index, event_t event)
|
||||
|
||||
void flashWriteBlock()
|
||||
{
|
||||
// TODO: use some board provided driver instead
|
||||
uint32_t blockOffset = 0;
|
||||
#if !defined(SIMU)
|
||||
while (BlockCount) {
|
||||
@@ -205,18 +185,26 @@ void writeEepromBlock()
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
||||
typedef void (*fctptr_t)(void);
|
||||
|
||||
static __attribute__((noreturn)) void jumpTo(uint32_t addr)
|
||||
{
|
||||
__disable_irq();
|
||||
__set_MSP(*(uint32_t*)addr);
|
||||
fctptr_t reset_handler = (fctptr_t)*(uint32_t*)(addr + 4);
|
||||
reset_handler();
|
||||
while(1){}
|
||||
}
|
||||
|
||||
// Optional board hook
|
||||
__weak void boardBLInit() {}
|
||||
__weak bool boardBLStartCondition() { return false; }
|
||||
__weak void boardBLPreJump() {}
|
||||
|
||||
void bootloaderInitApp()
|
||||
{
|
||||
LL_AHB1_GRP1_EnableClock(LCD_RCC_AHB1Periph);
|
||||
#if defined(LCD_RCC_APB2Periph)
|
||||
LL_APB2_GRP1_EnableClock(LCD_RCC_APB2Periph);
|
||||
#endif
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
|
||||
|
||||
|
||||
#if defined(HAVE_BOARD_BOOTLOADER_INIT)
|
||||
boardBootloaderInit();
|
||||
#endif
|
||||
boardBLInit();
|
||||
|
||||
#if defined(DEBUG_SEGGER_RTT)
|
||||
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
|
||||
@@ -232,22 +220,13 @@ void bootloaderInitApp()
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined(RADIO_T8) || defined(RADIO_COMMANDO8)) && !defined(RADIOMASTER_RELEASE)
|
||||
// Bind button not pressed
|
||||
if ((~(KEYS_GPIO_REG_BIND->IDR) & KEYS_GPIO_PIN_BIND) == false) {
|
||||
#else
|
||||
// LHR & RHL trims not pressed simultanously
|
||||
#if defined(SECONDARY_BOOTLOADER_KEYS)
|
||||
if (readTrims() != BOOTLOADER_KEYS && readTrims() != SECONDARY_BOOTLOADER_KEYS) {
|
||||
#else
|
||||
if (readTrims() != BOOTLOADER_KEYS) {
|
||||
#endif
|
||||
#endif
|
||||
// TODO: deInit before restarting
|
||||
if (!boardBLStartCondition()) {
|
||||
// Start main application
|
||||
boardBLPreJump();
|
||||
jumpTo(APP_START_ADDRESS);
|
||||
}
|
||||
|
||||
// TODO: move all this into board specifics
|
||||
pwrOn();
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) && !defined(USE_HATS_AS_KEYS)
|
||||
@@ -264,8 +243,10 @@ void bootloaderInitApp()
|
||||
|
||||
TRACE("\nBootloader started :)");
|
||||
|
||||
// TODO: move BT & EEPROM into board specifics
|
||||
#if defined(BLUETOOTH)
|
||||
// we shutdown the bluetooth module now to be sure it will be detected on firmware start
|
||||
// we shutdown the bluetooth module now to be sure it will be detected on
|
||||
// firmware start
|
||||
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE, false);
|
||||
#endif
|
||||
|
||||
@@ -592,4 +573,3 @@ int bootloaderMain()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,19 +50,10 @@ set(HARDWARE_TOUCH YES)
|
||||
if (PCB STREQUAL X10)
|
||||
set(PCBREV "STD" CACHE STRING "PCB Revision")
|
||||
add_definitions(-DSOFTWARE_VOLUME)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/audio_dac_driver.cpp
|
||||
)
|
||||
if (NOT (PCBREV STREQUAL TX16S OR PCBREV STREQUAL T15))
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/sticks_pwm_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
set(BITMAPS_TARGET x10_bitmaps)
|
||||
set(FONTS_TARGET x10_fonts)
|
||||
set(LCD_DRIVER lcd_driver.cpp)
|
||||
|
||||
if (PCBREV STREQUAL EXPRESS)
|
||||
set(FLAVOUR x10express)
|
||||
set(DEFAULT_INTERNAL_MODULE ISRM_PXX2 CACHE STRING "Default internal module")
|
||||
@@ -162,10 +153,10 @@ elseif (PCB STREQUAL X12S)
|
||||
endif()
|
||||
set(INTERNAL_GPS_BAUDRATE "9600" CACHE STRING "Baud rate for internal GPS")
|
||||
set(AUX2_SERIAL ON) # wire to GPS
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} targets/common/arm/stm32/vs1053b.cpp)
|
||||
set(USE_VS1053B ON)
|
||||
set(USE_ADS79xx ON)
|
||||
set(BITMAPS_TARGET x12s_bitmaps)
|
||||
set(FONTS_TARGET x12s_fonts)
|
||||
set(LCD_DRIVER lcd_driver.cpp)
|
||||
add_definitions(-DMANUFACTURER_FRSKY)
|
||||
endif()
|
||||
|
||||
@@ -184,6 +175,9 @@ add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
|
||||
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
|
||||
add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS)
|
||||
|
||||
# Make malloc() thread-safe
|
||||
add_definitions(-DTHREADSAFE_MALLOC)
|
||||
|
||||
set(SDRAM ON)
|
||||
|
||||
if(FUNCTION_SWITCHES)
|
||||
@@ -219,32 +213,109 @@ if(ALLOW_TRAINER_MULTI)
|
||||
endif()
|
||||
|
||||
if(DISK_CACHE)
|
||||
set(SRC ${SRC} disk_cache.cpp)
|
||||
add_definitions(-DDISK_CACHE)
|
||||
set(SRC ${SRC} disk_cache.cpp)
|
||||
endif()
|
||||
|
||||
if(INTERNAL_GPS)
|
||||
set(SRC ${SRC} gps.cpp gps_nmea.cpp gps_ubx.cpp)
|
||||
add_definitions(-DINTERNAL_GPS)
|
||||
message("-- Internal GPS enabled")
|
||||
add_definitions(-DINTERNAL_GPS)
|
||||
set(SRC ${SRC} gps.cpp gps_nmea.cpp gps_ubx.cpp)
|
||||
endif()
|
||||
|
||||
if(SPACEMOUSE)
|
||||
message("-- SpaceMouse enabled")
|
||||
add_definitions(-DSPACEMOUSE)
|
||||
set(SRC ${SRC} spacemouse.cpp)
|
||||
message("-- SpaceMouse enabled")
|
||||
endif()
|
||||
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(TARGET_SRC_DIR targets/${TARGET_DIR})
|
||||
|
||||
set(BOARD_COMMON_SRC
|
||||
${TARGET_SRC_DIR}/board.cpp
|
||||
${TARGET_SRC_DIR}/led_driver.cpp
|
||||
${TARGET_SRC_DIR}/haptic_driver.cpp
|
||||
${TARGET_SRC_DIR}/backlight_driver.cpp
|
||||
targets/common/arm/stm32/abnormal_reboot.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
targets/common/arm/stm32/flash_driver.cpp
|
||||
targets/common/arm/stm32/pwr_driver.cpp
|
||||
targets/common/arm/stm32/rotary_encoder_driver.cpp
|
||||
targets/common/arm/stm32/rtc_driver.cpp
|
||||
targets/common/arm/stm32/sdram_driver.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/watchdog_driver.cpp
|
||||
drivers/frftl.cpp
|
||||
)
|
||||
|
||||
if(DEFINED LCD_DRIVER)
|
||||
set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/${LCD_DRIVER}
|
||||
)
|
||||
else()
|
||||
set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/lcd_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BLUETOOTH)
|
||||
set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC}
|
||||
targets/common/arm/stm32/bluetooth_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (VIDEO_SWITCH)
|
||||
add_definitions(-DVIDEO_SWITCH)
|
||||
set(BOARD_COMMON_SRC ${BOARD_COMMON_SRC}
|
||||
targets/horus/videoswitch_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Bootloader board library
|
||||
add_library(board_bl OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/bootloader/boot_menu.cpp
|
||||
)
|
||||
add_dependencies(board_bl ${BITMAPS_TARGET})
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:board_bl>)
|
||||
|
||||
# Firmware board library
|
||||
add_library(board OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/lsm6ds_driver.cpp
|
||||
targets/common/arm/stm32/mixer_scheduler_driver.cpp
|
||||
targets/common/arm/stm32/module_timer_driver.cpp
|
||||
targets/common/arm/stm32/sticks_pwm_driver.cpp
|
||||
targets/common/arm/stm32/stm32_pulse_driver.cpp
|
||||
targets/common/arm/stm32/stm32_softserial_driver.cpp
|
||||
targets/common/arm/stm32/stm32_switch_driver.cpp
|
||||
targets/common/arm/stm32/trainer_driver.cpp
|
||||
)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:board>)
|
||||
|
||||
if(HARDWARE_TOUCH)
|
||||
if(FLAVOUR STREQUAL t15)
|
||||
set(TOUCH_DRIVER cst8xx_driver.cpp)
|
||||
else()
|
||||
set(TOUCH_DRIVER tp_gt911.cpp)
|
||||
add_definitions(-DTP_GT911)
|
||||
endif()
|
||||
add_definitions(-DHARDWARE_TOUCH)
|
||||
|
||||
if(FLAVOUR STREQUAL t15)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/cst8xx_driver.cpp)
|
||||
else()
|
||||
add_definitions(-DTP_GT911)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/tp_gt911.cpp)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_VS1053B)
|
||||
target_sources(board PRIVATE targets/common/arm/stm32/vs1053b.cpp)
|
||||
else()
|
||||
target_sources(board PRIVATE targets/common/arm/stm32/audio_dac_driver.cpp)
|
||||
endif()
|
||||
|
||||
if(USE_ADS79xx)
|
||||
target_sources(board PRIVATE targets/common/arm/stm32/ads79xx.cpp)
|
||||
endif()
|
||||
|
||||
if(SWSERIALPOWER)
|
||||
@@ -252,70 +323,21 @@ if(SWSERIALPOWER)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGER)
|
||||
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} usb_charger_driver.cpp)
|
||||
add_definitions(-DUSB_CHARGER)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/usb_charger_driver.cpp)
|
||||
endif()
|
||||
|
||||
if(BLUETOOTH)
|
||||
add_definitions(-DBLUETOOTH)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/bluetooth_driver.cpp)
|
||||
set(SRC
|
||||
${SRC}
|
||||
bluetooth.cpp)
|
||||
add_definitions(-DHARDWARE_TRAINER_BLUETOOTH)
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
${LCD_DRIVER}
|
||||
${TOUCH_DRIVER}
|
||||
board.cpp
|
||||
backlight_driver.cpp
|
||||
led_driver.cpp
|
||||
haptic_driver.cpp
|
||||
)
|
||||
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/sdram_driver.cpp
|
||||
targets/common/arm/stm32/rotary_encoder_driver.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/ads79xx.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
drivers/frftl.cpp
|
||||
)
|
||||
targets/common/arm/loadboot.cpp
|
||||
)
|
||||
|
||||
if (VIDEO_SWITCH)
|
||||
add_definitions(-DVIDEO_SWITCH)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/horus/videoswitch_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BOOTLOADER)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/loadboot.cpp
|
||||
)
|
||||
if (MULTIMODULE)
|
||||
add_definitions(-DMULTI_PROTOLIST)
|
||||
endif()
|
||||
|
||||
set(SRC ${SRC}
|
||||
io/frsky_firmware_update.cpp
|
||||
io/multi_firmware_update.cpp
|
||||
)
|
||||
|
||||
if (MULTIMODULE)
|
||||
add_definitions(-DMULTI_PROTOLIST)
|
||||
set(SRC ${SRC}
|
||||
io/multi_protolist.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make malloc() thread-safe
|
||||
add_definitions(-DTHREADSAFE_MALLOC)
|
||||
|
||||
io/multi_protolist.cpp
|
||||
)
|
||||
|
||||
@@ -54,7 +54,7 @@ bool boardBacklightOn = false;
|
||||
#if defined(VIDEO_SWITCH)
|
||||
#include "videoswitch_driver.h"
|
||||
|
||||
void boardBootloaderInit()
|
||||
void boardBLInit()
|
||||
{
|
||||
videoSwitchInit();
|
||||
}
|
||||
@@ -65,9 +65,6 @@ void boardBootloaderInit()
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
LL_AHB1_GRP1_EnableClock(LCD_RCC_AHB1Periph);
|
||||
LL_APB2_GRP1_EnableClock(LCD_RCC_APB2Periph);
|
||||
|
||||
#if defined(RADIO_FAMILY_T16)
|
||||
void board_set_bor_level();
|
||||
board_set_bor_level();
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
// Defines used in board_common.h
|
||||
#define ROTARY_ENCODER_NAVIGATION
|
||||
|
||||
#define BOOTLOADER_KEYS 0x42
|
||||
|
||||
#include "board_common.h"
|
||||
#include "hal.h"
|
||||
|
||||
@@ -61,12 +63,6 @@ extern uint16_t sessionTimer;
|
||||
|
||||
#define SLAVE_MODE() (g_model.trainerData.mode == TRAINER_MODE_SLAVE)
|
||||
|
||||
#if defined(RADIO_F16)
|
||||
// initilizes the board for the bootloader
|
||||
#define HAVE_BOARD_BOOTLOADER_INIT 1
|
||||
void boardBootloaderInit();
|
||||
#endif
|
||||
|
||||
// Board driver
|
||||
void boardInit();
|
||||
void boardOff();
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
*/
|
||||
|
||||
#include "cst8xx_driver.h"
|
||||
#include "stm32_hal.h"
|
||||
#include "stm32_hal_ll.h"
|
||||
|
||||
#include "stm32_exti_driver.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_gpio_driver.h"
|
||||
#include "stm32_i2c_driver.h"
|
||||
#include "timers_driver.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "delays_driver.h"
|
||||
@@ -27,13 +35,6 @@
|
||||
#include "hal/gpio.h"
|
||||
#include "hal/i2c_driver.h"
|
||||
#include "rtos.h"
|
||||
#include "stm32_exti_driver.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_gpio_driver.h"
|
||||
#include "stm32_hal.h"
|
||||
#include "stm32_hal_ll.h"
|
||||
#include "stm32_i2c_driver.h"
|
||||
#include "timers_driver.h"
|
||||
|
||||
volatile static bool touchEventOccured;
|
||||
|
||||
|
||||
@@ -663,9 +663,6 @@
|
||||
|
||||
// LCD
|
||||
#if defined(RADIO_T15)
|
||||
#define LCD_RCC_AHB1Periph (LL_AHB1_GRP1_PERIPH_GPIOE | LL_AHB1_GRP1_PERIPH_GPIOG | LL_AHB1_GRP1_PERIPH_GPIOI | LL_AHB1_GRP1_PERIPH_GPIOJ | LL_AHB1_GRP1_PERIPH_GPIOK | LL_AHB1_GRP1_PERIPH_DMA2D)
|
||||
#define LCD_RCC_APB1Periph 0
|
||||
#define LCD_RCC_APB2Periph LL_APB2_GRP1_PERIPH_LTDC
|
||||
#define LCD_NRST_GPIO GPIOG
|
||||
#define LCD_NRST_GPIO_PIN LL_GPIO_PIN_10 // PG.10
|
||||
#define LCD_SPI_GPIO GPIOE
|
||||
@@ -676,8 +673,6 @@
|
||||
#define LTDC_IRQ_PRIO 4
|
||||
#define DMA_SCREEN_IRQ_PRIO 6
|
||||
#else
|
||||
#define LCD_RCC_AHB1Periph LL_AHB1_GRP1_PERIPH_DMA2D
|
||||
#define LCD_RCC_APB2Periph LL_APB2_GRP1_PERIPH_LTDC
|
||||
#if defined(PCBX12S)
|
||||
#define LCD_GPIO_NRST GPIO_PIN(GPIOF, 10) // PF.10
|
||||
#elif defined(PCBX10)
|
||||
|
||||
@@ -273,6 +273,7 @@ static void lcdReset(void)
|
||||
|
||||
void LCD_Init_LTDC()
|
||||
{
|
||||
__HAL_RCC_LTDC_CLK_ENABLE();
|
||||
hltdc.Instance = LTDC;
|
||||
|
||||
/* Configure PLLSAI prescalers for LCD */
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "stm32_hal.h"
|
||||
#include "stm32_hal_ll.h"
|
||||
#include "stm32_gpio_driver.h"
|
||||
|
||||
#include "lcd_st7796s_driver.h"
|
||||
|
||||
#include "board.h"
|
||||
@@ -28,8 +32,6 @@
|
||||
#include "hal.h"
|
||||
#include "lcd.h"
|
||||
#include "opentx_types.h"
|
||||
#include "stm32_hal.h"
|
||||
#include "stm32_hal_ll.h"
|
||||
|
||||
static LTDC_HandleTypeDef hltdc;
|
||||
static void* initialFrameBuffer = nullptr;
|
||||
@@ -70,6 +72,10 @@ static void LCD_AF_GPIOConfig(void)
|
||||
| | LCD_G4 <-> PJ.11 | LCD_DE <-> PK.07
|
||||
| | LCD_B3 <-> PJ.15 |
|
||||
*/
|
||||
stm32_gpio_enable_clock(GPIOG);
|
||||
stm32_gpio_enable_clock(GPIOI);
|
||||
stm32_gpio_enable_clock(GPIOJ);
|
||||
stm32_gpio_enable_clock(GPIOK);
|
||||
|
||||
LL_GPIO_InitTypeDef GPIO_InitStructure;
|
||||
LL_GPIO_StructInit(&GPIO_InitStructure);
|
||||
@@ -102,6 +108,9 @@ static void LCD_AF_GPIOConfig(void)
|
||||
|
||||
static void lcdSpiConfig(void)
|
||||
{
|
||||
stm32_gpio_enable_clock(LCD_SPI_GPIO);
|
||||
stm32_gpio_enable_clock(LCD_NRST_GPIO);
|
||||
|
||||
LL_GPIO_InitTypeDef GPIO_InitStructure;
|
||||
LL_GPIO_StructInit(&GPIO_InitStructure);
|
||||
|
||||
@@ -320,6 +329,7 @@ void LCD_ST7796S_Off(void) { lcdWriteCommand(0x28); }
|
||||
|
||||
void LCD_Init_LTDC()
|
||||
{
|
||||
__HAL_RCC_LTDC_CLK_ENABLE();
|
||||
hltdc.Instance = LTDC;
|
||||
|
||||
/* Configure PLLSAI prescalers for LCD */
|
||||
|
||||
@@ -71,7 +71,7 @@ add_definitions(
|
||||
|
||||
set(SDRAM ON)
|
||||
|
||||
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
|
||||
add_definitions(-DAUDIO -DVOICE -DRTCLOCK)
|
||||
add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
|
||||
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
|
||||
|
||||
@@ -83,75 +83,75 @@ if(NOT UNEXPECTED_SHUTDOWN)
|
||||
add_definitions(-DNO_UNEXPECTED_SHUTDOWN)
|
||||
endif()
|
||||
|
||||
if(STICKS_DEAD_ZONE)
|
||||
add_definitions(-DSTICK_DEAD_ZONE)
|
||||
endif()
|
||||
|
||||
# VCP CLI
|
||||
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||
set(CLI ON CACHE BOOL "Enable CLI")
|
||||
|
||||
include_directories(${RADIO_SRC_DIR}/fonts/colorlcd gui/${GUI_DIR} gui/${GUI_DIR}/layouts)
|
||||
|
||||
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/themes/*.cpp)
|
||||
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/layouts/*.cpp)
|
||||
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/widgets/*.cpp)
|
||||
|
||||
if(DISK_CACHE)
|
||||
set(SRC ${SRC} disk_cache.cpp)
|
||||
add_definitions(-DDISK_CACHE)
|
||||
endif()
|
||||
|
||||
#set(AUX_SERIAL_DRIVER ../common/arm/stm32/aux_serial_driver.cpp)
|
||||
set(TARGET_SRC_DIR targets/${TARGET_DIR})
|
||||
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(BOARD_COMMON_SRC
|
||||
${TARGET_SRC_DIR}/board.cpp
|
||||
${TARGET_SRC_DIR}/haptic_driver.cpp
|
||||
${TARGET_SRC_DIR}/backlight_driver.cpp
|
||||
${TARGET_SRC_DIR}/${LCD_DRIVER}
|
||||
targets/common/arm/stm32/abnormal_reboot.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
targets/common/arm/stm32/flash_driver.cpp
|
||||
targets/common/arm/stm32/pwr_driver.cpp
|
||||
targets/common/arm/stm32/rtc_driver.cpp
|
||||
targets/common/arm/stm32/sdram_driver.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/watchdog_driver.cpp
|
||||
drivers/frftl.cpp
|
||||
)
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
board.cpp
|
||||
${LCD_DRIVER}
|
||||
${TOUCH_DRIVER}
|
||||
battery_driver.cpp
|
||||
backlight_driver.cpp
|
||||
haptic_driver.cpp
|
||||
)
|
||||
# Bootloader board library
|
||||
add_library(board_bl OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/bootloader/boot_menu.cpp
|
||||
)
|
||||
add_dependencies(board_bl ${BITMAPS_TARGET})
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:board_bl>)
|
||||
|
||||
# Firmware board library
|
||||
add_library(board OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/${TOUCH_DRIVER}
|
||||
${TARGET_SRC_DIR}/battery_driver.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/mixer_scheduler_driver.cpp
|
||||
targets/common/arm/stm32/module_timer_driver.cpp
|
||||
targets/common/arm/stm32/stm32_pulse_driver.cpp
|
||||
targets/common/arm/stm32/stm32_softserial_driver.cpp
|
||||
targets/common/arm/stm32/stm32_switch_driver.cpp
|
||||
targets/common/arm/stm32/trainer_driver.cpp
|
||||
targets/common/arm/stm32/vs1053b.cpp
|
||||
)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:board>)
|
||||
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/sdram_driver.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
drivers/frftl.cpp
|
||||
targets/common/arm/stm32/vs1053b.cpp
|
||||
)
|
||||
|
||||
if(BOOTLOADER)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/loadboot.cpp
|
||||
)
|
||||
endif()
|
||||
targets/common/arm/loadboot.cpp
|
||||
)
|
||||
|
||||
set(SRC ${SRC}
|
||||
io/frsky_firmware_update.cpp
|
||||
io/multi_firmware_update.cpp
|
||||
)
|
||||
io/multi_protolist.cpp
|
||||
)
|
||||
|
||||
if (MULTIMODULE)
|
||||
add_definitions(-DMULTI_PROTOLIST)
|
||||
set(SRC ${SRC}
|
||||
io/multi_protolist.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make malloc() thread-safe
|
||||
add_definitions(-DTHREADSAFE_MALLOC)
|
||||
|
||||
set(STM32LIB_SRC
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fmc.c
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_ltdc.c
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c
|
||||
)
|
||||
|
||||
|
||||
@@ -67,9 +67,6 @@ void delay_self(int count)
|
||||
}
|
||||
}
|
||||
|
||||
#define RCC_AHB1PeriphMinimum (LCD_RCC_AHB1Periph)
|
||||
#define RCC_APB2PeriphMinimum (LCD_RCC_APB2Periph)
|
||||
|
||||
static uint8_t boardGetPcbRev()
|
||||
{
|
||||
gpio_init(INTMODULE_PWR_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW);
|
||||
@@ -85,7 +82,7 @@ static uint8_t boardGetPcbRev()
|
||||
}
|
||||
}
|
||||
|
||||
void boardBootloaderInit()
|
||||
void boardBLInit()
|
||||
{
|
||||
#if defined(USB_SW_GPIO)
|
||||
gpio_init(USB_SW_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
@@ -107,9 +104,6 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
LL_AHB1_GRP1_EnableClock(RCC_AHB1PeriphMinimum);
|
||||
LL_APB2_GRP1_EnableClock(RCC_APB2PeriphMinimum);
|
||||
|
||||
// enable interrupts
|
||||
__enable_irq();
|
||||
#endif
|
||||
|
||||
@@ -39,14 +39,12 @@
|
||||
#define LUA_MEM_EXTRA_MAX (2 MB) // max allowed memory usage for Lua bitmaps (in bytes)
|
||||
#define LUA_MEM_MAX (6 MB) // max allowed memory usage for complete Lua (in bytes), 0 means unlimited
|
||||
|
||||
#define BOOTLOADER_KEYS 0x42
|
||||
|
||||
extern uint16_t sessionTimer;
|
||||
|
||||
#define SLAVE_MODE() (g_model.trainerData.mode == TRAINER_MODE_SLAVE)
|
||||
|
||||
// initilizes the board for the bootloader
|
||||
#define HAVE_BOARD_BOOTLOADER_INIT 1
|
||||
void boardBootloaderInit();
|
||||
|
||||
// Board driver
|
||||
void boardInit();
|
||||
void boardOff();
|
||||
|
||||
@@ -242,8 +242,6 @@
|
||||
#define USB_SW_GPIO GPIO_PIN(GPIOI, 10) // PI.10
|
||||
|
||||
// LCD
|
||||
#define LCD_RCC_AHB1Periph LL_AHB1_GRP1_PERIPH_DMA2D
|
||||
#define LCD_RCC_APB2Periph LL_APB2_GRP1_PERIPH_LTDC
|
||||
#define LCD_NRST_GPIO GPIO_PIN(GPIOG, 9) // PG.09
|
||||
#define LCD_SPI_CS_GPIO GPIO_PIN(GPIOE, 4) // PE.04
|
||||
#define LCD_SPI_SCK_GPIO GPIO_PIN(GPIOE, 2) // PE.02
|
||||
|
||||
@@ -1104,6 +1104,7 @@ static void lcdReset() {
|
||||
}
|
||||
|
||||
void LCD_Init_LTDC() {
|
||||
__HAL_RCC_LTDC_CLK_ENABLE();
|
||||
hltdc.Instance = LTDC;
|
||||
|
||||
/* Configure PLLSAI prescalers for LCD */
|
||||
|
||||
@@ -74,7 +74,7 @@ add_definitions(
|
||||
|
||||
set(SDRAM ON)
|
||||
|
||||
add_definitions(-DEEPROM_VARIANT=0 -DAUDIO -DVOICE -DRTCLOCK)
|
||||
add_definitions(-DAUDIO -DVOICE -DRTCLOCK)
|
||||
add_definitions(-DGPS_USART_BAUDRATE=${INTERNAL_GPS_BAUDRATE})
|
||||
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
|
||||
add_definitions(-DCROSSFIRE_NATIVE)
|
||||
@@ -98,64 +98,72 @@ set(AFHDS3 ON)
|
||||
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||
set(CLI ON CACHE BOOL "Enable CLI")
|
||||
|
||||
include_directories(${RADIO_SRC_DIR}/fonts/colorlcd gui/${GUI_DIR} gui/${GUI_DIR}/layouts)
|
||||
set(TARGET_SRC_DIR targets/${TARGET_DIR})
|
||||
|
||||
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/themes/*.cpp)
|
||||
file(GLOB LAYOUTS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/layouts/*.cpp)
|
||||
file(GLOB WIDGETS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd ${RADIO_SRC_DIR}/gui/colorlcd/widgets/*.cpp)
|
||||
set(BOARD_COMMON_SRC
|
||||
${TARGET_SRC_DIR}/board.cpp
|
||||
${TARGET_SRC_DIR}/led_driver.cpp
|
||||
${TARGET_SRC_DIR}/key_driver.cpp
|
||||
${TARGET_SRC_DIR}/haptic_driver.cpp
|
||||
${TARGET_SRC_DIR}/backlight_driver.cpp
|
||||
${TARGET_SRC_DIR}/${LCD_DRIVER}
|
||||
targets/common/arm/stm32/abnormal_reboot.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
targets/common/arm/stm32/flash_driver.cpp
|
||||
targets/common/arm/stm32/pwr_driver.cpp
|
||||
targets/common/arm/stm32/rtc_driver.cpp
|
||||
targets/common/arm/stm32/sdram_driver.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/watchdog_driver.cpp
|
||||
drivers/frftl.cpp
|
||||
)
|
||||
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
# Bootloader board library
|
||||
add_library(board_bl OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/bootloader/boot_menu.cpp
|
||||
)
|
||||
add_dependencies(board_bl ${BITMAPS_TARGET})
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:board_bl>)
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
${LCD_DRIVER}
|
||||
${TOUCH_DRIVER}
|
||||
board.cpp
|
||||
key_driver.cpp
|
||||
battery_driver.cpp
|
||||
backlight_driver.cpp
|
||||
led_driver.cpp
|
||||
haptic_driver.cpp
|
||||
)
|
||||
# Firmware board library
|
||||
add_library(board OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/${TOUCH_DRIVER}
|
||||
${TARGET_SRC_DIR}/battery_driver.cpp
|
||||
targets/common/arm/stm32/audio_dac_driver.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/mixer_scheduler_driver.cpp
|
||||
targets/common/arm/stm32/module_timer_driver.cpp
|
||||
targets/common/arm/stm32/stm32_pulse_driver.cpp
|
||||
targets/common/arm/stm32/stm32_softserial_driver.cpp
|
||||
targets/common/arm/stm32/stm32_switch_driver.cpp
|
||||
targets/common/arm/stm32/stm32_ws2812.cpp
|
||||
targets/common/arm/stm32/trainer_driver.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
boards/generic_stm32/rgb_leds.cpp
|
||||
drivers/frftl.cpp
|
||||
)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:board>)
|
||||
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/sdram_driver.cpp
|
||||
targets/common/arm/stm32/audio_dac_driver.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
targets/common/arm/stm32/spi_flash.cpp
|
||||
targets/common/arm/stm32/diskio_spi_flash.cpp
|
||||
targets/common/arm/stm32/stm32_ws2812.cpp
|
||||
boards/generic_stm32/rgb_leds.cpp
|
||||
drivers/frftl.cpp
|
||||
)
|
||||
|
||||
if(BOOTLOADER)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/loadboot.cpp
|
||||
)
|
||||
endif()
|
||||
targets/common/arm/loadboot.cpp
|
||||
)
|
||||
|
||||
set(SRC ${SRC}
|
||||
io/frsky_firmware_update.cpp
|
||||
io/multi_firmware_update.cpp
|
||||
)
|
||||
io/multi_protolist.cpp
|
||||
)
|
||||
|
||||
if (MULTIMODULE)
|
||||
add_definitions(-DMULTI_PROTOLIST)
|
||||
set(SRC ${SRC}
|
||||
io/multi_protolist.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Make malloc() thread-safe
|
||||
add_definitions(-DTHREADSAFE_MALLOC)
|
||||
|
||||
set(STM32LIB_SRC
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fmc.c
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_ltdc.c
|
||||
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.c
|
||||
)
|
||||
|
||||
|
||||
@@ -74,8 +74,6 @@ void delay_self(int count)
|
||||
for (; count > 0; count--);
|
||||
}
|
||||
}
|
||||
#define RCC_AHB1PeriphMinimum (LCD_RCC_AHB1Periph)
|
||||
#define RCC_APB2PeriphMinimum (LCD_RCC_APB2Periph)
|
||||
|
||||
void ledStripOff()
|
||||
{
|
||||
@@ -85,7 +83,7 @@ void ledStripOff()
|
||||
ws2812_update(&_led_timer);
|
||||
}
|
||||
|
||||
void boardBootloaderInit()
|
||||
void boardBLInit()
|
||||
{
|
||||
// USB charger status pins
|
||||
gpio_init(UCHARGER_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW);
|
||||
@@ -98,8 +96,6 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
LL_AHB1_GRP1_EnableClock(RCC_AHB1PeriphMinimum);
|
||||
LL_APB2_GRP1_EnableClock(RCC_APB2PeriphMinimum);
|
||||
// enable interrupts
|
||||
__enable_irq();
|
||||
#endif
|
||||
|
||||
@@ -38,14 +38,12 @@
|
||||
#define LUA_MEM_EXTRA_MAX (2 MB) // max allowed memory usage for Lua bitmaps (in bytes)
|
||||
#define LUA_MEM_MAX (6 MB) // max allowed memory usage for complete Lua (in bytes), 0 means unlimited
|
||||
|
||||
#define BOOTLOADER_KEYS 0x42
|
||||
|
||||
extern uint16_t sessionTimer;
|
||||
|
||||
#define SLAVE_MODE() (g_model.trainerData.mode == TRAINER_MODE_SLAVE)
|
||||
|
||||
// Initilizes the board for the bootloader
|
||||
#define HAVE_BOARD_BOOTLOADER_INIT 1
|
||||
void boardBootloaderInit();
|
||||
|
||||
// Board driver
|
||||
void boardInit();
|
||||
void boardOff();
|
||||
|
||||
@@ -398,8 +398,6 @@
|
||||
#define USB_GPIO_AF GPIO_AF10
|
||||
|
||||
// LCD
|
||||
#define LCD_RCC_AHB1Periph LL_AHB1_GRP1_PERIPH_DMA2D
|
||||
#define LCD_RCC_APB2Periph LL_APB2_GRP1_PERIPH_LTDC
|
||||
#define LCD_NRST_GPIO GPIO_PIN(GPIOG, 9) // PG.09
|
||||
#define LCD_SPI_CS_GPIO GPIO_PIN(GPIOE, 4) // PE.04
|
||||
#define LCD_SPI_SCK_GPIO GPIO_PIN(GPIOE, 2) // PE.02
|
||||
|
||||
@@ -72,7 +72,7 @@ void keysInit()
|
||||
stm32_gpio_enable_clock(GPIOB);
|
||||
stm32_gpio_enable_clock(GPIOC);
|
||||
stm32_gpio_enable_clock(GPIOD);
|
||||
stm32_gpio_enable_clock(GPIOF);
|
||||
stm32_gpio_enable_clock(GPIOG);
|
||||
stm32_gpio_enable_clock(GPIOH);
|
||||
stm32_gpio_enable_clock(GPIOJ);
|
||||
|
||||
|
||||
@@ -2690,6 +2690,7 @@ void LCD_NT35310_Off( void )
|
||||
}
|
||||
|
||||
void LCD_Init_LTDC() {
|
||||
__HAL_RCC_LTDC_CLK_ENABLE();
|
||||
hltdc.Instance = LTDC;
|
||||
|
||||
/* Configure PLLSAI prescalers for LCD */
|
||||
|
||||
@@ -10,8 +10,14 @@ option(BLUETOOTH "FrSky BT module support" OFF)
|
||||
|
||||
set(USE_RTC_CLOCK YES)
|
||||
set(HARDWARE_EXTERNAL_MODULE YES)
|
||||
set(TARGET_DIR taranis)
|
||||
|
||||
add_definitions(-DPCBFRSKY)
|
||||
set(HSE_VALUE 12000000)
|
||||
set(SDCARD YES)
|
||||
set(TARGET_DIR taranis)
|
||||
set(PPM_LIMITS_SYMETRICAL YES)
|
||||
|
||||
add_definitions(-DPCBFRSKY -DPCBTARANIS -DAUDIO -DVOICE)
|
||||
|
||||
if(PCB STREQUAL X9E)
|
||||
set(DEFAULT_INTERNAL_MODULE XJT_PXX1 CACHE STRING "Default internal module")
|
||||
@@ -36,7 +42,6 @@ if(PCB STREQUAL X9E)
|
||||
set(BITMAPS_TARGET taranis_bitmaps)
|
||||
set(FONTS_TARGET taranis_fonts)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS NO)
|
||||
set(BLUETOOTH YES)
|
||||
set(ROTARY_ENCODER YES)
|
||||
@@ -51,7 +56,6 @@ elseif(PCB STREQUAL X9D+)
|
||||
set(BITMAPS_TARGET taranis_bitmaps)
|
||||
set(FONTS_TARGET taranis_fonts)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(PCBREV 2014 CACHE STRING "PCB Revision")
|
||||
#set(AFHDS3 NO)
|
||||
add_definitions(-DPCBREV=${PCBREV})
|
||||
@@ -92,7 +96,6 @@ elseif(PCB STREQUAL X9D)
|
||||
set(FONTS_TARGET taranis_fonts)
|
||||
set(LCD_DRIVER lcd_driver_aspi.cpp)
|
||||
set(AUX_SERIAL ON)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS NO)
|
||||
add_definitions(-DMANUFACTURER_FRSKY)
|
||||
set(MODULE_SIZE_STD YES)
|
||||
@@ -104,7 +107,6 @@ elseif(PCB STREQUAL X7)
|
||||
set(BITMAPS_TARGET 9x_bitmaps)
|
||||
set(FONTS_TARGET 9x_fonts_1bit)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS YES)
|
||||
add_definitions(-DPCBX7 -DSOFTWARE_VOLUME)
|
||||
add_definitions(-DPWR_BUTTON_${PWR_BUTTON})
|
||||
@@ -387,7 +389,6 @@ elseif(PCB STREQUAL X9LITE)
|
||||
set(BITMAPS_TARGET 9x_bitmaps)
|
||||
set(FONTS_TARGET 9x_fonts_1bit)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS YES)
|
||||
set(ROTARY_ENCODER YES)
|
||||
add_definitions(-DMANUFACTURER_FRSKY)
|
||||
@@ -410,7 +411,6 @@ elseif(PCB STREQUAL X9LITES)
|
||||
set(BITMAPS_TARGET 9x_bitmaps)
|
||||
set(FONTS_TARGET 9x_fonts_1bit)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS YES)
|
||||
set(BLUETOOTH YES)
|
||||
set(ROTARY_ENCODER YES)
|
||||
@@ -433,7 +433,6 @@ elseif(PCB STREQUAL XLITE)
|
||||
set(BITMAPS_TARGET 9x_bitmaps)
|
||||
set(FONTS_TARGET 9x_fonts_1bit)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS YES)
|
||||
set(BLUETOOTH YES)
|
||||
add_definitions(-DMANUFACTURER_FRSKY)
|
||||
@@ -454,7 +453,6 @@ elseif(PCB STREQUAL XLITES)
|
||||
set(BITMAPS_TARGET 9x_bitmaps)
|
||||
set(FONTS_TARGET 9x_fonts_1bit)
|
||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||
set(GVAR_SCREEN model_gvars.cpp)
|
||||
set(STATUS_LEDS YES)
|
||||
set(PXX2 ON)
|
||||
set(BLUETOOTH YES)
|
||||
@@ -510,66 +508,92 @@ else()
|
||||
|
||||
endif()
|
||||
|
||||
set(TARGET_SRC_DIR targets/${TARGET_DIR})
|
||||
|
||||
set(BOARD_COMMON_SRC
|
||||
${TARGET_SRC_DIR}/board.cpp
|
||||
${TARGET_SRC_DIR}/led_driver.cpp
|
||||
${TARGET_SRC_DIR}/haptic_driver.cpp
|
||||
${TARGET_SRC_DIR}/backlight_driver.cpp
|
||||
${TARGET_SRC_DIR}/${LCD_DRIVER}
|
||||
targets/common/arm/stm32/abnormal_reboot.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/flash_driver.cpp
|
||||
targets/common/arm/stm32/pwr_driver.cpp
|
||||
targets/common/arm/stm32/rtc_driver.cpp
|
||||
targets/common/arm/stm32/watchdog_driver.cpp
|
||||
)
|
||||
|
||||
if(ROTARY_ENCODER)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
list(APPEND BOARD_COMMON_SRC
|
||||
targets/common/arm/stm32/rotary_encoder_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BIND_KEY)
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
bind_button_driver.cpp
|
||||
)
|
||||
add_definitions(-DBIND_KEY)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGER)
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC} usb_charger_driver.cpp)
|
||||
add_definitions(-DUSB_CHARGER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BLUETOOTH)
|
||||
add_definitions(-DBLUETOOTH)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
targets/common/arm/stm32/bluetooth_driver.cpp)
|
||||
set(SRC
|
||||
${SRC}
|
||||
bluetooth.cpp)
|
||||
if(NOT PCB STREQUAL X9E)
|
||||
# Bluetooth on X9E is compatible with almost nothing
|
||||
add_definitions(-DHARDWARE_TRAINER_BLUETOOTH)
|
||||
endif()
|
||||
list(APPEND BOARD_COMMON_SRC
|
||||
targets/common/arm/stm32/bluetooth_driver.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Bootloader board library
|
||||
add_library(board_bl OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/bootloader/boot_menu.cpp
|
||||
)
|
||||
# add_dependencies(board_bl ${BITMAPS_TARGET})
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:board_bl>)
|
||||
|
||||
# Firmware board library
|
||||
add_library(board OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/volume_i2c.cpp
|
||||
${TARGET_SRC_DIR}/eeprom_driver.cpp
|
||||
targets/common/arm/stm32/audio_dac_driver.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/mixer_scheduler_driver.cpp
|
||||
targets/common/arm/stm32/module_timer_driver.cpp
|
||||
targets/common/arm/stm32/stm32_pulse_driver.cpp
|
||||
targets/common/arm/stm32/stm32_softserial_driver.cpp
|
||||
targets/common/arm/stm32/stm32_switch_driver.cpp
|
||||
targets/common/arm/stm32/trainer_driver.cpp
|
||||
)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:board>)
|
||||
|
||||
if(STATUS_LEDS)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/led_driver.cpp)
|
||||
endif()
|
||||
|
||||
if(BIND_KEY)
|
||||
add_definitions(-DBIND_KEY)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/bind_button_driver.cpp)
|
||||
endif()
|
||||
|
||||
if(USB_CHARGER)
|
||||
add_definitions(-DUSB_CHARGER)
|
||||
target_sources(board PRIVATE ${TARGET_SRC_DIR}/usb_charger_driver.cpp)
|
||||
endif()
|
||||
|
||||
if(IMU)
|
||||
target_sources(board PRIVATE targets/common/arm/stm32/lsm6ds_driver.cpp)
|
||||
endif()
|
||||
|
||||
if(AUTOUPDATE)
|
||||
add_definitions(-DAUTOUPDATE)
|
||||
endif()
|
||||
|
||||
set(HSE_VALUE 12000000)
|
||||
set(SDCARD YES)
|
||||
set(TARGET_DIR taranis)
|
||||
set(PPM_LIMITS_SYMETRICAL YES)
|
||||
|
||||
add_definitions(-DPCBTARANIS)
|
||||
add_definitions(-DAUDIO -DVOICE )
|
||||
|
||||
if(USE_RTC_CLOCK)
|
||||
add_definitions(-DRTCLOCK)
|
||||
endif()
|
||||
|
||||
|
||||
set(SRC
|
||||
${SRC}
|
||||
set(SRC ${SRC}
|
||||
io/frsky_firmware_update.cpp
|
||||
io/multi_firmware_update.cpp
|
||||
)
|
||||
)
|
||||
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
set(GUI_SRC ${GUI_SRC}
|
||||
model_input_edit.cpp
|
||||
model_mix_edit.cpp
|
||||
model_display.cpp
|
||||
@@ -579,22 +603,7 @@ set(GUI_SRC
|
||||
view_telemetry.cpp
|
||||
view_about.cpp
|
||||
bmp.cpp
|
||||
)
|
||||
|
||||
if(STATUS_LEDS)
|
||||
set(LED_DRIVER led_driver.cpp)
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
${LED_DRIVER}
|
||||
${LCD_DRIVER}
|
||||
board.cpp
|
||||
volume_i2c.cpp
|
||||
eeprom_driver.cpp
|
||||
backlight_driver.cpp
|
||||
haptic_driver.cpp
|
||||
)
|
||||
)
|
||||
|
||||
if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES OR PCBREV STREQUAL COMMANDO8)
|
||||
set(FIRMWARE_SRC
|
||||
@@ -611,10 +620,7 @@ endif()
|
||||
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
hal/adc_driver.cpp
|
||||
targets/common/arm/loadboot.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/audio_dac_driver.cpp
|
||||
)
|
||||
|
||||
set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET})
|
||||
|
||||
@@ -46,6 +46,18 @@ void rotaryEncoderCheck();
|
||||
|
||||
#define LUA_MEM_MAX (0) // max allowed memory usage for complete Lua (in bytes), 0 means unlimited
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
# define BOOTLOADER_KEYS 0x0F
|
||||
#elif defined(RADIO_MT12)
|
||||
# define BOOTLOADER_KEYS 0x06
|
||||
#else
|
||||
# define BOOTLOADER_KEYS 0x42
|
||||
#endif
|
||||
|
||||
#if defined(RADIO_FAMILY_T20)
|
||||
# define SECONDARY_BOOTLOADER_KEYS 0x1200
|
||||
#endif
|
||||
|
||||
extern uint16_t sessionTimer;
|
||||
|
||||
// Board driver
|
||||
|
||||
@@ -2387,7 +2387,6 @@
|
||||
#define SSD1309_LCD
|
||||
#endif
|
||||
#if defined(PCBX9E)
|
||||
#define LCD_RCC_AHB1Periph LL_AHB1_GRP1_PERIPH_DMA1
|
||||
#define LCD_MOSI_GPIO GPIO_PIN(GPIOC, 12) // PC.12
|
||||
#define LCD_CLK_GPIO GPIO_PIN(GPIOC, 10) // PC.10
|
||||
#define LCD_A0_GPIO GPIO_PIN(GPIOC, 11) // PC.11
|
||||
@@ -2402,7 +2401,6 @@
|
||||
#define LCD_SPI SPI3
|
||||
#define LCD_GPIO_AF GPIO_AF6
|
||||
#elif defined(PCBXLITE) || defined(PCBX9LITE)
|
||||
#define LCD_RCC_AHB1Periph LL_AHB1_GRP1_PERIPH_DMA1
|
||||
#define LCD_MOSI_GPIO GPIO_PIN(GPIOC, 12) // PC.12
|
||||
#define LCD_CLK_GPIO GPIO_PIN(GPIOC, 10) // PC.10
|
||||
#define LCD_A0_GPIO GPIO_PIN(GPIOC, 11) // PC.11
|
||||
@@ -2417,7 +2415,6 @@
|
||||
#define LCD_SPI SPI3
|
||||
#define LCD_GPIO_AF GPIO_AF6
|
||||
#elif defined(PCBX9DP) || defined(PCBX7)
|
||||
#define LCD_RCC_AHB1Periph LL_AHB1_GRP1_PERIPH_DMA1
|
||||
#define LCD_MOSI_GPIO GPIO_PIN(GPIOC, 12) // PC.12
|
||||
#define LCD_CLK_GPIO GPIO_PIN(GPIOC, 10) // PC.10
|
||||
#define LCD_A0_GPIO GPIO_PIN(GPIOC, 11) // PC.11
|
||||
@@ -2436,7 +2433,6 @@
|
||||
#define LCD_SPI SPI3
|
||||
#define LCD_GPIO_AF GPIO_AF6
|
||||
#else
|
||||
#define LCD_RCC_AHB1Periph 0
|
||||
// Soft SPI: these pins are not connected to SPI periph on STM32F205
|
||||
#define LCD_MOSI_GPIO GPIO_PIN(GPIOD, 10) // PD.10
|
||||
#define LCD_CLK_GPIO GPIO_PIN(GPIOD, 11) // PD.11
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "hal/gpio.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_spi.h"
|
||||
#include "stm32_dma.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
@@ -89,6 +90,7 @@ void lcdHardwareInit()
|
||||
gpio_init(LCD_RST_GPIO, GPIO_OUT, GPIO_PIN_SPEED_MEDIUM);
|
||||
gpio_init(LCD_A0_GPIO, GPIO_OUT, GPIO_PIN_SPEED_HIGH);
|
||||
|
||||
stm32_dma_enable_clock(LCD_DMA);
|
||||
LCD_DMA_Stream->CR &= ~DMA_SxCR_EN; // Disable DMA
|
||||
LCD_DMA->HIFCR = LCD_DMA_FLAGS; // Write ones to clear bits
|
||||
LCD_DMA_Stream->CR = DMA_SxCR_PL_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0;
|
||||
|
||||
+4
-6
@@ -6,7 +6,7 @@ if(HARWARE_TOUCH)
|
||||
add_definitions(-DHARDWARE_TOUCH)
|
||||
endif()
|
||||
|
||||
set(LIBOPENUI_SRC
|
||||
set(LIBOPENUI_SOURCES
|
||||
libopenui_file.cpp
|
||||
bitmapbuffer.cpp
|
||||
bitmapbuffer_fileio.cpp
|
||||
@@ -35,10 +35,8 @@ set(LIBOPENUI_SRC
|
||||
keyboard_base.cpp
|
||||
)
|
||||
|
||||
foreach(LIBOPENUI_FILE ${LIBOPENUI_SRC})
|
||||
set(LIBOPENUI_SRC_FILES ${LIBOPENUI_SRC_FILES} ${LIBOPENUI_SRC_DIR}/src/${LIBOPENUI_FILE})
|
||||
endforeach()
|
||||
list(TRANSFORM LIBOPENUI_SOURCES PREPEND ${LIBOPENUI_SRC_DIR}/src/)
|
||||
|
||||
set(SRC ${SRC} ${LIBOPENUI_SRC_FILES}
|
||||
set(LIBOPENUI_SOURCES ${LIBOPENUI_SOURCES}
|
||||
${LIBOPENUI_SRC_DIR}/thirdparty/lz4/lz4.c
|
||||
)
|
||||
)
|
||||
|
||||
+2
-43
@@ -93,33 +93,6 @@ set(LVGL_SOURCES
|
||||
|
||||
hal/lv_hal_indev.c
|
||||
|
||||
# font/lv_font_unscii_8.c
|
||||
# font/lv_font_unscii_16.c
|
||||
# font/lv_font_simsun_16_cjk.c
|
||||
# font/lv_font_dejavu_16_persian_hebrew.c
|
||||
# font/lv_font_montserrat_8.c
|
||||
# font/lv_font_montserrat_10.c
|
||||
# font/lv_font_montserrat_12.c
|
||||
# font/lv_font_montserrat_12_subpx.c
|
||||
# font/lv_font_montserrat_14.c
|
||||
# font/lv_font_montserrat_16.c
|
||||
# font/lv_font_montserrat_18.c
|
||||
# font/lv_font_montserrat_20.c
|
||||
# font/lv_font_montserrat_22.c
|
||||
# font/lv_font_montserrat_24.c
|
||||
# font/lv_font_montserrat_26.c
|
||||
# font/lv_font_montserrat_28.c
|
||||
# font/lv_font_montserrat_28_compressed.c
|
||||
# font/lv_font_montserrat_30.c
|
||||
# font/lv_font_montserrat_32.c
|
||||
# font/lv_font_montserrat_34.c
|
||||
# font/lv_font_montserrat_36.c
|
||||
# font/lv_font_montserrat_38.c
|
||||
# font/lv_font_montserrat_40.c
|
||||
# font/lv_font_montserrat_42.c
|
||||
# font/lv_font_montserrat_44.c
|
||||
# font/lv_font_montserrat_46.c
|
||||
# font/lv_font_montserrat_48.c
|
||||
widgets/lv_line.c
|
||||
widgets/lv_dropdown.c
|
||||
widgets/lv_objx_templ.c
|
||||
@@ -176,21 +149,7 @@ set(LVGL_SOURCES
|
||||
extra/widgets/span/lv_span.c
|
||||
extra/widgets/keyboard/lv_keyboard.c
|
||||
extra/widgets/msgbox/lv_msgbox.c
|
||||
# extra/themes/basic/lv_theme_basic.c
|
||||
# extra/themes/default/lv_theme_default.c
|
||||
# extra/themes/mono/lv_theme_mono.c
|
||||
)
|
||||
|
||||
foreach(LVGL_FILE ${LVGL_SOURCES_MINIMAL})
|
||||
set(LVGL_SRC_FILES_MINIMAL ${LVGL_SRC_FILES_MINIMAL} ${LVGL_SRC_DIR}/${LVGL_FILE})
|
||||
endforeach()
|
||||
|
||||
foreach(LVGL_FILE ${LVGL_SOURCES})
|
||||
set(LVGL_SRC_FILES ${LVGL_SRC_FILES} ${LVGL_SRC_DIR}/${LVGL_FILE})
|
||||
endforeach()
|
||||
|
||||
foreach(LVGL_FILE ${LVGL_SRC_FILES})
|
||||
SET_SOURCE_FILES_PROPERTIES( ${LVGL_FILE} PROPERTIES COMPILE_FLAGS -O3 )
|
||||
endforeach()
|
||||
|
||||
set(SRC ${SRC} ${LVGL_SRC_FILES})
|
||||
list(TRANSFORM LVGL_SOURCES_MINIMAL PREPEND ${LVGL_SRC_DIR}/)
|
||||
list(TRANSFORM LVGL_SOURCES PREPEND ${LVGL_SRC_DIR}/)
|
||||
|
||||
Reference in New Issue
Block a user