refactor: bootloader & cmake cleanup (#5232)
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user