Tools: added --periph-only option to build_bootloaders.py
This commit is contained in:
parent
ea51aea2e5
commit
84ff71d519
@ -9,12 +9,14 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import fnmatch
|
||||
import re
|
||||
|
||||
# get command line arguments
|
||||
from argparse import ArgumentParser
|
||||
parser = ArgumentParser(description='make_secure_bl')
|
||||
parser.add_argument("--signing-key", type=str, default=None, help="signing key for secure bootloader")
|
||||
parser.add_argument("--debug", action='store_true', default=False, help="build with debug symbols")
|
||||
parser.add_argument("--periph-only", action='store_true', default=False, help="only build AP_Periph boards")
|
||||
parser.add_argument("pattern", type=str, default='*', help="board wildcard pattern")
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -27,6 +29,27 @@ os.environ['PYTHONUNBUFFERED'] = '1'
|
||||
|
||||
failed_boards = set()
|
||||
|
||||
def read_hwdef(filepath):
|
||||
'''read a hwdef file recursively'''
|
||||
fh = open(filepath)
|
||||
ret = []
|
||||
text = fh.readlines()
|
||||
for line in text:
|
||||
m = re.match(r"^\s*include\s+(.+)\s*$", line)
|
||||
if m is not None:
|
||||
ret += read_hwdef(os.path.join(os.path.dirname(filepath), m.group(1)))
|
||||
else:
|
||||
ret += [line]
|
||||
return ret
|
||||
|
||||
def is_ap_periph(hwdef):
|
||||
'''return True if a hwdef is for a AP_Periph board'''
|
||||
lines = read_hwdef(hwdef)
|
||||
for line in lines:
|
||||
if line.find('AP_PERIPH') != -1:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_board_list():
|
||||
'''add boards based on existance of hwdef-bl.dat in subdirectories for ChibiOS'''
|
||||
board_list = []
|
||||
@ -34,6 +57,8 @@ def get_board_list():
|
||||
for d in dirlist:
|
||||
hwdef = os.path.join(dirname, d, 'hwdef-bl.dat')
|
||||
if os.path.exists(hwdef):
|
||||
if args.periph_only and not is_ap_periph(hwdef):
|
||||
continue
|
||||
board_list.append(d)
|
||||
return board_list
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user