Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
d3979a5
Add LPC command to read out unique ID from target.
dlaw Apr 12, 2017
880613d
lpc_common: restore RAM and registers after IAP call
alexzhang May 24, 2019
a0bba4b
use SWIM pins as USART
Aug 3, 2019
1725094
document SWIM to UART
Aug 4, 2019
ef372d0
build: Use a separate NO_LIBOPENCM3 flag to disable libopencm3
smunaut Aug 5, 2019
804ec24
build: Apply OPT_FLAGS after platform Makefile.inc include
smunaut Aug 5, 2019
544bcd9
build: Allow support for .S assembly file in SRC
smunaut Aug 5, 2019
1d4152a
target: Make sure variant_string is consistent in size
smunaut Aug 5, 2019
4289788
src: Replace sprintf with snprintf
smunaut Aug 5, 2019
c9c8b08
Merge pull request #499 from smunaut/minor_enhancements
UweBonnes Aug 13, 2019
443ced6
Target latest libopencm3
btashton Aug 14, 2019
e52e2f5
Merge pull request #500 from btashton/update_libopencm3
UweBonnes Aug 15, 2019
ebf3e9d
Changed the Gitter chat link to Discord.
esden Aug 27, 2019
6bf4fd3
pc-stlinkv2: CPU register read and write must be done with the AP set.
UweBonnes Aug 19, 2019
fa27649
Remove debug_bmp command on PC hosted platforms.
UweBonnes Aug 20, 2019
5fbb3a4
PC-STLINKV2/Libftdi: Better version string.
UweBonnes Aug 20, 2019
82be49f
Stlink: Add a README.md, mostly deprecating reflashing Stlinkv2/1.
UweBonnes Aug 20, 2019
44f471d
pc-stlinkv2: READMEM_8BIT needs to read 2 bytes for 1 byte requested.
UweBonnes Aug 20, 2019
5d59338
pc-stlinkv2: Try first to reset device if we read a strange version n…
UweBonnes Aug 21, 2019
e8bd066
Merge pull request #505 from UweBonnes/pc-stlinkv2
UweBonnes Aug 27, 2019
35cb4e5
Windows Build Fixes GNU make 4.2.1 (#502)
sidprice Aug 28, 2019
2b7d4c5
swlink: Remove redundant conditional usbart_init().
UweBonnes Aug 28, 2019
5704c2f
Merge pull request #508 from UweBonnes/swlink
UweBonnes Aug 28, 2019
052b5f8
Made script executable with python3.
KillerLink Aug 29, 2019
d994565
pc-stlinkv2: Fix crash with serial given not matching connected devices.
UweBonnes Aug 31, 2019
a011095
pc-stlinkv2: Return failure if STLINK_DEBUG_APIV2_INIT_AP fails.
UweBonnes Aug 28, 2019
aef055b
adiv5: If setup AP0 fails, fail immediate.
UweBonnes Aug 28, 2019
0d61106
pc-stlinkv2: Remove redundant read of CoreID.
UweBonnes Aug 28, 2019
d1ee827
pc-stlinkv2: STLINK_SWD_DP_ERROR seem unrecoverable. Throw exception.
UweBonnes Aug 28, 2019
d39dc34
pc-stlinkv2: Fix reg_read|write
UweBonnes Aug 28, 2019
80a9fd5
Clarify STM32F103x8 Flashsize handling.
UweBonnes Aug 29, 2019
86d0be9
pc-hosted: Display morse message on controlling terminal.
UweBonnes Aug 31, 2019
6f1cae9
pc-stlinkv2: Wait for device attach.
UweBonnes Aug 31, 2019
1d868bf
pc-stlinkv2: Detect stlink detach.
UweBonnes Aug 31, 2019
71b8a4e
Merge pull request #511 from UweBonnes/pc-stlinkv2
UweBonnes Sep 1, 2019
9f4cf41
target: Add new methods for read/write individual regs.
gsmcmullin Sep 28, 2017
19a8078
gdb: Implement 'p' and 'P' register access
gsmcmullin Sep 28, 2017
20cad17
target: Implement generic multi-register read/write
gsmcmullin Oct 1, 2017
7bcf7f4
cortexa: Implement single register read/write
gsmcmullin Oct 2, 2017
e6504e1
cortexm: Implement single register read/write
gsmcmullin Oct 2, 2017
7dcb329
Native: Link against nanolib. (#514)
UweBonnes Sep 4, 2019
0093734
Fixes to compile "make ENABLE_DEBUG=1 all_platforms" (#515)
UweBonnes Sep 4, 2019
6663da7
cortexm.c: Fix DWT Mask (#516)
UweBonnes Sep 4, 2019
609e6b1
nrf51: Add nop_function as halt_poll. (#517)
UweBonnes Sep 4, 2019
3a6947a
stlink: Check for baite variant. (#519)
UweBonnes Sep 5, 2019
fae2966
Target: Default to nop-function() for all exported target functions.
UweBonnes Sep 23, 2019
afbde05
Linker: Recent libopencm3 linker already sets the stack.
UweBonnes Sep 23, 2019
fc3abf2
stm32_mem: Fix native crashing in dfu-detach when repeatedly flashed.
UweBonnes Sep 27, 2019
f010a56
adiv5: Reject APs duplicating last AP.
UweBonnes Sep 27, 2019
1cf0b8a
Make all arguments for all commands (struct *t, int argc, const char …
UweBonnes Sep 27, 2019
0599d21
pc-stlinkv2: Recognize another error and try to handle failing memread.
UweBonnes Sep 27, 2019
12a2659
pc-stlinkv2: StlinkV3 seems only to work with STM devices,
UweBonnes Sep 27, 2019
286b987
Merge pull request #527 from UweBonnes/fixes
UweBonnes Sep 29, 2019
0ae7cea
Add LPC84 from UM11029, Rev. 1.4, tested on LPC845 Breakout board.
UweBonnes Sep 30, 2019
8a1d8bf
Stlink: Variant for Stlink V2 that works with the original ST bootloa…
UweBonnes Sep 30, 2019
90df817
Addition of pc-hosted variant and extensions to other targets to supp…
mubes Oct 1, 2019
5c805c7
Fix buffer overflow in adiv5_component_probe()
kh90909 Oct 12, 2019
4a8cba0
Add support for LPC1114/333 (LPC1100XL series)
TomCrypto Oct 12, 2019
0aedff6
Set the accepted to socket to be blocking as that is what the code ex…
DanielO Oct 13, 2019
2eef202
Use pkg-config to get CFLAGS & LDFLAGS for libftdi1
DanielO Oct 13, 2019
58febdf
Fixed tokenization of gdb monitor commands.
ruabmbua Oct 18, 2019
c6f43cf
Stlinkv2: Always call stlink_leave_state() first.
UweBonnes Oct 19, 2019
b9249fe
adiv5: Activate DP reset sequence, guarded with timeouts.
UweBonnes Oct 20, 2019
76f9a6a
stm32: Portability changes.
UweBonnes Oct 11, 2019
04d9749
Makefile: Publish DFU binaries with the daily build. (#549)
UweBonnes Oct 28, 2019
67f9d26
samd: Add support for L21 & L22 (PR #345)
dpslwk May 6, 2018
28f0ced
Support NXP LPC1343
Azq2 Nov 9, 2019
5a05ced
pc-hosted/jtagtap.c: Handle DO as bytes (PR #552)
UweBonnes Nov 10, 2019
26216be
Microchip SAM D51 / E5x support
kh90909 Oct 10, 2019
d3c330e
Fix issues with Travis CI build
kh90909 Oct 13, 2019
9198c95
Reduce flash space required for SAM D51/E5x driver
kh90909 Oct 15, 2019
e7e3460
lpc11: Only print Idcode if not zero and not yet handled.
UweBonnes Nov 17, 2019
1924aa4
Make baudrate parameter of traceswo command mandatory for stlink/swli…
Nov 19, 2019
8a07f44
Add support for the kinetis KL16Zxx devices. Tested on KL16Z128VFM4 …
amaciuszonek Nov 21, 2019
f10ccfd
f4discovery: Fix error with GCC9 being more picky with sizes.
UweBonnes Dec 5, 2019
d42477e
Fix infinite loop in jtagtap_tdi_tdo_seq
ruabmbua Nov 25, 2019
5ec12e4
Support arbitrary bit counts jtagtap_tdi_tdo_seq pc-hosted
ruabmbua Nov 26, 2019
f89542c
Merge pull request #203 from dlaw/master
UweBonnes Dec 8, 2019
e85df76
[efm32] add new devices PG12B, JG12B, GG11B, TG11B, GG12B
richardeoin Jan 17, 2019
7f0d5fe
[efm32] Print MSC Interrupt Flags to DEBUG after each flash write
richardeoin Jan 18, 2019
260fc88
[efm32] Add command to set and print bootloader enable status
richardeoin Jan 18, 2019
5943552
[efm32] Probe for the EFM32 Authentication Access Port (AAP)
richardeoin Jan 18, 2019
ea779d1
Merge pull request #567 from UweBonnes/438
UweBonnes Dec 8, 2019
25d24e5
efm32: Allow to compile with -Og.
UweBonnes Nov 27, 2019
bdd76de
Erase: Fix endless erase when erase-area did not end on (page|block) …
UweBonnes Nov 28, 2019
6d01c3c
stlinkv2: Propagate AP errors
UweBonnes Dec 8, 2019
1bef51e
adiv5: Abort scanning APs after 8 void APs.
UweBonnes Dec 3, 2019
ab396f9
Allow %z specifier in windows builds. Supercedes #562.
UweBonnes Dec 8, 2019
da5a0cd
Infrastructure for command line interface to target
UweBonnes Nov 28, 2019
0b6f393
Merge pull request #561 from UweBonnes/pc_prog
UweBonnes Dec 8, 2019
269d38c
cl_utils: Allow to issue reset.
UweBonnes Dec 9, 2019
b9eb467
Command line: Restrict verify to length of binary file.
UweBonnes Dec 9, 2019
470c8e8
target_flash_erase: Do not crash when requesting erase of unavailable…
UweBonnes Dec 10, 2019
ee31643
stlink for st-bootloader: Reset with platform_request_boot()
UweBonnes Dec 11, 2019
c3a3f77
Hosted: Allow command line interaction.
UweBonnes Dec 10, 2019
acefcd8
use SWIM pins as USART
Aug 3, 2019
462a37a
document SWIM to UART
Aug 4, 2019
ddb94c7
Merge branch 'swim_uart' of github.com:cuvoodoo/blackmagic into swim_…
Jan 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ Q := @
endif

PC_HOSTED =
NO_LIBOPENCM3 =
ifeq ($(PROBE_HOST), libftdi)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif
ifeq ($(PROBE_HOST), pc-stlinkv2)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif
ifeq ($(PROBE_HOST), pc-hosted)
PC_HOSTED = true
NO_LIBOPENCM3 = true
endif

all:
ifndef PC_HOSTED
ifndef NO_LIBOPENCM3
$(Q)if [ ! -f libopencm3/Makefile ]; then \
echo "Initialising git submodules..." ;\
git submodule init ;\
Expand All @@ -23,7 +30,7 @@ endif
$(Q)$(MAKE) $(MFLAGS) -C src

clean:
ifndef PC_HOSTED
ifndef NO_LIBOPENCM3
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 $@
endif
$(Q)$(MAKE) $(MFLAGS) -C src $@
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Black Magic Probe
=================

[![Build Status](https://travis-ci.org/blacksphere/blackmagic.svg?branch=master)](https://travis-ci.org/blacksphere/blackmagic)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/blacksphere/blackmagic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Discord](https://img.shields.io/discord/613131135903596547?logo=discord)](https://discord.gg/P7FYThy)
[![Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=N84QYNAM2JJQG)
[![Kickstarter](https://img.shields.io/badge/kickstarter-back%20us-14e16e.svg)](https://www.kickstarter.com/projects/esden/1bitsy-and-black-magic-probe-demystifying-arm-prog)

Expand Down
2 changes: 1 addition & 1 deletion libopencm3
Submodule libopencm3 updated 871 files
46 changes: 23 additions & 23 deletions scripts/dfu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# dfu.py: Access USB DFU class devices
# Copyright (C) 2009 Black Sphere Technologies
# Copyright (C) 2009 Black Sphere Technologies
# Written by Gareth McMullin <gareth@blacksphere.co.nz>
#
# This program is free software: you can redistribute it and/or modify
Expand All @@ -17,12 +17,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


import usb

DFU_DETACH_TIMEOUT = 1000

# DFU Requests
# DFU Requests
DFU_DETACH = 0x00
DFU_DNLOAD = 0x01
DFU_UPLOAD = 0x02
Expand Down Expand Up @@ -87,40 +87,40 @@ def __init__(self, dev, conf, iface):
def release(self):
self.handle.releaseInterface()
def detach(self, wTimeout=255):
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_DETACH,
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_DETACH,
None, value=wTimeout, index=self.index)

def download(self, wBlockNum, data):
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_DNLOAD,
data, value=wBlockNum, index=self.index)
data, value=wBlockNum, index=self.index)

def upload(self, wBlockNum, length):
return self.handle.controlMsg(usb.ENDPOINT_IN |
return self.handle.controlMsg(usb.ENDPOINT_IN |
usb.TYPE_CLASS | usb.RECIP_INTERFACE, DFU_UPLOAD,
length, value=wBlockNum, index=self.index)
length, value=wBlockNum, index=self.index)

def get_status(self):
buf = self.handle.controlMsg(usb.ENDPOINT_IN |
buf = self.handle.controlMsg(usb.ENDPOINT_IN |
usb.TYPE_CLASS | usb.RECIP_INTERFACE, DFU_GETSTATUS,
6, index=self.index)
6, index=self.index)
return dfu_status(buf)

def clear_status(self):
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_CLRSTATUS,
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_CLRSTATUS,
"", index=0)

def get_state(self):
buf = self.handle.controlMsg(usb.ENDPOINT_IN |
buf = self.handle.controlMsg(usb.ENDPOINT_IN |
usb.TYPE_CLASS | usb.RECIP_INTERFACE, DFU_GETSTATE,
1, index=self.index)
1, index=self.index)
return buf[0]

def abort(self):
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_ABORT,
self.handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS |
usb.RECIP_INTERFACE, DFU_ABORT,
None, index=self.index)


Expand All @@ -138,7 +138,7 @@ def make_idle(self):
if status.bState == STATE_DFU_IDLE:
return True

if ((status.bState == STATE_DFU_DOWNLOAD_SYNC) or
if ((status.bState == STATE_DFU_DOWNLOAD_SYNC) or
(status.bState == STATE_DFU_DOWNLOAD_IDLE) or
(status.bState == STATE_DFU_MANIFEST_SYNC) or
(status.bState == STATE_DFU_UPLOAD_IDLE) or
Expand All @@ -157,7 +157,7 @@ def make_idle(self):

if ((status.bState == STATE_APP_DETACH) or
(status.bState == STATE_DFU_MANIFEST_WAIT_RESET)):
usb.reset(self.handle)
usb.reset(self.handle)
return False

raise Exception
Expand All @@ -178,16 +178,16 @@ def finddevs():
if __name__ == "__main__":
devs = finddevs()
if not devs:
print "No devices found!"
print("No devices found!")
exit(-1)

for dfu in devs:
handle = dfu[0].open()
man = handle.getString(dfu[0].iManufacturer, 30)
product = handle.getString(dfu[0].iProduct, 30)
print "Device %s: ID %04x:%04x %s - %s" % (dfu[0].filename,
dfu[0].idVendor, dfu[0].idProduct, man, product)
print "%r, %r" % (dfu[1], dfu[2])
print("Device %s: ID %04x:%04x %s - %s" % (dfu[0].filename,
dfu[0].idVendor, dfu[0].idProduct, man, product))
print("%r, %r" % (dfu[1], dfu[2]))



69 changes: 36 additions & 33 deletions scripts/stm32_mem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# stm32_mem.py: STM32 memory access using USB DFU class
# Copyright (C) 2011 Black Sphere Technologies
# Copyright (C) 2011 Black Sphere Technologies
# Copyright (C) 2017 Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
# Written by Gareth McMullin <gareth@blacksphere.co.nz>
#
Expand Down Expand Up @@ -88,7 +88,7 @@ def stm32_scan(args, test):
if test == True:
return

print "No DFU devices found!"
print("No DFU devices found!")
exit(-1)

for dev in devs:
Expand All @@ -101,33 +101,33 @@ def stm32_scan(args, test):
continue

man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30)
if man == "Black Sphere Technologies":
if man == b"Black Sphere Technologies":
bmp = bmp + 1
bmp_devs.append(dev)

if bmp == 0:
if test == True:
return

print "No compatible device found\n"
print("No compatible device found\n")
exit(-1)

if bmp > 1 and not args.serial_target:
if test == True:
return

print "Found multiple devices:\n"
print("Found multiple devices:\n")
for dev in bmp_devs:
dfudev = dfu.dfu_device(*dev)
man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30)
product = dfudev.handle.getString(dfudev.dev.iProduct, 96)
serial_no = dfudev.handle.getString(dfudev.dev.iSerialNumber, 30)
print "Device ID:\t %04x:%04x" % (dfudev.dev.idVendor, dfudev.dev.idProduct)
print "Manufacturer:\t %s" % man
print "Product:\t %s" % product
print "Serial:\t\t %s\n" % serial_no
print("Device ID:\t %04x:%04x" % (dfudev.dev.idVendor, dfudev.dev.idProduct))
print("Manufacturer:\t %s" % man)
print("Product:\t %s" % product)
print("Serial:\t\t %s\n" % serial_no)

print "Select device with serial number!"
print("Select device with serial number!")
exit (-1)

for dev in bmp_devs:
Expand All @@ -142,23 +142,23 @@ def stm32_scan(args, test):
if man == "Black Sphere Technologies":
break

print "Device ID:\t %04x:%04x" % (dfudev.dev.idVendor, dfudev.dev.idProduct)
print "Manufacturer:\t %s" % man
print "Product:\t %s" % product
print "Serial:\t\t %s" % serial_no
print("Device ID:\t %04x:%04x" % (dfudev.dev.idVendor, dfudev.dev.idProduct))
print("Manufacturer:\t %s" % man)
print("Product:\t %s" % product)
print("Serial:\t\t %s" % serial_no)

if args.serial_target and serial_no != args.serial_target:
print "Serial number doesn't match!\n"
print("Serial number doesn't match!\n")
exit(-2)

return dfudev

if __name__ == "__main__":
print
print "USB Device Firmware Upgrade - Host Utility -- version 1.2"
print "Copyright (C) 2011 Black Sphere Technologies"
print "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>"
print
print("-")
print("USB Device Firmware Upgrade - Host Utility -- version 1.2")
print("Copyright (C) 2011 Black Sphere Technologies")
print("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>")
print("-")

parser = argparse.ArgumentParser()
parser.add_argument("progfile", help="Binary file to program")
Expand All @@ -171,24 +171,27 @@ def stm32_scan(args, test):
state = dfudev.get_state()
except:
if args.manifest : exit(0)
print "Failed to read device state! Assuming APP_IDLE"
print("Failed to read device state! Assuming APP_IDLE")
state = dfu.STATE_APP_IDLE
if state == dfu.STATE_APP_IDLE:
dfudev.detach()
try:
dfudev.detach()
except:
pass
dfudev.release()
print "Invoking DFU Device"
print("Invoking DFU Device")
timeout = 0
while True :
sleep(0.5)
timeout = timeout + 0.5
dfudev = stm32_scan(args, True)
if dfudev: break
if timeout > 5 :
print "Error: DFU device did not appear"
print("Error: DFU device did not appear")
exit(-1)
if args.manifest :
stm32_manifest(dfudev)
print "Invoking Application Device"
print("Invoking Application Device")
exit(0)
dfudev.make_idle()
file = open(args.progfile, "rb")
Expand All @@ -198,7 +201,7 @@ def stm32_scan(args, test):
if args.address :
start = int(args.address, 0)
else :
if "F4" in product:
if b"F4" in product:
start = 0x8004000
else:
start = 0x8002000
Expand All @@ -213,12 +216,12 @@ def stm32_scan(args, test):
# get evaluated and erase called only once per sector!
stm32_erase(dfudev, addr)
except:
print "\nErase Timed out\n"
print("\nErase Timed out\n")
break
try:
stm32_set_address(dfudev, addr)
except:
print "\nSet Address Timed out\n"
print("\nSet Address Timed out\n")
break
stm32_write(dfudev, bin[:1024])
bin = bin[1024:]
Expand All @@ -227,16 +230,16 @@ def stm32_scan(args, test):
bin = file.read()
len = len(bin)
addr = start
print
while bin:
print("-")
while bin:
try:
stm32_set_address(dfudev, addr)
data = stm32_read(dfudev)
except:
# Abort silent if bootloader does not support upload
break
print ("Verifying memory at 0x%08X\r" % addr),
stdout.flush()
stdout.flush()
if len > 1024 :
size = 1024
else :
Expand All @@ -248,7 +251,7 @@ def stm32_scan(args, test):
addr += 1024
len -= 1024
if len <= 0 :
print "\nVerified!"
print("\nVerified!")
stm32_manifest(dfudev)

print "All operations complete!\n"
print("All operations complete!\n")
Loading