diff --git a/tools/gen-device-svd.py b/tools/gen-device-svd.py index 879417eb..d9326b2b 100755 --- a/tools/gen-device-svd.py +++ b/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)