示例#1
0
文件: cc_info.py 项目: zsyg/CCLib
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
from cclib import hexdump, renderDebugStatus, renderDebugConfig, getOptions, openCCDebugger
import sys

# Get serial port either form environment or from arguments
opts = getOptions("Generic CCDebugger Information Tool")

# Open debugger
try:
    dbg = openCCDebugger(opts['port'], enterDebug=opts['enter'])
except Exception as e:
    print("ERROR: %s" % str(e))
    sys.exit(1)

# Get device information from the read-only section
print("\nDevice information:")
print(" IEEE Address : %s" % dbg.getSerial())
print("           PC : %04x" % dbg.getPC())

print("\nDebug status:")
renderDebugStatus(dbg.debugStatus)
print("\nDebug config:")
renderDebugConfig(dbg.debugConfig)

# Done
示例#2
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
from cclib import CCHEXFile, getOptions, openCCDebugger
from cclib.extensions.bluegiga import BlueGigaCCDebugger
import sys

# Get serial port either form environment or from arguments
opts = getOptions("BlueGiga-Specific CCDebugger Flash Reader Tool", hexOut=True)

# Open debugger
try:
	dbg = openCCDebugger(opts['port'], enterDebug=opts['enter'], driver=BlueGigaCCDebugger)
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
示例#3
0
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from cclib import hexdump, renderDebugStatus, renderDebugConfig, getOptions, openCCDebugger
from cclib.extensions.bluegiga import BlueGigaCCDebugger
import sys
import os

# Get serial port either form environment or from arguments
opts = getOptions("BlueGiga-Specific CCDebugger Information Tool")

# Open debugger
try:
    dbg = openCCDebugger(opts['port'],
                         enterDebug=opts['enter'],
                         driver=BlueGigaCCDebugger)
except Exception as e:
    print "ERROR: %s" % str(e)
    sys.exit(1)

# Get device information from the read-only section
print "\nDevice information:"
print " IEEE Address : %s" % dbg.getSerial()
print "           PC : %04x" % dbg.getPC()

# Get bluegiga-specific info
binfo = dbg.getBLEInfo()
print "\nFirmware information:"
print "      License : %s" % binfo['license']
print "   BT Address : %s" % binfo['btaddr']
示例#4
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import print_function
from cclib import CCHEXFile, getOptions, openCCDebugger
import sys

# Get serial port either form environment or from arguments
opts = getOptions("Generic CCDebugger Flash Reader Tool", hexOut=True)

# Open debugger
try:
	dbg = openCCDebugger(opts['port'], enterDebug=opts['enter'])
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