mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
tools/gen-device-svd: show better error messages
Show an error message when input .svd files cannot be found.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user