Beispiel #1
0
except Exception as e:
	print("ERROR: %s" % str(e))
	sys.exit(1)

# Get serial number
print("\nReading %i KBytes to %s..." % (dbg.chipInfo['flash'], opts['out']))
hexFile = CCHEXFile(opts['out'])

# Read in chunks of 4Kb (for UI-update purposes)
for i in range(0, int(dbg.chipInfo['flash'] / 4)):

	# Read CODE
	chunk = dbg.readCODE( i * 0x1000, 0x1000 )

	# Write chunk to file
	hexFile.stack(chunk)

	# Log status
	print("\r    Progress %.0f%%..." % ( ( (i+1)*4 * 100) / dbg.chipInfo['flash'] ), end=' ')
	sys.stdout.flush()

# Log completion
print("\r    Progress 100%... OK")

# Save file
hexFile.save()

# Done
print("\n\nCompleted")
print("")
Beispiel #2
0
#enter debug mode
dbg.enter()

try:
	maxPages = dbg.chipInfo['flash']
	for p in range(maxPages):
		pageAddress = p*dbg.flashPageSize
		
		print "\r> %3d%%: reading page %d of %d..." % ((((100.0*p)/(maxPages-1))), p, maxPages-1),
		sys.stdout.flush()
		
		readPage = dbg.readFlashPage(pageAddress)
		#for x in readPage:
		#	print "%02X" % (x),
		#
		hexFile.stack(readPage)
		
	print "> completed. will (re)start target now"
	print ""

	dbg.setPC(0x0000)
	dbg.resume()
	
except Exception as e:
 	print "ERROR: %s" % str(e)
 	sys.exit(3)



# Save file
hexFile.save()
Beispiel #3
0
except Exception as e:
    print "ERROR: %s" % str(e)
    sys.exit(1)

# Get serial number
print "\nReading %i KBytes to %s..." % (dbg.chipInfo['flash'], opts['out'])
hexFile = CCHEXFile(opts['out'])

# Read in chunks of 4Kb (for UI-update purposes)
for i in range(0, int(dbg.chipInfo['flash'] / 4)):

    # Read CODE
    chunk = dbg.readCODE(i * 0x1000, 0x1000)

    # Write chunk to file
    hexFile.stack(chunk)

    # Log status
    print "\r    Progress %.0f%%..." % ((
        (i + 1) * 4 * 100) / dbg.chipInfo['flash']),
    sys.stdout.flush()

# Log completion
print "\r    Progress 100%... OK"

# Save file
hexFile.save()

# Done
print "\n\nCompleted"
print ""
#enter debug mode
dbg.enter()

try:
	maxPages = dbg.chipInfo['flash']
	for p in range(maxPages):
		pageAddress = p*dbg.flashPageSize
		
		print "\r> %3d%%: reading page %d of %d..." % ((((100.0*p)/(maxPages-1))), p, maxPages-1),
		sys.stdout.flush()
		
		readPage = dbg.readFlashPage(pageAddress)
		for x in readPage:
			print "%02X" % (x), 
		#
		hexFile.stack(readPage)
		
	print "> completed. will (re)start target now"
	print ""

	dbg.setPC(0x0000)
	dbg.resume()
	
except Exception as e:
 	print "ERROR: %s" % str(e)
 	sys.exit(3)



# Save file
hexFile.save()