mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 03:50:02 +03:00
Merge pull request #11032 from daleckystepan/gcc10
Support for GCC 11.2.1
This commit is contained in:
commit
73934cccc0
17 changed files with 27 additions and 29 deletions
19
Makefile
19
Makefile
|
@ -229,7 +229,7 @@ CC_DEBUG_OPTIMISATION := $(OPTIMISE_DEFAULT)
|
|||
CC_DEFAULT_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_DEFAULT)
|
||||
CC_SPEED_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SPEED)
|
||||
CC_SIZE_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SIZE)
|
||||
CC_NO_OPTIMISATION :=
|
||||
CC_NO_OPTIMISATION :=
|
||||
|
||||
#
|
||||
# Added after GCC version update, remove once the warnings have been fixed
|
||||
|
@ -240,12 +240,11 @@ CFLAGS += $(ARCH_FLAGS) \
|
|||
$(addprefix -D,$(OPTIONS)) \
|
||||
$(addprefix -I,$(INCLUDE_DIRS)) \
|
||||
$(DEBUG_FLAGS) \
|
||||
-std=gnu11 \
|
||||
-Wall -Wextra -Wunsafe-loop-optimizations -Wdouble-promotion \
|
||||
-std=gnu17 \
|
||||
-Wall -Wextra -Werror -Wpedantic -Wunsafe-loop-optimizations -Wdouble-promotion \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-fno-common \
|
||||
-pedantic \
|
||||
$(TEMPORARY_FLAGS) \
|
||||
$(DEVICE_FLAGS) \
|
||||
-D_GNU_SOURCE \
|
||||
|
@ -255,7 +254,7 @@ CFLAGS += $(ARCH_FLAGS) \
|
|||
-D'__FORKNAME__="$(FORKNAME)"' \
|
||||
-D'__TARGET__="$(TARGET)"' \
|
||||
-D'__REVISION__="$(REVISION)"' \
|
||||
-save-temps=obj \
|
||||
-pipe \
|
||||
-MMD -MP \
|
||||
$(EXTRA_FLAGS)
|
||||
|
||||
|
@ -332,7 +331,7 @@ ifeq ($(EXST),no)
|
|||
$(TARGET_BIN): $(TARGET_ELF)
|
||||
@echo "Creating BIN $(TARGET_BIN)" "$(STDOUT)"
|
||||
$(V1) $(OBJCOPY) -O binary $< $@
|
||||
|
||||
|
||||
$(TARGET_HEX): $(TARGET_ELF)
|
||||
@echo "Creating HEX $(TARGET_HEX)" "$(STDOUT)"
|
||||
$(V1) $(OBJCOPY) -O ihex --set-start 0x8000000 $< $@
|
||||
|
@ -356,8 +355,8 @@ $(TARGET_BIN): $(TARGET_UNPATCHED_BIN)
|
|||
$(V1) dd if=$(TARGET_UNPATCHED_BIN) of=$(TARGET_BIN) conv=notrunc
|
||||
|
||||
@echo "Generating MD5 hash of binary" "$(STDOUT)"
|
||||
$(V1) openssl dgst -md5 $(TARGET_BIN) > $(TARGET_UNPATCHED_BIN).md5
|
||||
|
||||
$(V1) openssl dgst -md5 $(TARGET_BIN) > $(TARGET_UNPATCHED_BIN).md5
|
||||
|
||||
@echo "Patching MD5 hash into binary" "$(STDOUT)"
|
||||
$(V1) cat $(TARGET_UNPATCHED_BIN).md5 | awk '{printf("%08x: %s",(1024*$(FIRMWARE_SIZE))-16,$$2);}' | xxd -r - $(TARGET_BIN)
|
||||
$(V1) echo $(FIRMWARE_SIZE) | awk '{printf("-s 0x%08x -l 16 -c 16 %s",(1024*$$1)-16,"$(TARGET_BIN)");}' | xargs xxd
|
||||
|
@ -370,10 +369,10 @@ $(TARGET_BIN): $(TARGET_UNPATCHED_BIN)
|
|||
@echo "Extracting HASH section from unpatched EXST elf $(TARGET_ELF)" "$(STDOUT)"
|
||||
$(OBJCOPY) $(TARGET_ELF) $(TARGET_EXST_ELF).tmp --dump-section .exst_hash=$(TARGET_EXST_HASH_SECTION_FILE) -j .exst_hash
|
||||
rm $(TARGET_EXST_ELF).tmp
|
||||
|
||||
|
||||
@echo "Patching MD5 hash into HASH section" "$(STDOUT)"
|
||||
$(V1) cat $(TARGET_UNPATCHED_BIN).md5 | awk '{printf("%08x: %s",64-16,$$2);}' | xxd -r - $(TARGET_EXST_HASH_SECTION_FILE)
|
||||
|
||||
|
||||
# For some currently unknown reason, OBJCOPY, with only input/output files, will generate a file around 2GB for the H730 unless we remove an unused-section
|
||||
# As a workaround drop the ._user_heap_stack section, which is only used during build to show errors if there's not enough space for the heap/stack.
|
||||
# The issue can be seen with `readelf -S $(TARGET_EXST_ELF)' vs `readelf -S $(TARGET_ELF)`
|
||||
|
|
|
@ -138,10 +138,10 @@ VPATH := $(VPATH):$(FATFS_DIR)
|
|||
endif
|
||||
|
||||
#Flags
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
|
||||
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(F411_TARGETS)))
|
||||
DEVICE_FLAGS = -DSTM32F411xE
|
||||
DEVICE_FLAGS = -DSTM32F411xE -finline-limit=20
|
||||
LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f411.ld
|
||||
STARTUP_SRC = startup_stm32f411xe.s
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),$(F405_TARGETS)))
|
||||
|
|
|
@ -123,7 +123,7 @@ VPATH := $(VPATH):$(FATFS_DIR)
|
|||
endif
|
||||
|
||||
#Flags
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsingle-precision-constant -Wdouble-promotion
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsingle-precision-constant
|
||||
|
||||
# Flags that are used in the STM32 libraries
|
||||
DEVICE_FLAGS = -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER
|
||||
|
|
|
@ -126,7 +126,7 @@ VPATH := $(VPATH):$(FATFS_DIR)
|
|||
endif
|
||||
|
||||
#Flags
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
|
||||
|
||||
DEVICE_FLAGS = -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DUSE_DMA_RAM -DMAX_MPU_REGIONS=16
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ VPATH := $(VPATH):$(FATFS_DIR)
|
|||
endif
|
||||
|
||||
#Flags
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsingle-precision-constant -Wdouble-promotion
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsingle-precision-constant
|
||||
|
||||
# Flags that are used in the STM32 libraries
|
||||
DEVICE_FLAGS = -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER
|
||||
|
|
|
@ -5242,7 +5242,7 @@ static void printResource(dumpFlags_t dumpMask, const char *headingStr)
|
|||
|
||||
for (int index = 0; index < RESOURCE_VALUE_MAX_INDEX(resourceTable[i].maxIndex); index++) {
|
||||
const ioTag_t ioTag = *(ioTag_t *)((const uint8_t *)currentConfig + resourceTable[i].stride * index + resourceTable[i].offset);
|
||||
ioTag_t ioTagDefault = NULL;
|
||||
ioTag_t ioTagDefault = 0;
|
||||
if (defaultConfig) {
|
||||
ioTagDefault = *(ioTag_t *)((const uint8_t *)defaultConfig + resourceTable[i].stride * index + resourceTable[i].offset);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ void * memcpy_fn ( void * destination, const void * source, size_t num ) asm("me
|
|||
#endif
|
||||
|
||||
#if __GNUC__ > 6
|
||||
#define FALLTHROUGH __attribute__ ((fallthrough))
|
||||
#define FALLTHROUGH ;__attribute__ ((fallthrough))
|
||||
#else
|
||||
#define FALLTHROUGH do {} while(0)
|
||||
#endif
|
||||
|
|
|
@ -687,7 +687,7 @@ static void bbPostInit()
|
|||
for (int motorIndex = 0; motorIndex < MAX_SUPPORTED_MOTORS && motorIndex < motorCount; motorIndex++) {
|
||||
|
||||
if (!bbMotorConfig(bbMotors[motorIndex].io, motorIndex, motorPwmProtocol, bbMotors[motorIndex].output)) {
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1231,7 +1231,7 @@ SD_Error_t SD_GetStatus(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
ErrorState = SD_CARD_ERROR;
|
||||
ErrorState = SD_ERROR;
|
||||
}
|
||||
|
||||
return ErrorState;
|
||||
|
|
|
@ -1216,7 +1216,7 @@ SD_Error_t SD_GetStatus(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
ErrorState = SD_CARD_ERROR;
|
||||
ErrorState = SD_ERROR;
|
||||
}
|
||||
|
||||
return ErrorState;
|
||||
|
|
|
@ -81,7 +81,7 @@ static void uartConfigurePinSwap(uartPort_t *uartPort)
|
|||
{
|
||||
uartDevice_t *uartDevice = uartFindDevice(uartPort);
|
||||
if (!uartDevice) {
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (uartDevice->pinSwap) {
|
||||
|
|
|
@ -2141,7 +2141,7 @@ afatfsOperationStatus_e afatfs_fseek(afatfsFilePtr_t file, int32_t offset, afatf
|
|||
break;
|
||||
|
||||
case AFATFS_SEEK_SET:
|
||||
FALLTHROUGH;
|
||||
break;
|
||||
}
|
||||
|
||||
// Now we have a SEEK_SET with a positive offset. Begin by seeking to the start of the file
|
||||
|
|
|
@ -85,7 +85,7 @@ static int crsfWriteString(displayPort_t *displayPort, uint8_t col, uint8_t row,
|
|||
if (row >= crsfScreen.rows || col >= crsfScreen.cols) {
|
||||
return 0;
|
||||
}
|
||||
const size_t truncLen = MIN((int)strlen(s), crsfScreen.cols-col); // truncate at colCount
|
||||
const size_t truncLen = MIN(strlen(s), (size_t)(crsfScreen.cols - col)); // truncate at colCount
|
||||
char *rowStart = &crsfScreen.buffer[row * crsfScreen.cols + col];
|
||||
crsfScreen.updated |= memcmp(rowStart, s, truncLen);
|
||||
if (crsfScreen.updated) {
|
||||
|
|
|
@ -216,7 +216,7 @@ static int8_t STORAGE_Read (uint8_t lun,
|
|||
{
|
||||
UNUSED(lun);
|
||||
for (int i = 0; i < blk_len; i++) {
|
||||
while (sdcard_readBlock(blk_addr + i, buf + (512 * i), NULL, NULL) == 0);
|
||||
while (sdcard_readBlock(blk_addr + i, buf + (512 * i), NULL, 0) == 0);
|
||||
while (sdcard_poll() == 0);
|
||||
}
|
||||
mscSetActive();
|
||||
|
@ -236,7 +236,7 @@ static int8_t STORAGE_Write (uint8_t lun,
|
|||
{
|
||||
UNUSED(lun);
|
||||
for (int i = 0; i < blk_len; i++) {
|
||||
while (sdcard_writeBlock(blk_addr + i, buf + (i * 512), NULL, NULL) != SDCARD_OPERATION_IN_PROGRESS) {
|
||||
while (sdcard_writeBlock(blk_addr + i, buf + (i * 512), NULL, 0) != SDCARD_OPERATION_IN_PROGRESS) {
|
||||
sdcard_poll();
|
||||
}
|
||||
while (sdcard_poll() == 0);
|
||||
|
|
|
@ -812,8 +812,6 @@ void SetSysClock(void)
|
|||
|
||||
/* Wait till the main PLL is used as system clock source */
|
||||
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(STM32F446xx)
|
||||
// Always use PLLSAI to derive USB 48MHz clock.
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#ifdef STM32F7
|
||||
#define USE_ITCM_RAM
|
||||
#define ITCM_RAM_OPTIMISATION "-O2"
|
||||
#define ITCM_RAM_OPTIMISATION "-O2", "-freorder-blocks-algorithm=simple"
|
||||
#define USE_FAST_DATA
|
||||
#define USE_DSHOT
|
||||
#define USE_DSHOT_BITBANG
|
||||
|
|
|
@ -499,7 +499,8 @@ COMMON_FLAGS = \
|
|||
-isystem $(GTEST_DIR)/inc \
|
||||
-MMD -MP \
|
||||
-Wno-c99-extensions \
|
||||
-Wno-reorder
|
||||
-Wno-reorder \
|
||||
-pipe
|
||||
|
||||
CC_VERSION = $(shell $(CC) -dumpversion)
|
||||
CXX_VERSION = $(shell $(CXX) -dumpversion)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue