1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

Merge branch 'master' into platform_patch

# Conflicts:
#	src/platform/STM32/include/platform/platform.h
This commit is contained in:
blckmn 2025-07-08 09:47:35 +10:00
commit 183c3bbe67
15 changed files with 118 additions and 207 deletions

View file

@ -19,7 +19,10 @@ jobs:
outputs:
targets: ${{ steps.get-targets.outputs.targets }}
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache build toolchain
uses: actions/cache@v4
@ -32,6 +35,10 @@ jobs:
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: make arm_sdk_install
- name: Build pico tool and install
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: make picotool_install
- name: Hydrate configuration
id: get-config
run: make configs
@ -50,6 +57,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Fetch toolchain from cache
uses: actions/cache@v4
@ -74,7 +83,10 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: obj/*.hex
path: |
obj/*.hex
obj/*.uf2
obj/*_${{ matrix.target }}*
retention-days: 60
test:

View file

@ -4,7 +4,7 @@ CONFIGS_REPO_URL ?= https://github.com/betaflight/config
CONFIGS_SUBMODULE_DIR = src/config
BASE_CONFIGS = $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(CONFIG_DIR)/configs/*/config.h)))))
ifneq ($(filter-out %_install test% %_clean clean% %-print %.hex %.h hex checks help configs $(BASE_TARGETS) $(BASE_CONFIGS),$(MAKECMDGOALS)),)
ifneq ($(filter-out %_sdk %_install test% %_clean clean% %-print %.hex %.h hex checks help configs $(BASE_TARGETS) $(BASE_CONFIGS),$(MAKECMDGOALS)),)
ifeq ($(wildcard $(CONFIG_DIR)/configs/),)
$(error `$(CONFIG_DIR)` not found. Have you hydrated configuration using: 'make configs'?)
endif

View file

@ -8,6 +8,8 @@
#
# Release date: July 04, 2024
#
# PICO SDK Version: 2.X - July 03, 2025
#
###############################################################
##############################
@ -275,7 +277,7 @@ zip_clean:
ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && echo "exists"), exists)
ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi-
else ifeq (,$(filter %_install test% clean% %-print checks help configs, $(MAKECMDGOALS)))
else ifeq (,$(filter %_sdk %_install test% clean% %-print checks help configs, $(MAKECMDGOALS)))
GCC_VERSION = $(shell arm-none-eabi-gcc -dumpversion)
ifeq ($(GCC_VERSION),)
$(error **ERROR** arm-none-eabi-gcc not in the PATH. Run 'make arm_sdk_install' to install automatically in the tools folder of this repo)

View file

@ -5758,7 +5758,9 @@ static void cliDma(const char *cmdName, char* cmdline)
#if defined(USE_DMA_SPEC)
cliDmaopt(cmdName, cmdline);
#else
cliShowParseError(cmdName);
UNUSED(cmdName);
// the only option is show, so make that the default behaviour
showDma();
#endif
}
#endif

View file

