Merge pull request #3072 from ledvinap/fix-sitl-warnings
Fix SITL warnings
This commit is contained in:
commit
2463d5164e
|
@ -146,7 +146,7 @@ uint32_t IO_EXTI_Line(IO_t io)
|
|||
#elif defined(STM32F7)
|
||||
return 1 << IO_GPIOPinIdx(io);
|
||||
#elif defined(SIMULATOR_BUILD)
|
||||
return 1;
|
||||
return 0;
|
||||
#else
|
||||
# error "Unknown target type"
|
||||
#endif
|
||||
|
@ -353,9 +353,20 @@ void IOConfigGPIOAF(IO_t io, ioConfig_t cfg, uint8_t af)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if DEFIO_PORT_USED_COUNT > 0
|
||||
static const uint16_t ioDefUsedMask[DEFIO_PORT_USED_COUNT] = { DEFIO_PORT_USED_LIST };
|
||||
static const uint8_t ioDefUsedOffset[DEFIO_PORT_USED_COUNT] = { DEFIO_PORT_OFFSET_LIST };
|
||||
#else
|
||||
// Avoid -Wpedantic warning
|
||||
static const uint16_t ioDefUsedMask[1] = {0};
|
||||
static const uint8_t ioDefUsedOffset[1] = {0};
|
||||
#endif
|
||||
#if DEFIO_IO_USED_COUNT
|
||||
ioRec_t ioRecs[DEFIO_IO_USED_COUNT];
|
||||
#else
|
||||
// Avoid -Wpedantic warning
|
||||
ioRec_t ioRecs[1];
|
||||
#endif
|
||||
|
||||
// initialize all ioRec_t structures from ROM
|
||||
// currently only bitmask is used, this may change in future
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
// this file is automatically generated by def_generated.pl script
|
||||
#pragma once
|
||||
|
||||
// this file is automatically generated by src/utils/def_generated.pl script
|
||||
// do not modify this file directly, your changes will be lost
|
||||
|
||||
// DEFIO_PORT_<port>_USED_MASK is bitmask of used pins on target
|
||||
|
@ -96,7 +97,8 @@
|
|||
#define DEFIO_GPIOID__F 5
|
||||
#define DEFIO_GPIOID__G 6
|
||||
|
||||
// DEFIO_TAG__P<port><pin> will expand to TAG if defined for target
|
||||
// DEFIO_TAG__P<port><pin> will expand to TAG if defined for target, error is triggered otherwise
|
||||
// DEFIO_TAG_E__P<port><pin> will expand to TAG if defined, to NONE otherwise (usefull for tables that are CPU-specific)
|
||||
// DEFIO_REC__P<port><pin> will expand to ioRec* (using DEFIO_REC_INDEX(idx))
|
||||
|
||||
#if DEFIO_PORT_A_USED_MASK & BIT(0)
|
||||
|
@ -1150,8 +1152,10 @@
|
|||
# define DEFIO_PORT_OFFSET_LIST DEFIO_PORT_A_OFFSET
|
||||
#endif
|
||||
|
||||
#if !defined DEFIO_PORT_USED_LIST
|
||||
# warning "No pins are defined. Maybe you forgot to define TARGET_IO_PORTx in target_io.h"
|
||||
#if !defined(DEFIO_PORT_USED_LIST)
|
||||
# if !defined DEFIO_NO_PORTS // supress warnings if we really don't want any pins
|
||||
# warning "No pins are defined. Maybe you forgot to define TARGET_IO_PORTx in target.h"
|
||||
# endif
|
||||
# define DEFIO_PORT_USED_COUNT 0
|
||||
# define DEFIO_PORT_USED_LIST /* empty */
|
||||
# define DEFIO_PORT_OFFSET_LIST /* empty */
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef struct ioRec_s {
|
|||
uint8_t index;
|
||||
} ioRec_t;
|
||||
|
||||
extern ioRec_t ioRecs[DEFIO_IO_USED_COUNT];
|
||||
extern ioRec_t ioRecs[];
|
||||
|
||||
int IO_GPIOPortIdx(IO_t io);
|
||||
int IO_GPIOPinIdx(IO_t io);
|
||||
|
|
|
@ -90,10 +90,10 @@ uint32_t stackUsedSize(void)
|
|||
|
||||
uint32_t stackTotalSize(void)
|
||||
{
|
||||
return (uint32_t)&_Min_Stack_Size;
|
||||
return (uint32_t)(intptr_t)&_Min_Stack_Size;
|
||||
}
|
||||
|
||||
uint32_t stackHighMem(void)
|
||||
{
|
||||
return (uint32_t)&_estack;
|
||||
return (uint32_t)(intptr_t)&_estack;
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@ static void cliSetVar(const clivalue_t *var, const cliVar_t value)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef MINIMAL_CLI
|
||||
#if defined(USE_RESOURCE_MGMT) && !defined(MINIMAL_CLI)
|
||||
static void cliRepeat(char ch, uint8_t len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
|
|
@ -70,6 +70,10 @@ bool baroDetect(baroDev_t *dev, baroSensor_e baroHardwareToUse)
|
|||
|
||||
baroSensor_e baroHardware = baroHardwareToUse;
|
||||
|
||||
#if !defined(USE_BARO_BMP085) && !defined(USE_BARO_MS5611) && !defined(USE_BARO_BMP280) && !defined(USE_BARO_SPI_BMP280)
|
||||
UNUSED(dev);
|
||||
#endif
|
||||
|
||||
#ifdef USE_BARO_BMP085
|
||||
const bmp085Config_t *bmp085Config = NULL;
|
||||
|
||||
|
|
|
@ -115,17 +115,12 @@
|
|||
|
||||
#define FLASH_SIZE 2048
|
||||
|
||||
# define DEFIO_PORT_USED_COUNT 0
|
||||
# define DEFIO_PORT_USED_LIST /* empty */
|
||||
# define DEFIO_PORT_OFFSET_LIST /* empty */
|
||||
|
||||
#define LED_STRIP_TIMER 1
|
||||
#define SOFTSERIAL_1_TIMER 2
|
||||
#define SOFTSERIAL_2_TIMER 3
|
||||
|
||||
#define TARGET_IO_PORTA 0xffff
|
||||
#define TARGET_IO_PORTB 0xffff
|
||||
#define TARGET_IO_PORTC 0xffff
|
||||
#define DEFIO_NO_PORTS // suppress 'no pins defined' warning
|
||||
|
||||
#define WS2811_DMA_TC_FLAG (void *)1
|
||||
#define WS2811_DMA_HANDLER_IDENTIFER 0
|
||||
|
@ -162,7 +157,7 @@ typedef struct
|
|||
uint32_t BRR;
|
||||
} GPIO_TypeDef;
|
||||
|
||||
#define GPIOA_BASE (0x0001)
|
||||
#define GPIOA_BASE ((intptr_t)0x0001)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -14,6 +14,25 @@ my $drivers_dir = "../main/drivers";
|
|||
# change list separator to newline - we use @{} interpolation to merge multiline strings
|
||||
$" = "\n";
|
||||
|
||||
chomp(my $license = <<"END");
|
||||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it 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.
|
||||
*
|
||||
* Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
END
|
||||
|
||||
chomp(my $disclaimer_generated = <<"END");
|
||||
// this file is automatically generated by src/utils/def_generated.pl script
|
||||
// do not modify this file directly, your changes will be lost
|
||||
|
@ -23,7 +42,10 @@ my $io_def_file="$drivers_dir/io_def_generated.h";
|
|||
my $fh;
|
||||
open $fh, '>', $io_def_file or die "Cannot open $io_def_file: $!";
|
||||
print { $fh} <<"END" or die "Cannot write into $io_def_file: $!"; close $fh;
|
||||
${license}
|
||||
|
||||
#pragma once
|
||||
|
||||
${disclaimer_generated}
|
||||
|
||||
// DEFIO_PORT_<port>_USED_MASK is bitmask of used pins on target
|
||||
|
@ -39,7 +61,7 @@ ${disclaimer_generated}
|
|||
# define DEFIO_PORT_${port}_USED_MASK 0
|
||||
# define DEFIO_PORT_${port}_USED_COUNT 0
|
||||
#endif
|
||||
# define DEFIO_PORT_${port}_OFFSET (@{[join('+', map { "DEFIO_PORT_${_}_USED_COUNT" } @prev_ports) || '0']})
|
||||
#define DEFIO_PORT_${port}_OFFSET (@{[join('+', map { "DEFIO_PORT_${_}_USED_COUNT" } @prev_ports) || '0']})
|
||||
END2
|
||||
|
||||
|
||||
|
@ -48,18 +70,20 @@ END2
|
|||
#define DEFIO_GPIOID__${port} @{[ord($port)-ord('A')]}
|
||||
END2
|
||||
|
||||
// DEFIO_TAG__P<port><pin> will expand to TAG if defined for target
|
||||
// DEFIO_TAG__P<port><pin> will expand to TAG if defined for target, error is triggered otherwise
|
||||
// DEFIO_TAG_E__P<port><pin> will expand to TAG if defined, to NONE otherwise (usefull for tables that are CPU-specific)
|
||||
// DEFIO_REC__P<port><pin> will expand to ioRec* (using DEFIO_REC_INDEX(idx))
|
||||
// all P<port><pin> macros are defined to expand to self to generate warning if someone tries to redefine them
|
||||
|
||||
@{[do {
|
||||
my @prev_ports = ();
|
||||
map { my $port = $_; my @ret = map { my $pin = $_; chomp(my $ret = << "END2"); $ret } @pins ; push @prev_ports, $port; @ret } @ports; }]}
|
||||
#define P${port}${pin} P${port}${pin}
|
||||
#if DEFIO_PORT_${port}_USED_MASK & BIT(${pin})
|
||||
# define DEFIO_TAG__P${port}${pin} DEFIO_TAG_MAKE(DEFIO_GPIOID__${port}, ${pin})
|
||||
# define DEFIO_TAG_E__P${port}${pin} DEFIO_TAG_MAKE(DEFIO_GPIOID__${port}, ${pin})
|
||||
# define DEFIO_REC__P${port}${pin} DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_${port}_USED_MASK & (BIT(${pin}) - 1)) + @{[join('+', map { "DEFIO_PORT_${_}_USED_COUNT" } @prev_ports) || '0']})
|
||||
#else
|
||||
# define DEFIO_TAG__P${port}${pin} defio_error_P${port}${pin}_is_not_supported_on_TARGET
|
||||
# define DEFIO_TAG_E__P${port}${pin} DEFIO_TAG_E__NONE
|
||||
# define DEFIO_REC__P${port}${pin} defio_error_P${port}${pin}_is_not_supported_on_TARGET
|
||||
#endif
|
||||
END2
|
||||
|
@ -80,8 +104,10 @@ END2
|
|||
#endif
|
||||
END2
|
||||
|
||||
#if !defined(DEFIO_PORT_USED_LIST) && !defined(UNIT_TEST)
|
||||
# warning "No pins are defined. Maybe you forgot to define TARGET_IO_PORTx in target.h"
|
||||
#if !defined(DEFIO_PORT_USED_LIST)
|
||||
# if !defined DEFIO_NO_PORTS // supress warnings if we really don't want any pins
|
||||
# warning "No pins are defined. Maybe you forgot to define TARGET_IO_PORTx in target.h"
|
||||
# endif
|
||||
# define DEFIO_PORT_USED_COUNT 0
|
||||
# define DEFIO_PORT_USED_LIST /* empty */
|
||||
# define DEFIO_PORT_OFFSET_LIST /* empty */
|
||||
|
|
Loading…
Reference in New Issue