X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tools%2Ftinyos%2Fmisc%2Ftos-deluge;h=1277ba5df2be3172653c6264c5577421cb2dee4a;hb=39b08cee9389feb748dcf353b459eec1565a573a;hp=d9c8746377b88c39822dd952dc8bf54f2edc834a;hpb=36c94b92b38da01646185b96cad66d050980c27e;p=tinyos-2.x.git diff --git a/tools/tinyos/misc/tos-deluge b/tools/tinyos/misc/tos-deluge index d9c87463..1277ba5d 100755 --- a/tools/tinyos/misc/tos-deluge +++ b/tools/tinyos/misc/tos-deluge @@ -185,9 +185,20 @@ def read(imgNum, offset, length): return r def erase(imgNum): - sreqpkt = FMReqPacket((FM_CMD_ERASE, imgNum, 0, 0, [])) + # Note: the normal erase doesn't work properly on AT45DB. A + # workaroud is to overwrite the metadata of the Deluge image. + # + #sreqpkt = FMReqPacket((FM_CMD_ERASE, imgNum, 0, 0, [])) + #success = am.write(sreqpkt, FM_AMID) + #return handleResponse(success, "ERROR: Unable to erase the flash volume") + + sreqpkt = FMReqPacket((FM_CMD_WRITE, imgNum, 0, 0, [])) + sreqpkt.data = [0xFF] * DELUGE_IDENT_SIZE + sreqpkt.length = DELUGE_IDENT_SIZE success = am.write(sreqpkt, FM_AMID) - return handleResponse(success, "ERROR: Unable to erase the flash volume") + result = handleResponse(success, "ERROR: Unable to erase the flash volume") + if not result: return False; + return sync(imgNum) def sync(imgNum): sreqpkt = FMReqPacket((FM_CMD_SYNC, imgNum, 0, 0, []))