Browse Source

AP_HAL_ChibiOS: hwdef: add support for HAL CANIface based bootloader

zr-v5.1
Siddharth Purohit 5 years ago committed by Peter Barker
parent
commit
a79efaeb1d
  1. 14
      libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

14
libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

@ -645,11 +645,6 @@ def write_mcu_config(f): @@ -645,11 +645,6 @@ def write_mcu_config(f):
f.write('#define HAL_USE_SERIAL_USB TRUE\n')
if 'OTG2' in bytype:
f.write('#define STM32_USB_USE_OTG2 TRUE\n')
if have_type_prefix('CAN') and not args.bootloader:
if 'CAN1' in bytype and 'CAN2' in bytype:
enable_can(f, 2)
else:
enable_can(f, 1)
if get_config('PROCESS_STACK', required=False):
env_vars['PROCESS_STACK'] = get_config('PROCESS_STACK')
@ -672,11 +667,20 @@ def write_mcu_config(f): @@ -672,11 +667,20 @@ def write_mcu_config(f):
env_vars['PERIPH_FW'] = 0
# write any custom STM32 defines
using_chibios_can = False
for d in alllines:
if d.startswith('STM32_'):
f.write('#define %s\n' % d)
if d.startswith('define '):
if 'HAL_USE_CAN' in d:
using_chibios_can = True
f.write('#define %s\n' % d[7:])
if have_type_prefix('CAN') and not using_chibios_can:
if 'CAN1' in bytype and 'CAN2' in bytype:
enable_can(f, 2)
else:
enable_can(f, 1)
flash_size = get_config('FLASH_SIZE_KB', type=int)
f.write('#define BOARD_FLASH_SIZE %u\n' % flash_size)
env_vars['BOARD_FLASH_SIZE'] = flash_size

Loading…
Cancel
Save