mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
Fix missing #if for PINIO_COUNT (#14515)
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:
parent
01329e3350
commit
b6d37008f5
4 changed files with 11 additions and 1 deletions
4
Makefile
4
Makefile
|
@ -48,7 +48,7 @@ SERIAL_DEVICE ?= $(firstword $(wildcard /dev/ttyACM*) $(firstword $(wildcard /
|
||||||
FLASH_SIZE ?=
|
FLASH_SIZE ?=
|
||||||
|
|
||||||
# Disabled build flags
|
# Disabled build flags
|
||||||
CFLAGS_DISABLED :=
|
CFLAGS_DISABLED ?=
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Things that need to be maintained as the source changes
|
# Things that need to be maintained as the source changes
|
||||||
|
@ -349,6 +349,8 @@ LD_FLAGS = -lm \
|
||||||
$(EXTRA_LD_FLAGS)
|
$(EXTRA_LD_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
LTO_FLAGS := $(filter-out $(CFLAGS_DISABLED), $(LTO_FLAGS))
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# No user-serviceable parts below
|
# No user-serviceable parts below
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
@ -196,7 +196,9 @@ static const void *cmsx_FirmwareInit(displayPort_t *pDisp)
|
||||||
UNUSED(pDisp);
|
UNUSED(pDisp);
|
||||||
|
|
||||||
strncpy(manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
|
strncpy(manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
|
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
|
||||||
strncpy(boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
|
strncpy(boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
|
||||||
|
boardName[MAX_BOARD_NAME_LENGTH] = 0;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,9 @@ void initBoardInformation(void)
|
||||||
boardInformationSet = boardConfig()->boardInformationSet;
|
boardInformationSet = boardConfig()->boardInformationSet;
|
||||||
if (boardInformationSet) {
|
if (boardInformationSet) {
|
||||||
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
|
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
|
||||||
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH + 1);
|
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH + 1);
|
||||||
|
boardName[MAX_BOARD_NAME_LENGTH] = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -87,6 +89,7 @@ bool setManufacturerId(const char *newManufacturerId)
|
||||||
#if !defined(BOARD_NAME)
|
#if !defined(BOARD_NAME)
|
||||||
if (!boardInformationSet || strlen(manufacturerId) == 0) {
|
if (!boardInformationSet || strlen(manufacturerId) == 0) {
|
||||||
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
|
manufacturerId[MAX_MANUFACTURER_ID_LENGTH] = 0;
|
||||||
|
|
||||||
boardInformationWasUpdated = true;
|
boardInformationWasUpdated = true;
|
||||||
|
|
||||||
|
@ -105,6 +108,7 @@ bool setBoardName(const char *newBoardName)
|
||||||
#if !defined(BOARD_NAME)
|
#if !defined(BOARD_NAME)
|
||||||
if (!boardInformationSet || strlen(boardName) == 0) {
|
if (!boardInformationSet || strlen(boardName) == 0) {
|
||||||
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH + 1);
|
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH + 1);
|
||||||
|
boardName[MAX_BOARD_NAME_LENGTH] = 0;
|
||||||
|
|
||||||
boardInformationWasUpdated = true;
|
boardInformationWasUpdated = true;
|
||||||
|
|
||||||
|
|
|
@ -104,9 +104,11 @@ void pgResetFn_pinioConfig(pinioConfig_t *config)
|
||||||
config->config[1] = PINIO2_CONFIG;
|
config->config[1] = PINIO2_CONFIG;
|
||||||
config->config[2] = PINIO3_CONFIG;
|
config->config[2] = PINIO3_CONFIG;
|
||||||
config->config[3] = PINIO4_CONFIG;
|
config->config[3] = PINIO4_CONFIG;
|
||||||
|
#if PINIO_COUNT > 4
|
||||||
config->config[4] = PINIO5_CONFIG;
|
config->config[4] = PINIO5_CONFIG;
|
||||||
config->config[5] = PINIO6_CONFIG;
|
config->config[5] = PINIO6_CONFIG;
|
||||||
config->config[6] = PINIO7_CONFIG;
|
config->config[6] = PINIO7_CONFIG;
|
||||||
config->config[7] = PINIO8_CONFIG;
|
config->config[7] = PINIO8_CONFIG;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue