mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_HAL_ChibiOS: avoid use of global args in ChibiOSHWdef object
This commit is contained in:
parent
b971046a07
commit
53b726271f
@ -866,8 +866,8 @@ class ChibiOSHWDef(object):
|
|||||||
storage_flash_page = self.get_config('STORAGE_FLASH_PAGE', default=None, type=int, required=False)
|
storage_flash_page = self.get_config('STORAGE_FLASH_PAGE', default=None, type=int, required=False)
|
||||||
if storage_flash_page is not None:
|
if storage_flash_page is not None:
|
||||||
return storage_flash_page
|
return storage_flash_page
|
||||||
if self.is_bootloader_fw() and args.hwdef[0].find("-bl") != -1:
|
if self.is_bootloader_fw() and self.hwdef[0].find("-bl") != -1:
|
||||||
hwdefdat = args.hwdef[0].replace("-bl", "")
|
hwdefdat = self.hwdef[0].replace("-bl", "")
|
||||||
if os.path.exists(hwdefdat):
|
if os.path.exists(hwdefdat):
|
||||||
ret = None
|
ret = None
|
||||||
lines = self.load_file_with_include(hwdefdat)
|
lines = self.load_file_with_include(hwdefdat)
|
||||||
@ -927,7 +927,7 @@ class ChibiOSHWDef(object):
|
|||||||
|
|
||||||
def write_mcu_config(self, f):
|
def write_mcu_config(self, f):
|
||||||
'''write MCU config defines'''
|
'''write MCU config defines'''
|
||||||
f.write('#define CHIBIOS_BOARD_NAME "%s"\n' % os.path.basename(os.path.dirname(args.hwdef[0])))
|
f.write('#define CHIBIOS_BOARD_NAME "%s"\n' % os.path.basename(os.path.dirname(self.hwdef[0])))
|
||||||
f.write('// MCU type (ChibiOS define)\n')
|
f.write('// MCU type (ChibiOS define)\n')
|
||||||
f.write('#define %s_MCUCONF\n' % self.get_config('MCU'))
|
f.write('#define %s_MCUCONF\n' % self.get_config('MCU'))
|
||||||
mcu_subtype = self.get_config('MCU', 1)
|
mcu_subtype = self.get_config('MCU', 1)
|
||||||
@ -2464,7 +2464,7 @@ INCLUDE common.ld
|
|||||||
# always embed a bootloader if it is available
|
# always embed a bootloader if it is available
|
||||||
this_dir = os.path.realpath(__file__)
|
this_dir = os.path.realpath(__file__)
|
||||||
rootdir = os.path.relpath(os.path.join(this_dir, "../../../../.."))
|
rootdir = os.path.relpath(os.path.join(this_dir, "../../../../.."))
|
||||||
hwdef_dirname = os.path.basename(os.path.dirname(args.hwdef[0]))
|
hwdef_dirname = os.path.basename(os.path.dirname(self.hwdef[0]))
|
||||||
# allow re-using of bootloader from different build:
|
# allow re-using of bootloader from different build:
|
||||||
use_bootloader_from_board = self.get_config('USE_BOOTLOADER_FROM_BOARD', default=None, required=False)
|
use_bootloader_from_board = self.get_config('USE_BOOTLOADER_FROM_BOARD', default=None, required=False)
|
||||||
if use_bootloader_from_board is not None:
|
if use_bootloader_from_board is not None:
|
||||||
@ -2493,7 +2493,7 @@ INCLUDE common.ld
|
|||||||
self.error('''Bootloader (%s) does not exist and AP_BOOTLOADER_FLASHING_ENABLED
|
self.error('''Bootloader (%s) does not exist and AP_BOOTLOADER_FLASHING_ENABLED
|
||||||
Please run: Tools/scripts/build_bootloaders.py %s
|
Please run: Tools/scripts/build_bootloaders.py %s
|
||||||
''' %
|
''' %
|
||||||
(bp, os.path.basename(os.path.dirname(args.hwdef[0]))))
|
(bp, os.path.basename(os.path.dirname(self.hwdef[0]))))
|
||||||
|
|
||||||
bp = os.path.realpath(bp)
|
bp = os.path.realpath(bp)
|
||||||
|
|
||||||
@ -2888,8 +2888,8 @@ Please run: Tools/scripts/build_bootloaders.py %s
|
|||||||
|
|
||||||
def write_processed_defaults_file(self, filepath):
|
def write_processed_defaults_file(self, filepath):
|
||||||
# see if board has a defaults.parm file or a --default-parameters file was specified
|
# see if board has a defaults.parm file or a --default-parameters file was specified
|
||||||
defaults_filename = os.path.join(os.path.dirname(args.hwdef[0]), 'defaults.parm')
|
defaults_filename = os.path.join(os.path.dirname(self.hwdef[0]), 'defaults.parm')
|
||||||
defaults_path = os.path.join(os.path.dirname(args.hwdef[0]), args.params)
|
defaults_path = os.path.join(os.path.dirname(self.hwdef[0]), args.params)
|
||||||
|
|
||||||
defaults_abspath = None
|
defaults_abspath = None
|
||||||
if os.path.exists(defaults_path):
|
if os.path.exists(defaults_path):
|
||||||
@ -2934,7 +2934,7 @@ Please run: Tools/scripts/build_bootloaders.py %s
|
|||||||
if relative_to_base:
|
if relative_to_base:
|
||||||
romfs_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', dirname)
|
romfs_dir = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', dirname)
|
||||||
else:
|
else:
|
||||||
romfs_dir = os.path.join(os.path.dirname(args.hwdef[0]), dirname)
|
romfs_dir = os.path.join(os.path.dirname(self.hwdef[0]), dirname)
|
||||||
if not self.is_bootloader_fw() and os.path.exists(romfs_dir):
|
if not self.is_bootloader_fw() and os.path.exists(romfs_dir):
|
||||||
for root, d, files in os.walk(romfs_dir):
|
for root, d, files in os.walk(romfs_dir):
|
||||||
for f in files:
|
for f in files:
|
||||||
|
Loading…
Reference in New Issue
Block a user