Browse Source

tools/gen-device-svd: show better error messages

Show an error message when input .svd files cannot be found.
pull/15/merge
Ayke van Laethem 6 years ago
parent
commit
a577bc2a1b
No known key found for this signature in database GPG Key ID: E97FF5335DFDFDED
  1. 9
      tools/gen-device-svd.py

9
tools/gen-device-svd.py

@ -372,9 +372,16 @@ Default_Handler:
out.write(' IRQ {name}_IRQHandler\n'.format(**intr))
def generate(indir, outdir, sourceURL):
if not os.path.isdir(indir):
print('cannot find input directory:', indir, file=sys.stderr)
sys.exit(1)
if not os.path.isdir(outdir):
os.mkdir(outdir)
for filepath in sorted(glob(indir + '/*.svd')):
infiles = glob(indir + '/*.svd')
if not infiles:
print('no .svd files found:', indir, file=sys.stderr)
sys.exit(1)
for filepath in sorted(infiles):
print(filepath)
device = readSVD(filepath, sourceURL)
writeGo(outdir, device)

Loading…
Cancel
Save