Hello,
appended 3 patches
- adds a dfu-bootloader appliaction
- uses absolute delays when waiting for pull-up delays on the STLINK
(hopefully fixes issue #30)
Updating the dfu-bootloader by additional application is helpfull for the
STLINK, as for flashing the bootloader by SWDb otherwise jumpers need to be
soldered or external SWD is not possible.
Use like:
- dfu-util -s 0x08002000:leave -D dfu_upgrade.bin
- dfu-util -s 0x08000000:leave -D blackmagic_dfu.bin
- Push reset buttom and reconnect to enter new dfu bootloader
- dfu-util -s 0x08002000:leave -D blackmagic.bin
--
Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From fae5022c304a8866f056ea66660ac7ce3809dcf8 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Date: Sun, 20 Oct 2013 15:00:36 +0200
Subject: F1: Prepare to update dfu bootloader via DFU with additional
application.
This used to be done transparently in the write step, however that
breaks the 'verify' command. This is also more flexible for cases
where you want to write a flash bank without ever intending it to
be bootable.
o Prevent probe from inadvertently powering target. If PWR_BR is
allowed to float, the gate on Q1 (blackmagic_mini) will tend to be
close enough to zero to turn the transistor on. We activate the
internal pull-up on this IO pin to force the transistor off.
A sleeping target continues to communicate over SWD properly but
consistently returns SWDP_ACK_WAIT.
It might be nice to be able to wait for the target to wake up on its
own but if it's not going to wake up, BMP becomes absolutely
unresponsive. Probably the timeout should be made configurable or some
other workaround invented.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
This implements special handling for SYS_OPEN to catch requests for
":tt" which is reserved by ARM for console input/output. They're
mapped to the appropriate GDB file descriptors automatically.
An additional file handle offset is introduced because ARM doesn't
consider zero handle to be valid.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Implement bare minimum necessary to support console IO.
This works with standard newlib builds and is based on the reference
documentation:
http://infocenter.arm.com/help/topic/com.arm.doc.dui0471c/CHDJHHDI.html
Tested using gcc-arm-none-eabi-4_7-2013q1-20130313 for both
stm32f1-based BMP and stm32f0 target.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
This patch introduces a new command, "connect_srst [enable|disable]"
which allows to enable special mode in which SRST would be pulled low
before the SWD scan till attaching to a target.
Since on Cortex-Mx the SRST signal doesn't gate JTAG and SWD, it's
possible to connect to a target while holding reset, ask it to stop at
reset vector and only then deassert reset, thus allowing to attach to
the kind of firmware that goes immediately to sleep or disables
debugging by other means early on start.
Tested on an STM32VLDiscovery board with STM32F100 configured to go to
STOP mode and executing WFI in the very beginning of main().
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
USB UART seems to work fine at 115.2Kbps or 230.4Kbps, but starts to drop characters
as the data rate goes higher. This commit changes the usbuart ISR to fill a software
FIFO, and adds a low priority timer interrupt to run deferred processing to drain a
FIFO and send USB CDCACM packets, rather than calling the usb send within the UART
ISR.
Tested on native platform, up to 1.5MBps.
With gcc-arm-none-eabi-4_7-2013q1-20130313 and -O2 I get
text data bss dec hex filename
45744 304 2376 48424 bd28 blackmagic
With -Os the results are even more impressive:
text data bss dec hex filename
37900 304 2376 40580 9e84 blackmagic
Since -Os might lower the debugging speed, do not enable it yet in the
absence of real measurements.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
The introduction of the double buffering broke USB flow control, causing
loss of data when a new packet arrived with the previous still present in
the double buffer.
With this patch the endpoint is kept in NAK until the double buffer is empty.