@ -195,9 +195,9 @@ static const void *cmsx_FirmwareInit(displayPort_t *pDisp)
{
UNUSED(pDisp);
strncpy(manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
strncpy(boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
strncpy(boardName, getBoardName(), MAX_BOARD_NAME_LENGTH);
boardName[MAX_BOARD_NAME_LENGTH] = 0;
return NULL;

View file

@ -25,7 +25,7 @@
#include "drivers/dma.h"
#include "drivers/timer.h"
#ifdef USE_DMA
#ifdef USE_DMA_SPEC
#include "dma_reqmap_mcu.h"
#endif

View file

@ -42,9 +42,9 @@ void initBoardInformation(void)
#if !defined(BOARD_NAME)
boardInformationSet = boardConfig()->boardInformationSet;
if (boardInformationSet) {
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH + 1);
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH);
boardName[MAX_BOARD_NAME_LENGTH] = 0;
}
#endif
@ -88,7 +88,7 @@ bool setManufacturerId(const char *newManufacturerId)
{
#if !defined(BOARD_NAME)
if (!boardInformationSet || strlen(manufacturerId) == 0) {
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
boardInformationWasUpdated = true;
@ -107,7 +107,7 @@ bool setBoardName(const char *newBoardName)
{
#if !defined(BOARD_NAME)
if (!boardInformationSet || strlen(boardName) == 0) {
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH + 1);
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
boardName[MAX_BOARD_NAME_LENGTH] = 0;
boardInformationWasUpdated = true;
@ -126,8 +126,10 @@ bool persistBoardInformation(void)
{
#if !defined(BOARD_NAME)
if (boardInformationWasUpdated) {
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH + 1);
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
boardConfigMutable()->manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH);
boardConfigMutable()->boardName[MAX_BOARD_NAME_LENGTH] = 0;
boardConfigMutable()->boardInformationSet = true;
initBoardInformation();

View file

@ -49,41 +49,45 @@
#define DEFAULT_AUX_CHANNEL_COUNT 6
#endif
#ifdef USE_ITCM_RAM
#if defined(ITCM_RAM_OPTIMISATION) && !defined(DEBUG)
#define FAST_CODE __attribute__((section(".tcm_code"))) __attribute__((optimize(ITCM_RAM_OPTIMISATION)))
#else
#define FAST_CODE __attribute__((section(".tcm_code")))
#endif
#ifndef FAST_CODE_PREF
#define FAST_CODE_PREF FAST_CODE
// If a particular target is short of ITCM RAM, defining FAST_CODE_PREF in the target.h file will
// cause functions decorated FAST_CODE_PREF to *not* go into ITCM RAM
// but if FAST_CODE_PREF is not defined for the target, FAST_CODE_PREF is an alias to FAST_CODE, and
// functions decorated with FAST_CODE_PREF *will* go into ITCM RAM.
#endif
#define FAST_CODE_NOINLINE NOINLINE
#else
#ifndef FAST_CODE
#define FAST_CODE
#define FAST_CODE_PREF
#define FAST_CODE_NOINLINE
#endif // USE_ITCM_RAM
#endif
#ifdef USE_CCM_CODE
#define CCM_CODE __attribute__((section(".ccm_code")))
#else
#ifndef FAST_CODE_PREF
#define FAST_CODE_PREF FAST_CODE
#endif
#ifndef FAST_CODE_NOINLINE
#define FAST_CODE_NOINLINE
#endif
#ifndef CCM_CODE
#define CCM_CODE
#endif
#ifdef USE_FAST_DATA
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
#else
#define FAST_DATA_ZERO_INIT
#ifndef FAST_DATA
#define FAST_DATA
#endif // USE_FAST_DATA
#endif
#ifndef FAST_DATA_ZERO_INIT
#define FAST_DATA_ZERO_INIT
#endif
#ifndef MMFLASH_CODE
#define MMFLASH_CODE
#endif
#ifndef MMFLASH_CODE_NOINLINE
#define MMFLASH_CODE_NOINLINE
#endif
#ifndef MMFLASH_DATA
#define MMFLASH_DATA
#endif
#ifndef MMFLASH_DATA_ZERO_INIT
#define MMFLASH_DATA_ZERO_INIT
#endif
/*
BEGIN HARDWARE INCLUSIONS
@ -630,33 +634,6 @@ extern struct linker_symbol __config_start; // configured via linker script wh
extern struct linker_symbol __config_end;
#endif
#if defined(USE_EXST) && !defined(RAMBASED)
#define USE_FLASH_BOOT_LOADER
#endif
#if defined(USE_FLASH_MEMORY_MAPPED)
#if !defined(USE_RAM_CODE)
#define USE_RAM_CODE
#endif
#define MMFLASH_CODE RAM_CODE
#define MMFLASH_CODE_NOINLINE RAM_CODE NOINLINE
#define MMFLASH_DATA FAST_DATA
#define MMFLASH_DATA_ZERO_INIT FAST_DATA_ZERO_INIT
#else
#define MMFLASH_CODE
#define MMFLASH_CODE_NOINLINE
#define MMFLASH_DATA
#define MMFLASH_DATA_ZERO_INIT
#endif
#ifdef USE_RAM_CODE
// RAM_CODE for methods that need to be in RAM, but don't need to be in the fastest type of memory.
// Note: if code is marked as RAM_CODE it *MUST* be in RAM, there is no alternative unlike functions marked with FAST_CODE/CCM_CODE
#define RAM_CODE __attribute__((section(".ram_code")))
#endif
#ifndef USE_ITERM_RELAX
#undef USE_ABSOLUTE_CONTROL
#endif

View file

@ -225,3 +225,8 @@
#define DMA_STCH_STRING "Stream"
#endif
#ifdef USE_FAST_DATA
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
#endif // USE_FAST_DATA

View file

@ -1,108 +0,0 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later
* version.
*
* Betaflight 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.
*
* You should have received a copy of the GNU General Public
* License along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include "platform.h"
#ifdef USE_DMA_SPEC
#include "timer_def.h"
#include "drivers/adc.h"
#include "drivers/bus_spi.h"
#include "drivers/dma_reqmap.h"
#include "drivers/serial.h"
#include "drivers/serial_uart.h"
#include "drivers/serial_uart_impl.h"
#include "pg/timerio.h"
#define DMA(c) { (c), (dmaResource_t *) dma_hw->ch[c] , 0 }
static dmaChannelSpec_t dmaChannelSpec[MAX_PERIPHERAL_DMA_OPTIONS] = {
DMA(1),
DMA(2),
DMA(3),
DMA(4),
DMA(5),
DMA(6),
DMA(7),
DMA(8),
DMA(9),
DMA(10),
DMA(11),
DMA(12),
#ifdef RP2350
DMA(13),
DMA(14),
DMA(15),
DMA(16),
#endif
};
#undef DMA
const dmaChannelSpec_t *dmaGetChannelSpecByPeripheral(dmaPeripheral_e device, uint8_t index, int8_t opt)
{
UNUSED(device);
UNUSED(index);
UNUSED(opt);
//TODO : Implementation for PICO
return NULL;
}
dmaoptValue_t dmaoptByTag(ioTag_t ioTag)
{
UNUSED(ioTag);
//TODO : Implementation for PICO
return DMA_OPT_UNUSED;
}
const dmaChannelSpec_t *dmaGetChannelSpecByTimerValue(TIM_TypeDef *tim, uint8_t channel, dmaoptValue_t dmaopt)
{
//TODO : Implementation for PICO
return NULL;
}
const dmaChannelSpec_t *dmaGetChannelSpecByTimer(const timerHardware_t *timer)
{
if (!timer) {
return NULL;
}
//TODO : Implementation for PICO
return NULL;
}
// dmaGetOptionByTimer is called by pgResetFn_timerIOConfig to find out dmaopt for pre-configured timer.
dmaoptValue_t dmaGetOptionByTimer(const timerHardware_t *timer)
{
//TODO : Implementation for PICO
return DMA_OPT_UNUSED;
}
// A variant of dmaGetOptionByTimer that looks for matching dmaTimUPRef
dmaoptValue_t dmaGetUpOptionByTimer(const timerHardware_t *timer)
{
//TODO : Implementation for PICO
return DMA_OPT_UNUSED;
}
#endif // USE_DMA_SPEC

View file

@ -1,27 +0,0 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later
* version.
*
* Betaflight 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.
*
* You should have received a copy of the GNU General Public
* License along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define MAX_PERIPHERAL_DMA_OPTIONS 14
#define MAX_TIMER_DMA_OPTIONS 22
#define USE_DMA_MUX

View file

@ -492,4 +492,50 @@ extern uint8_t _dmaram_end__;
#define ADC3_DMA_STREAM DMA2_Stream0
// ST0 or ST1
#endif
#endif
#endif
#ifdef USE_ITCM_RAM
#if defined(ITCM_RAM_OPTIMISATION) && !defined(DEBUG)
#define FAST_CODE __attribute__((section(".tcm_code"))) __attribute__((optimize(ITCM_RAM_OPTIMISATION)))
#else
#define FAST_CODE __attribute__((section(".tcm_code")))
#endif
// If a particular target is short of ITCM RAM, defining FAST_CODE_PREF in the target.h file will
// cause functions decorated FAST_CODE_PREF to *not* go into ITCM RAM but if FAST_CODE_PREF is not
// defined for the target, FAST_CODE_PREF will become an alias to FAST_CODE (in the common post
// header file), and functions decorated with FAST_CODE_PREF *will* go into ITCM RAM.
#define FAST_CODE_NOINLINE NOINLINE
#endif // USE_ITCM_RAM
// noting this is not used anywhere in the codebase at the moment
#ifdef USE_CCM_CODE
#define CCM_CODE __attribute__((section(".ccm_code")))
#endif
#ifdef USE_FAST_DATA
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
#endif // USE_FAST_DATA
#if defined(USE_EXST) && !defined(RAMBASED)
#define USE_FLASH_BOOT_LOADER
#endif
#if defined(USE_FLASH_MEMORY_MAPPED)
#if !defined(USE_RAM_CODE)
#define USE_RAM_CODE
#endif
#define MMFLASH_CODE RAM_CODE
#define MMFLASH_CODE_NOINLINE RAM_CODE NOINLINE
#define MMFLASH_DATA FAST_DATA
#define MMFLASH_DATA_ZERO_INIT FAST_DATA_ZERO_INIT
#endif
#ifdef USE_RAM_CODE
// RAM_CODE for methods that need to be in RAM, but don't need to be in the fastest type of memory.
// Note: if code is marked as RAM_CODE it *MUST* be in RAM, there is no alternative unlike functions marked with FAST_CODE/CCM_CODE
#define RAM_CODE __attribute__((section(".ram_code")))
#endif

View file

@ -77,6 +77,6 @@
#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors
// ITCM is in short supply for this target.
// For this target, functions decorated FAST_CODE_PREF will not be put into ITCM RAM;
// For this target, functions decorated FAST_CODE_PREF will not be put into ITCM RAM;
// on other targets, the same function *will* go into ITCM RAM
#define FAST_CODE_PREF