From 4ce0c2c82797a597dcc19df7ecdf8bf8dc50f8c5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 8 Feb 2018 16:18:11 +1100 Subject: [PATCH] HAL_ChibiOS: simplify skyviper-v2450 config remove unused peripherals --- .../hwdef/scripts/chibios_hwdef.py | 16 ++++++++++++- .../hwdef/skyviper-v2450/hwdef.dat | 23 ++++++++++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 21871dd9ec..0754bcfdd0 100755 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -828,6 +828,7 @@ def build_peripheral_list(): def process_line(line): '''process one line of pin definition file''' + global allpins a = shlex.split(line) # keep all config lines for later use alllines.append(line) @@ -864,11 +865,24 @@ def process_line(line): if a[0] == 'SPIDEV': spidev.append(a[1:]) if a[0] == 'undef': + print("Removing %s" % a[1]) config.pop(a[1], '') + bytype.pop(a[1],'') + bylabel.pop(a[1],'') #also remove all occurences of defines in previous lines if any - for line in alllines: + for line in alllines[:]: if line.startswith('define') and a[1] in line: alllines.remove(line) + newpins = [] + for pin in allpins: + if pin.type == a[1]: + continue + if pin.label == a[1]: + continue + if pin.portpin == a[1]: + continue + newpins.append(pin) + allpins = newpins def process_file(filename): diff --git a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-v2450/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-v2450/hwdef.dat index eaee46d22c..093a3a156a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-v2450/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-v2450/hwdef.dat @@ -4,24 +4,35 @@ # start with fmuv3 base port include ../fmuv3/hwdef.dat +# remove some unnecessary features from fmuv3 +undef UART8 +undef UART8_TX +undef UART8_RX +undef USART3 +undef USART3_TX +undef USART3_RX +undef HAL_WITH_UAVCAN +undef IOMCU_UART +undef AP_FEATURE_SBUS_OUT +undef HAL_OS_FATFS_IO +undef AP_FEATURE_RTSCTS +undef HAL_WITH_RAMTRON +undef IOMCU_UART + +UART_ORDER OTG1 UART4 USART2 + # enable AP_Radio support define HAL_RCINPUT_WITH_AP_RADIO 1 define HAL_GPIO_RADIO_RESET 1 // PB0 GPIO from FMU3 define HAL_GPIO_RADIO_IRQ 15 // PD15 -# disable FRAM for storage -undef HAL_WITH_RAMTRON - # setup defines for ArduCopter config define TOY_MODE_ENABLED ENABLED define ARMING_DELAY_SEC 0 define LAND_START_ALT 700 define LAND_DETECTOR_ACCEL_MAX 2.0f -# disable IOMCU -undef IOMCU_UART - # support cypress and cc2500 radios SPIDEV cypress SPI2 DEVID11 FRAM_CS MODE0 2*MHZ 2*MHZ SPIDEV cc2500 SPI2 DEVID12 FRAM_CS MODE0 4*MHZ 4*MHZ