From 0c9371ef537121fac414f43499688695816f1ee6 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 31 Aug 2015 15:00:15 +0100 Subject: fish --- Makefile | 1 + dfu.py | 13 +++++++------ gdb.script | 2 ++ 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 gdb.script diff --git a/Makefile b/Makefile index bea2a26..9c3d0b3 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,7 @@ NM := $(CROSS)nm OBJDUMP := $(CROSS)objdump OBJCOPY := $(CROSS)objcopy SIZE := $(CROSS)size +GDB := $(CROSS)gdb NRFUTIL := nrfutil CFLAGS += -mcpu=cortex-m0 diff --git a/dfu.py b/dfu.py index 69532c4..cce6321 100755 --- a/dfu.py +++ b/dfu.py @@ -2,9 +2,9 @@ import os import pexpect -import sys import optparse import time +import sys from intelhex import IntelHex # DFU Opcodes @@ -50,7 +50,7 @@ class BleDfuUploader(object): def __init__(self, target_mac, hexfile_path): self.hexfile_path = hexfile_path self.ble_conn = pexpect.spawn("gatttool -b '%s' -t random --interactive" % target_mac) - self.ble_conn.logfile = sys.stdout + self.ble_conn.logfile = sys.stdout # Connect to peer device. def scan_and_connect(self): @@ -62,17 +62,18 @@ class BleDfuUploader(object): self.ble_conn.sendline('connect') try: - #res = self.ble_conn.expect('\[CON\].*>', timeout=10) res = self.ble_conn.expect('Connection successful', timeout=10) except pexpect.TIMEOUT, e: print "timeout" + + time.sleep(1) def _dfu_state_set(self, opcode): self.ble_conn.sendline('char-write-req 0x%02x %02x' % (self.ctrlpt_handle, opcode)) # Verify that command was successfully written try: - res = self.ble_conn.expect('.* Characteristic value was written successfully', timeout=10) + res = self.ble_conn.expect('Characteristic value was written successfully', timeout=10) except pexpect.TIMEOUT, e: print "timeout" @@ -82,7 +83,7 @@ class BleDfuUploader(object): # Verify that data was successfully written try: - res = self.ble_conn.expect('.* Characteristic value was written successfully', timeout=10) + res = self.ble_conn.expect('Characteristic value was written successfully', timeout=10) except pexpect.TIMEOUT, e: print "timeout" @@ -93,7 +94,7 @@ class BleDfuUploader(object): # Verify that CCCD was successfully written try: - res = self.ble_conn.expect('.* Characteristic value was written successfully', timeout=10) + res = self.ble_conn.expect('Characteristic value was written successfully', timeout=10) except pexpect.TIMEOUT, e: print "timeout" diff --git a/gdb.script b/gdb.script new file mode 100644 index 0000000..7cf9d09 --- /dev/null +++ b/gdb.script @@ -0,0 +1,2 @@ +target remote localhost:3333 +cont -- cgit v1.2.3