AP_HAL_ChibiOS: base HAL_USE_SPI on devices not buses

fixes compilation problem with gcc 10.3

../../libraries/AP_HAL_ChibiOS/SPIDevice.cpp: In static member function 'static void ChibiOS::SPIDeviceManager::__static_initialization_and_destruction_0(int, int)':
../../libraries/AP_HAL_ChibiOS/SPIDevice.cpp:76:18: error: statement has no effect [-Werror=unused-value]
   76 | ChibiOS::SPIDesc SPIDeviceManager::device_table[] = { HAL_SPI_DEVICE_LIST };
      |                  ^~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: some warnings being treated as errors
This commit is contained in:
Peter Barker 2023-11-17 11:18:06 +11:00 committed by Peter Barker
parent d23c633b2c
commit e9fc99b1bf
1 changed files with 3 additions and 1 deletions

View File

@ -1524,7 +1524,9 @@ INCLUDE common.ld
if t.startswith('SPI'): if t.startswith('SPI'):
self.spi_list.append(t) self.spi_list.append(t)
self.spi_list = sorted(self.spi_list) self.spi_list = sorted(self.spi_list)
if len(self.spi_list) == 0: if len(self.spidev) != 0 and len(self.spi_list) == 0:
self.error("Have SPI devices but no SPI bus?!")
if len(self.spidev) == 0:
f.write('#define HAL_USE_SPI FALSE\n') f.write('#define HAL_USE_SPI FALSE\n')
return return
devlist = [] devlist = []