mirror of https://github.com/ArduPilot/ardupilot
HAL_ChibiOS: fixed bug in UART pin assignment
this fixes an issue with the setting of pullup/pulldown on UARTs. It also adds enforcement of DMA assignment for DMA required peripherals
This commit is contained in:
parent
8ffd1050eb
commit
a30e637484
|
@ -1470,10 +1470,10 @@ def write_hwdef_header(outfilename):
|
||||||
write_peripheral_enable(f)
|
write_peripheral_enable(f)
|
||||||
setup_apj_IDs()
|
setup_apj_IDs()
|
||||||
|
|
||||||
dma_resolver.write_dma_header(f, periph_list, mcu_type,
|
dma_unassigned = dma_resolver.write_dma_header(f, periph_list, mcu_type,
|
||||||
dma_exclude=get_dma_exclude(periph_list),
|
dma_exclude=get_dma_exclude(periph_list),
|
||||||
dma_priority=get_config('DMA_PRIORITY',default='TIM* SPI*', spaces=True),
|
dma_priority=get_config('DMA_PRIORITY',default='TIM* SPI*', spaces=True),
|
||||||
dma_noshare=get_config('DMA_NOSHARE',default='', spaces=True))
|
dma_noshare=get_config('DMA_NOSHARE',default='', spaces=True))
|
||||||
|
|
||||||
if not args.bootloader:
|
if not args.bootloader:
|
||||||
write_PWM_config(f)
|
write_PWM_config(f)
|
||||||
|
@ -1570,6 +1570,14 @@ def write_hwdef_header(outfilename):
|
||||||
f.write("0")
|
f.write("0")
|
||||||
f.write(")\n\n")
|
f.write(")\n\n")
|
||||||
|
|
||||||
|
if not mcu_series.startswith("STM32F1"):
|
||||||
|
dma_required = ['SPI*', 'ADC*']
|
||||||
|
if 'IOMCU_UART' in config:
|
||||||
|
dma_required.append(config['IOMCU_UART'][0] + '*')
|
||||||
|
for d in dma_unassigned:
|
||||||
|
for r in dma_required:
|
||||||
|
if fnmatch.fnmatch(d, r):
|
||||||
|
error("Missing required DMA for %s" % d)
|
||||||
|
|
||||||
def build_peripheral_list():
|
def build_peripheral_list():
|
||||||
'''build a list of peripherals for DMA resolver to work on'''
|
'''build a list of peripherals for DMA resolver to work on'''
|
||||||
|
@ -1584,12 +1592,16 @@ def build_peripheral_list():
|
||||||
if type.startswith(prefix):
|
if type.startswith(prefix):
|
||||||
ptx = type + "_TX"
|
ptx = type + "_TX"
|
||||||
prx = type + "_RX"
|
prx = type + "_RX"
|
||||||
peripherals.append(ptx)
|
if prefix in ['SPI', 'I2C']:
|
||||||
peripherals.append(prx)
|
# in DMA map I2C and SPI has RX and TX suffix
|
||||||
if not ptx in bylabel:
|
if not ptx in bylabel:
|
||||||
bylabel[ptx] = p
|
bylabel[ptx] = p
|
||||||
if not prx in bylabel:
|
if not prx in bylabel:
|
||||||
bylabel[prx] = p
|
bylabel[prx] = p
|
||||||
|
if prx in bylabel:
|
||||||
|
peripherals.append(prx)
|
||||||
|
if ptx in bylabel:
|
||||||
|
peripherals.append(ptx)
|
||||||
|
|
||||||
if type.startswith('ADC'):
|
if type.startswith('ADC'):
|
||||||
peripherals.append(type)
|
peripherals.append(type)
|
||||||
|
|
|
@ -236,7 +236,7 @@ def write_dma_header(f, peripheral_list, mcu_type, dma_exclude=[],
|
||||||
if hasattr(lib, "DMA_Map"):
|
if hasattr(lib, "DMA_Map"):
|
||||||
dma_map = lib.DMA_Map
|
dma_map = lib.DMA_Map
|
||||||
else:
|
else:
|
||||||
return
|
return []
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("Unable to find module for MCU %s" % mcu_type)
|
print("Unable to find module for MCU %s" % mcu_type)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -386,6 +386,7 @@ def write_dma_header(f, peripheral_list, mcu_type, dma_exclude=[],
|
||||||
continue
|
continue
|
||||||
f.write('#define STM32_SPI_%s_DMA_STREAMS STM32_SPI_%s_TX_%s_STREAM, STM32_SPI_%s_RX_%s_STREAM\n' % (
|
f.write('#define STM32_SPI_%s_DMA_STREAMS STM32_SPI_%s_TX_%s_STREAM, STM32_SPI_%s_RX_%s_STREAM\n' % (
|
||||||
key, key, dma_name(key), key, dma_name(key)))
|
key, key, dma_name(key), key, dma_name(key)))
|
||||||
|
return unassigned
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue