X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tools%2Ftinyos%2Fmisc%2Ftos-build-deluge-image;h=1219fa464c3d9b58341cd9a8519f36efac787479;hb=b8776cf30e246935d0b671264967c7b6985933f7;hp=c6af4484f55b2973a4b50ea67e35ad1b3daf4ddd;hpb=fe0762cdcb436f31158aebfa8705dee45af4fab2;p=tinyos-2.x.git diff --git a/tools/tinyos/misc/tos-build-deluge-image b/tools/tinyos/misc/tos-build-deluge-image index c6af4484..1219fa46 100755 --- a/tools/tinyos/misc/tos-build-deluge-image +++ b/tools/tinyos/misc/tos-build-deluge-image @@ -132,7 +132,17 @@ for (k, v) in ident_list: ident[k] = v for p in ['unix_time', 'user_hash', 'uid_hash']: ident[p] = int(ident[p][:-1], 16) -image = dom.getElementsByTagName('image')[0].firstChild.nodeValue + +error = "ERROR: getting the image from the XML file failed." +try: + image_element = dom.getElementsByTagName('image')[0] + if image_element.getAttribute('format') != 'ihex': + error = "ERROR: image format is %s instead of ihex" % image_element.getAttribute('format') + sys.exit() + image = image_element.firstChild.nodeValue +except: + sys.stderr.write(error + '\n') + sys.exit() all = [] section = []