chibios_hwdef.py: populate intdefines as part of parsing, not output

This commit is contained in:
Peter Barker 2023-05-25 11:28:19 +10:00 committed by Peter Barker
parent b1f1ea7859
commit c557e67aff
1 changed files with 9 additions and 8 deletions

View File

@ -1029,14 +1029,9 @@ class ChibiOSHWDef(object):
if 'HAL_USE_CAN' in d: if 'HAL_USE_CAN' in d:
using_chibios_can = True using_chibios_can = True
f.write('#define %s\n' % d[7:]) f.write('#define %s\n' % d[7:])
# extract numerical defines for processing by other parts of the script
result = re.match(r'define\s*([A-Z_]+)\s*([0-9]+)', d) if self.intdefines.get('AP_NETWORKING_ENABLED', 0) == 1:
if result: self.enable_networking(f)
define = result.group(1)
value = int(result.group(2))
self.intdefines[define] = value
if define == 'AP_NETWORKING_ENABLED' and value == 1:
self.enable_networking(f)
if self.intdefines.get('HAL_USE_USB_MSD', 0) == 1: if self.intdefines.get('HAL_USE_USB_MSD', 0) == 1:
self.build_flags.append('USE_USB_MSD=yes') self.build_flags.append('USE_USB_MSD=yes')
@ -3045,6 +3040,12 @@ Please run: Tools/scripts/build_bootloaders.py %s
if name == 'APP_RAM_START': if name == 'APP_RAM_START':
value = int(value, 0) value = int(value, 0)
self.env_vars[name] = value self.env_vars[name] = value
elif a[0] == 'define':
# extract numerical defines for processing by other parts of the script
result = re.match(r'define\s*([A-Z_]+)\s*([0-9]+)', line)
if result:
self.intdefines[result.group(1)] = int(result.group(2))
def progress(self, message): def progress(self, message):
if self.quiet: if self.quiet: