def LoadFile(fname, addr, len, size=4, memtype=1) : addr = int(addr, 16) len = int(len, 16) DAtiny.LoadBinaryFile(fname, addr, len, size, memtype) return
def MemWrite(dest, data) : data = int(data,16) addr = getAddress(dest) DAtiny.WriteMemory(addr, data, 4, 1) return
def readLongSafe(addr) : done = 0 count = 0 while done == 0 and count < 3 : try: res = DAtiny.ReadMemory(addr, 4, 1) prog = re.compile(r"^[0-9\-]+$") if prog.match(str(res)): done = 1 else : count = count + 1 msg = "ERROR : Read error at " + hexaddr + " " + res print msg except DA.Error, e: err_msg = "ERROR : Failed to read 0x%x address from memory" %(addr) print err_msg count = count + 1
def stopTarget() : DAtiny.Disconnect() return
def ResetTarget(halt=0) : DAtiny.Reset(halt) return
def UseTarget(Identifier) : DAtiny.UseTarget(Identifier) return
def SAB(fname, dest, len, esize=4, memtype=1): addr = getAddress(dest) DAtiny.SaveBinaryFile(fname, addr, len, esize, memtype) return
def MemRead(dest) : addr = getAddress(dest) data = DAtiny.ReadMemory(addr, 4, 1) return data
def WriteMemoryBlock(addr, dataCount, ElememtType, data, MemoryType=1) : DAtiny.WriteMemoryBlock(addr, dataCount, ElememtType, data, MemoryType) return