use pydfu script and pynrfjprog to burn bootloader

This commit is contained in:
hathach committed 2016-11-25 15:44:02 +07:00
1 parent 45b6cf6f39
commit c0dbcf86fd
3 files changed
+46 -1

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import sys
import platform
import os
import os.path
from pynrfjprog import API, Hex
# Command Line option
if (len(sys.argv) < 2):
print "Burn bootloader with Softdevice hex using JLink"
print ("Usage: python %s <hexfile>")%(sys.argv[0])
sys.exit()
hexfile = sys.argv[1]
api = API.API('NRF52')
api.open()
api.connect_to_emu_without_snr()
print 'Erasing Feather'
api.erase_all()
print 'Writing bootloader'
# Convert hex to array
hexdata = Hex.Hex(hexfile)
# Write data to MCU
for seg in hexdata:
api.write(seg.address, seg.data, True)
# Reset device and run
api.sys_reset()
api.go()
api.close()
print 'Done'
+7
View File
@@ -0,0 +1,7 @@
from pynrfjprog import API
api = API.API(‘NRF52’)
api.open()
api.connect_to_emu_without_snr()
api.erase_all()
api.close()