Add proper support to nrfjprog interface

pull/164/head
Emilio Monti 2014-02-11 15:54:52 +00:00
parent 17499c34d2
commit 0b9d9ff701
1 changed files with 10 additions and 2 deletions

View File

@ -167,20 +167,28 @@ if __name__ == '__main__':
if options.disk:
# Simple copy to the mbed disk
copy(bin, options.disk)
if options.nrfjprog:
#Convert bin to Hex and Program nrf chip via jlink
call(["nrfjprog","-e","--program",bin.replace(".bin", ".hex"),"--verify","-p"])
call(["nrfjprog","-e","--program",bin.replace(".bin", ".hex"),"--verify"])
if options.serial:
# Import pyserial: https://pypi.python.org/pypi/pyserial
from serial import Serial
sleep(target.program_cycle_s())
serial = Serial(options.serial, timeout = 1)
if options.baud:
serial.setBaudrate(options.baud)
serial.flushInput()
serial.flushOutput()
serial.sendBreak()
if options.nrfjprog:
call(["nrfjprog", "-r"])
else:
serial.sendBreak()
while True:
c = serial.read(512)