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

Fix missing #if for PINIO_COUNT

Allow user to supply CFLAGS_DISABLED to Makefile.
Fix missing #if..endif for PINIO_COUNT in pinio.c.
Fix other strncpy build warning/errors for build with CFLAGS_DISABLED="-flto=auto".
This commit is contained in:
Matthew Selby 2025-07-05 18:02:49 +01:00
parent d054b68ffe
commit c0fe2a9e8a
4 changed files with 11 additions and 1 deletions

View file

@ -48,7 +48,7 @@ SERIAL_DEVICE ?= $(firstword $(wildcard /dev/ttyACM*) $(firstword $(wildcard /
FLASH_SIZE ?=
# Disabled build flags
CFLAGS_DISABLED :=
CFLAGS_DISABLED ?=
###############################################################################
# Things that need to be maintained as the source changes
@ -349,6 +349,8 @@ LD_FLAGS = -lm \
$(EXTRA_LD_FLAGS)
endif
LTO_FLAGS := $(filter-out $(CFLAGS_DISABLED), $(LTO_FLAGS))
###############################################################################
# No user-serviceable parts below
###############################################################################

View file

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

View file

@ -43,7 +43,9 @@ void initBoardInformation(void)
boardInformationSet = boardConfig()->boardInformationSet;
if (boardInformationSet) {
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH + 1);
boardName[MAX_BOARD_NAME_LENGTH] = 0;
}
#endif
@ -87,6 +89,7 @@ bool setManufacturerId(const char *newManufacturerId)
#if !defined(BOARD_NAME)
if (!boardInformationSet || strlen(manufacturerId) == 0) {
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
boardInformationWasUpdated = true;
@ -105,6 +108,7 @@ bool setBoardName(const char *newBoardName)
#if !defined(BOARD_NAME)
if (!boardInformationSet || strlen(boardName) == 0) {
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH + 1);
boardName[MAX_BOARD_NAME_LENGTH] = 0;
boardInformationWasUpdated = true;

View file

@ -104,9 +104,11 @@ void pgResetFn_pinioConfig(pinioConfig_t *config)
config->config[1] = PINIO2_CONFIG;
config->config[2] = PINIO3_CONFIG;
config->config[3] = PINIO4_CONFIG;
#if PINIO_COUNT > 4
config->config[4] = PINIO5_CONFIG;
config->config[5] = PINIO6_CONFIG;
config->config[6] = PINIO7_CONFIG;
config->config[7] = PINIO8_CONFIG;
#endif
}
#endif