feat: H7 support (#5738)
Co-authored-by: Richard Li <richard.li@ces.hk> Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
Richard Li
philmoz
raphaelcoeffic
parent
5a15ffb017
commit
3d25c2a0f8
@@ -535,7 +535,7 @@ if(CPU_TYPE_FULL STREQUAL STM32F205xE)
|
||||
set(TARGET_LINKER_DIR stm32f20x)
|
||||
elseif ((CPU_TYPE_FULL STREQUAL STM32F407xE) OR (CPU_TYPE_FULL STREQUAL STM32F407xG))
|
||||
set(CPU_TYPE STM32F4)
|
||||
add_definitions(-DSTM32F40_41xxx -DSTM32F407xx -DCCMRAM)
|
||||
add_definitions(-DSTM32F40_41xxx -DSTM32F407xx)
|
||||
set(TARGET_LINKER_DIR stm32f40x)
|
||||
if (CPU_TYPE_FULL STREQUAL STM32F407xG)
|
||||
set(TARGET_FLASH_SIZE 1M)
|
||||
|
||||
@@ -123,6 +123,8 @@ enum {
|
||||
#define SURFACE_RADIO true
|
||||
#endif
|
||||
|
||||
#define HAS_HARDWARE_OPTIONS
|
||||
|
||||
PACK(typedef struct {
|
||||
uint8_t pcbrev:2;
|
||||
}) HardwareOptions;
|
||||
|
||||
@@ -29,9 +29,7 @@
|
||||
#include "fw_version.h"
|
||||
#include "translations.h"
|
||||
#include "../../common/arm/stm32/bootloader/boot.h"
|
||||
#include "../../common/arm/stm32/bootloader/bin_files.h"
|
||||
|
||||
extern MemoryType memoryType;
|
||||
#include "bootloader/firmware_files.h"
|
||||
|
||||
void bootloaderInitScreen()
|
||||
{
|
||||
@@ -56,14 +54,14 @@ void bootloaderDrawFilename(const char *str, uint8_t line, bool selected)
|
||||
bootloaderDrawMsg(INDENT_WIDTH, str, line, selected);
|
||||
}
|
||||
|
||||
bool checkFirmwareFlavor(const char * vers)
|
||||
bool checkFirmwareFlavor(const char * flavour)
|
||||
{
|
||||
if (strncmp(vers,FLAVOUR, sizeof(FLAVOUR) - 1) != 0)
|
||||
if (strncmp(flavour,FLAVOUR, sizeof(FLAVOUR) - 1) != 0)
|
||||
return false;
|
||||
|
||||
char * tmp = (char *) vers;
|
||||
while (*tmp != '-') tmp++;
|
||||
if ((tmp - vers) != (sizeof(FLAVOUR) - 1))
|
||||
char * tmp = (char *) flavour;
|
||||
while (*tmp != 0) tmp++;
|
||||
if ((tmp - flavour) != (sizeof(FLAVOUR) - 1))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -96,7 +94,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char *str)
|
||||
else if (st == ST_DIR_CHECK) {
|
||||
if (opt == FR_NO_PATH) {
|
||||
bootloaderDrawMsg(INDENT_WIDTH, TR_BL_DIR_MISSING, 1, false);
|
||||
bootloaderDrawMsg(INDENT_WIDTH, getBinaryPath(memoryType), 2, false);
|
||||
bootloaderDrawMsg(INDENT_WIDTH, getFirmwarePath(), 2, false);
|
||||
}
|
||||
else {
|
||||
bootloaderDrawMsg(INDENT_WIDTH, TR_BL_DIR_EMPTY, 1, false);
|
||||
@@ -104,26 +102,19 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char *str)
|
||||
}
|
||||
else if (st == ST_FLASH_CHECK) {
|
||||
if (opt == FC_ERROR) {
|
||||
if (memoryType == MEM_FLASH)
|
||||
bootloaderDrawMsg(0, TR_BL_INVALID_FIRMWARE, 2, false);
|
||||
else
|
||||
bootloaderDrawMsg(0, TR_BL_INVALID_EEPROM, 2, false);
|
||||
bootloaderDrawMsg(0, TR_BL_INVALID_FIRMWARE, 2, false);
|
||||
}
|
||||
else if (opt == FC_OK) {
|
||||
bool flavorCheck = false;
|
||||
if (memoryType == MEM_FLASH) {
|
||||
const char * vers = getFirmwareVersion((const char *)Block_buffer);
|
||||
VersionTag tag;
|
||||
getFileFirmwareVersion(&tag);
|
||||
#if LCD_W < 212
|
||||
// Remove "edgetx-" from string
|
||||
if (strncmp(vers, "edgetx-", 7) == 0)
|
||||
vers += 7;
|
||||
flavorCheck = checkFirmwareFlavor(vers);
|
||||
// Remove "edgetx-" from string
|
||||
flavorCheck = checkFirmwareFlavor(tag.flavour);
|
||||
#else
|
||||
flavorCheck = checkFirmwareFlavor(vers + 7);
|
||||
flavorCheck = checkFirmwareFlavor(tag.flavour);
|
||||
#endif
|
||||
|
||||
bootloaderDrawMsg(INDENT_WIDTH, vers, 0, false);
|
||||
}
|
||||
bootloaderDrawMsg(INDENT_WIDTH, tag.version, 0, false);
|
||||
if (flavorCheck)
|
||||
bootloaderDrawMsg(0, TR_BL_HOLD_ENTER_TO_START, 2, false);
|
||||
else
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/switch_driver.h"
|
||||
#include "stm32_switch_driver.h"
|
||||
|
||||
SwitchHwPos bsp_get_switch_position(const stm32_switch_t *sw, SwitchCategory cat, uint8_t idx) {return SWITCH_HW_MID;}
|
||||
@@ -215,7 +215,7 @@ static SwitchHwPos _get_fs_switch_pos(uint8_t idx)
|
||||
}
|
||||
}
|
||||
|
||||
SwitchHwPos boardSwitchGetPosition(uint8_t cat, uint8_t idx)
|
||||
SwitchHwPos boardSwitchGetPosition(SwitchCategory cat, uint8_t idx)
|
||||
{
|
||||
if (cat == SWITCH_PHYSICAL) {
|
||||
return _get_switch_pos(idx);
|
||||
|
||||
@@ -2686,21 +2686,20 @@
|
||||
// Using chip, so no detect
|
||||
#else
|
||||
#if defined(PCBXLITE) || defined(PCBX9LITE)
|
||||
#define SD_PRESENT_GPIO GPIO_PIN(GPIOD, 10) // PD.10
|
||||
#define SD_PRESENT_GPIO GPIO_PIN(GPIOD, 10) // PD.10
|
||||
#elif defined(RADIO_COMMANDO8)
|
||||
#define SD_PRESENT_GPIO GPIO_PIN(GPIOD, 8) // PD.08
|
||||
#define SD_PRESENT_GPIO GPIO_PIN(GPIOD, 8) // PD.08
|
||||
#else
|
||||
#define SD_PRESENT_GPIO GPIO_PIN(GPIOD, 9) // PD.09
|
||||
#define SD_PRESENT_GPIO GPIO_PIN(GPIOD, 9) // PD.09
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define STORAGE_USE_SDCARD_SPI
|
||||
|
||||
#define SD_GPIO GPIOB
|
||||
#define SD_GPIO_PIN_CS LL_GPIO_PIN_12 // PB.12
|
||||
#define SD_GPIO_PIN_SCK LL_GPIO_PIN_13 // PB.13
|
||||
#define SD_GPIO_PIN_MISO LL_GPIO_PIN_14 // PB.14
|
||||
#define SD_GPIO_PIN_MOSI LL_GPIO_PIN_15 // PB.15
|
||||
#define SD_GPIO_PIN_CS GPIO_PIN(GPIOB, 12) // PB.12
|
||||
#define SD_GPIO_PIN_SCK GPIO_PIN(GPIOB, 13) // PB.13
|
||||
#define SD_GPIO_PIN_MISO GPIO_PIN(GPIOB, 14) // PB.14
|
||||
#define SD_GPIO_PIN_MOSI GPIO_PIN(GPIOB, 15) // PB.15
|
||||
|
||||
#define SD_SPI SPI2
|
||||
#define SD_SPI_DMA DMA1
|
||||
|
||||
Reference in New Issue
Block a user