Commit Graph

269 Commits

Author SHA1 Message Date
Uwe Bonnes d8b01ff61f swlink: Enable UART2 for SWO.
Stlink on STM8S-Disco needs additional wiring for SWO.
2018-10-03 15:19:33 -07:00
Uwe Bonnes 7cafc44bd9 swlink: Allow to enable debug on second VCOM. 2018-10-03 15:19:33 -07:00
Uwe Bonnes 0d246fb31a swlink: Measure voltage on VDD pin of Stlink/Stm8s. 2018-10-03 15:19:33 -07:00
Uwe Bonnes 184ef991bf swlink: Handle LED. 2018-10-03 15:19:33 -07:00
Uwe Bonnes 06272e0a59 swlink: Implement dfu_upgrade. 2018-10-03 15:19:33 -07:00
Uwe Bonnes 530d1e5c28 swlink: Handle force boot on bluepill. 2018-10-03 15:19:33 -07:00
Uwe Bonnes b744d8b0c9 swlink: Implement NRST. 2018-10-03 15:19:33 -07:00
Uwe Bonnes 1263d185a6 swlink: Distinguish between Stlink on STM8-Disco and "blue pill". 2018-10-03 15:19:33 -07:00
Rik van der Heijden 95053b3b4e Change the ST-Link SRST function to use libopencm3 helper functions and fix waiting for the pin-state, change init to use the SRST function for reset de-assertion 2018-09-05 20:28:02 +02:00
Uwe Bonnes 7a7266a0f7 Speed up JTAG. 2018-06-26 19:50:14 +02:00
Uwe Bonnes 59e03dea27 Keep TMS floating until scanning.
NRF5x shares nRST with SWDIO and otherwise does not run until scan is done.
2018-06-26 19:50:14 +02:00
Uwe Bonnes 97561fc5cc stlink: Decrease delay with SWD turn around for native,stlink and swlink. 2018-06-26 19:50:14 +02:00
Uwe Bonnes 5548d54626 common/swdptap: some clean up.
Remove superfluous transaction.
Use native variable size.
2018-06-26 19:50:14 +02:00
Uwe Bonnes 7e3fe352ad adiv5_swdp.c: Use swdptap_seq_out for initialiation sequence. 2018-06-26 19:50:14 +02:00
Uwe Bonnes e54a826745 common/swdptap.c: Speed up by "unrolling" swd.._seq_...() for GPIO.
Try to have sensible setup/hold times by evenntually duplicated or
logically useless port commands.
Loading code to RAM on a STM32L476 got up from 46 to 83 kB/sec.
2018-06-26 19:50:14 +02:00
Uwe Bonnes 633af5bb85 libftdi/jtagtap.c: Fix error introduced with commit de33473
Seen when scanning e.g. Zync with mon jtag 6 4.
2018-06-26 17:43:06 +02:00
Uwe Bonnes 2657aa6fbb libftdi: Allow more flexible Swd Read/Write Switching. 2018-05-30 19:21:03 +02:00
Uwe Bonnes df05d7ce7b libftdi: Allow device specific port/pin to read SWD bitbanged.
Gracefully abort swd scan if devices can not do SWD.
Best effort to indicated SWD capability on existing cables and
add descriptions for the cables.
2018-05-30 19:21:03 +02:00
Uwe Bonnes fce25b9fd5 libftdi/swdptap.c: Substantial speed increase for bitbanging SWD.
Provide the swd sequences unrolled.
2018-05-30 19:21:03 +02:00
Uwe Bonnes 992ccf91a9 libftdi/swdptap.c: Use MPSSE Mode for bitbanging SWD. 2018-05-30 19:21:03 +02:00
Uwe Bonnes 2ec078cfcf libftdi/jtagtap.c: Allow NULL as one DI/DO argument jtagtap_tdi_tdo_seq.
Implement jtagtap_tdi_seq() by calling jtagtap_tdi_tdo_seq().
2018-05-30 19:21:03 +02:00
Uwe Bonnes de33473535 libftdi/jtagtap: Copy DI direct into the write buffer. 2018-05-30 19:21:03 +02:00
Uwe Bonnes aa938c6dae libftdi/jtagtap: Try harder to initialize Ftdi MPSSE jtag mode.
After "mon s" at least the second "mon j" now succeeds again.
2018-05-30 19:21:03 +02:00
Uwe Bonnes c548e307fe libftdi/jtagtap: Clean up code. 2018-05-30 19:21:03 +02:00
Uwe Bonnes 7d45bd4869 ibftdi/jtagtap: Remove magic numbers. 2018-05-30 19:21:03 +02:00
Uwe Bonnes 6f0a46d9c1 libftdi: Export active cable description. 2018-05-30 19:21:03 +02:00
Uwe Bonnes 68c7180376 libftdi: Add ftdiswd variant. 2018-05-30 19:21:03 +02:00
Uwe Bonnes f4bc6f9ddd libftdi/platform.c: Issue SEND_IMMEDIATE before reading. 2018-05-30 19:21:03 +02:00
Uwe Bonnes 744deb678d libftdi/platform.c: Only set bit direction with MPSSE SET_BIT_XXXX. 2018-05-30 19:21:03 +02:00
Uwe Bonnes 6127a6431e stlink: Check nRST line level when setting SRST.
Problem: On some boards flashing hanged.
Cause: Releasing SRST caused a slow rise of nRST and flashing
started while the target still was in reset.
Attention: platform_delay(ms) only resolved 0.1 s.
Nucleo-P boards have SRST unconnected to target nRST by default.
2018-04-23 10:48:05 +12:00
Uwe Bonnes 72c1498ae1 stlink: Make SWO Trace Buffer smaller.
Changes for delayed memory map setup otherwise overflow SRAM silently.
2018-04-23 10:48:05 +12:00
Uwe Bonnes fc25a3339a traceswoasync: Implement async swo for stm32.
Use for stlink.
Uses dma with large buffer.
Pull up swo to provide idle level on unconnected swo pin.
2018-03-27 13:40:49 +02:00
Uwe Bonnes 93bc3a155a traceswo: Provide command option for async swo. 2018-03-27 13:40:49 +02:00
Uwe Bonnes 3e3e450408 cdcacm.c: Use less buffer for the usb_uart buffers and reallocate.
With 128 bytes for both usb_uart buffers, traceswo gives errors!
Keep the size for the receive buffer and diminisch the transmit buffer,
as there is no flow control to the device.
Probably related to https://github.com/libopencm3/libopencm3/issues/477
2018-03-27 13:40:49 +02:00
Adam Heinrich f5cac4c78d platforms/stm32: Ignore noise errors on USBUART 2018-01-13 21:11:17 +01:00
Gareth McMullin 9a5b31c37b Fix fallthrough warnings on gcc 7 2017-10-09 11:07:29 +13:00
Gareth McMullin f27f3bad5c libftdi: Fix tdi_tdo_seq result unpacking 2017-10-05 08:26:33 +13:00
Gareth McMullin 0ed66547d5 Fix libopencm3 breakage 2017-09-25 11:17:03 +13:00
Uwe Bonnes 4966168802 s[t|w]link: Implement ENABLE_DEBUG. 2017-09-23 16:40:28 +02:00
Uwe Bonnes ce1ef6e41b stm32: Move rdi handling to common stm32 code. 2017-09-23 16:39:35 +02:00
Uwe Bonnes 203f6702d8 Flashsize_F103: Options for BMP on STM32F103C8 devices 2017-09-21 23:05:20 +02:00
Uwe Bonnes 963df9febc stlink: Use common initialization and detect V2.1 boards.
Factor out hardware revision detection, USB detach and power settings, as
all three program (bootloader, bmp and dfu-upgrade) need it.
2017-09-21 18:43:06 +02:00
Gareth McMullin 2eb2f8edd7 Use vector_table symbol for assignment of SCB_VTOR. 2017-06-09 13:07:06 +12:00
Uwe Bonnes a7771fa23f stlink/swlink: Remove missleading comments. 2017-06-08 18:25:43 +02:00
Uwe Bonnes 8cc2c44dbf f4discovery: Use Magic constant in RAM for Bootloader entry. 2017-05-11 22:21:38 +02:00
Uwe Bonnes a0e47c392b f4_discovery: Clean up platform.h and Readme. 2017-05-11 21:53:01 +02:00
Uwe Bonnes 814eb0e3a2 f4discovery: Make DFU work (again?) 2017-05-11 21:52:24 +02:00
Uwe Bonnes f5dd3006fb STM32: Generate same serial number as internal DFU bootloader. 2017-05-11 21:52:24 +02:00
Uwe Bonnes b7235da97f dfucore.c: Announce no writable bootloader pages when device is read proteced
or bootloader is write protected.

Device read protection or write protection on first 4 bootloader pages
can only be removed by mass erase. Triggering mass erase with a program
running from flash is doomed for failure.
User can force bootloader update, at their own risk to brick the device.
2017-05-07 13:19:37 +02:00
Uwe Bonnes b09a522f37 STM32F103: Use flash size from device for DFU string.
Complements #204.
STLinkV2-1 has F103CB on board! F103C8 on older Stlinks can use upper flash
with hopefully acceptable error rate.
For F103C8 devices, user has to give the force option to dfu-utils.
2017-05-07 13:19:37 +02:00
Uwe Bonnes 5af76a1b74 dfu_f1/dfu_upgrade: Do not set read protection.
As the first 4 pages of the bootloader will always keep write protection
once read protection is applied, with the second update of the bootloader
only the higher pages where updated effectivly.
In most cases this resulted in an inaccessible device!
2017-04-29 14:58:41 +02:00
Gareth McMullin b10971b19b Merge pull request #206 from UweBonnes/dfu-upload
Dfu upload
2017-04-27 10:07:37 -07:00
Gareth McMullin 633662dbb3 Hold TMS high during reset.
This is a questionable fix for the Kinetis K22F that samples
this pin on release from reset to enable its EzPort which
makes the flash unusable and disables the rest of the micro.
2017-04-21 11:05:07 +12:00
Gareth McMullin e5395aaba7 Merge pull request #91 from schodet/usb-vbus
Fix usage of USB_VBUS
2017-04-18 08:22:57 +12:00
Uwe Bonnes d796571438 Implement DFU_UPLOAD. 2017-04-15 14:26:03 +02:00
Uwe Bonnes 1d8ebcd75f Handle SET_ADDRESS according to DFUSE specs. 2017-04-14 15:16:59 +02:00
Gareth McMullin 394fd4894b Increase st-link flash allowance to 128K.
Although the devices are only documented to have 64K flash,
they have been obeserved to have a full 128K, although the undocumented
half may be untested and have problems.
2017-04-13 09:01:26 +12:00
Gareth McMullin 7ba2987a83 native: Fix macros for setting pin mode.
Fixes #184
2017-01-24 10:49:45 +13:00
Gareth McMullin a77fb9ac1b Merge pull request #180 from paramaggarwal/patch-1
Actual pin mappings and the comment differ!
2017-01-09 14:39:06 +13:00
Piotr Esden-Tempski 606b73601c Added TMS/SWDIO direction pin & adjusted SRST sense.
1) This version uses a direction control level shifters. We need to control
the direction of the TMS/SWDIO pin.
2.1) Because we want to support a large voltage range for SRST we use an
external dual MOSFET for asserting and sensing the SRST line. We have
added the hardware version 3 to be handled the same way as version 0.
Meaning using separate pins for assertion and sensing of the SRST line.
2.2) The new SRST sense circuit is inverting, thus we have dedicated
code for hardware version 3 that inverts the SRST status pin on read.
2017-01-06 18:31:55 -08:00
Param Aggarwal 51ac0fe319 Actual pin mappings and the comment differ!
I was stuck trying to debug the issue why my probe would not find any attached targets. This is because I was doing the pin mapping as per the comments, and not the actual code. There is a mismatch!

This PR updates the comment to reflect the values set in code. :)
2017-01-01 14:50:58 +05:30
Chuck McManis a3c2592e44 Review feedback 2016-12-04 13:15:45 -08:00
Chuck McManis 0aef6c6774 SAM4L: Add extended reset to target interface
This adds a new function to the internal target interface
to allow the target to get control before reset is complete
so that it can do any additional work. On this target there
is a proprietary internal bit that has to be reset in some
cases to allow the core to continue operating.
2016-12-02 00:08:21 -08:00
Gareth McMullin 7730d3b198 Don't enable usb uart on v2 when debugging 2016-11-22 12:45:59 +13:00
Gareth McMullin f947465fe4 libftdi: Disable Nagle algorithm and buffer sends internally.
This significantly improves performance by not waiting for TCP
timeout on transmission.
2016-10-25 10:07:04 -07:00
Piotr Esden-Tempski fdeb6471a8 Added missing #include guard. 2016-10-19 14:56:52 -07:00
Piotr Esden-Tempski 2d37de773c Fixed #include guard. 2016-10-19 14:36:27 -07:00
Piotr Esden-Tempski 8a009ca6ae Corrected jtagtap_next signature.
The parameter is TDI (as in input) not TDO. The header signature and
comment are correct.
2016-10-19 13:53:04 -07:00
Gareth McMullin 3abb4afdf6 Merge pull request #153 from gsmcmullin/restore_leds
Restore LED behaviour.
2016-10-05 10:37:36 -07:00
Gareth McMullin 966f360515 debug: Use semihosting if available or output via usbuart. 2016-09-29 21:31:13 -07:00
Gareth McMullin 40f960db4d Restore LED behaviour. 2016-09-28 22:15:15 -07:00
Gareth McMullin 45e322b9a3 Handle usart errors. 2016-08-22 09:57:52 +12:00
Gareth McMullin 5832d8a42a Clean up common SWD stuff. 2016-07-13 08:31:09 +12:00
Gareth McMullin 3c44cce935 Make generic jtagtap function weak and stop including the c file. 2016-07-13 08:31:09 +12:00
Gareth McMullin 0480578391 stlink: New discovery boards support.
Patch from issue #103
2016-07-13 08:00:05 +12:00
Gareth McMullin 8b4342394f Overhaul of timeouts so they may be nested. 2016-06-28 14:35:43 +12:00
Gareth McMullin 53c7fbd543 Fixes for verbose debug output. 2016-06-23 15:03:00 +12:00
Piotr Esden-Tempski 20c994eece Added black magic verbose/debug mode switch. 2016-06-22 17:28:26 -07:00
Piotr Esden-Tempski 9be5cdb702 BMPM V2 target power control GPIO needs to be an open drain drive.
BMPM V2 uses a biasing resistor for the true switch mosfet circuit.
Because of that the weak pull-up/down of the stm32 is not asserting the
correct gate voltage for the mosfets to fully switch through. Because of
that we need to use open drain configulation of the GPIO instead.
2016-06-06 15:01:37 -07:00
Gareth McMullin 8d9d6f692c Fix platform_delay 2016-04-19 13:23:04 -07:00
Gareth McMullin cd1d72257f Cleanup of SRST handling.
- Remove connect_assert_srst global.
- Attach functions always release reset.
- Platforms provide a method to poll the reset pin.
- Reset on scan is all internal to command.c
- Reset is released on a failed scan.  Fixes #111
2016-04-19 13:12:16 -07:00
bvernoux 2e3778e772 Cleanup and Fix code for HydraBus 2016-04-18 00:48:06 +02:00
Gareth McMullin 2685906fc8 Merge pull request #124 from gsmcmullin/windows_fixes
Fixes to allow building for Windows.
2016-04-16 14:49:22 -07:00
Gareth McMullin 799ccf99f5 Merge pull request #123 from gsmcmullin/digilent_cable
Add Digilent JTAG-HS3 FTDI cable.
2016-04-15 13:06:30 -07:00
Gareth McMullin 966b21c3e1 Merge pull request #121 from esden/bmpm2_support
Bmpm2 support
2016-04-15 13:01:34 -07:00
Gareth McMullin 9141418bd4 Merge pull request #80 from gsmcmullin/hydrabus
Add HydraBus support
2016-04-15 13:00:52 -07:00
Gareth McMullin 987a926a19 Fixes to allow building for Windows. 2016-04-15 12:58:36 -07:00
Gareth McMullin 4e8b40ad5d Add Digilent JTAG-HS3 FDTI cable. 2016-04-15 12:05:43 -07:00
Piotr Esden-Tempski 8e8a53ef12 Added support for Black Magic Probe Mini V2.0e.
All BMPM2 prototypes after revision a have their LED0 and LED2 inverted.
Because of that we have bumped the hardware revision to swap the LEDs in
software. This is easier than messing up the routing of the LEDs.
2016-04-06 19:23:17 -07:00
Piotr Esden-Tempski f2650df731 Fixed a hardware version detection glitch.
If you try to read out the GPIO immediately after setting the weak pull
on the pin it is possible that you will not read the correct value on a
floating pin. We need to use a busy wait loop instead of the
platform_delay because the platform timing is not initialized yet. We
also can not initialize the platform_delay code yet because it requires
LED gpio to be configured. A busy wait seems to do the job and is easier
than refactoring the codebase to use the platform_delay function.
2016-04-06 19:20:43 -07:00
Gareth McMullin c0f92ea5a7 Merge pull request #116 from esden/flashier_dfu
[native] Make the native bootloader bit more flashy.
2016-03-09 10:26:56 +13:00
Piotr Esden-Tempski c0c8bade6f [native] Make the native bootloader bit more flashy.
This change has also a practical reason. When flashing and testing the
hardware this change makes it easier to make sure all the LEDs work. Now
when the DFU bootloader is idle it is scanning the LEDs making it easy
to see if one of them has an issue.

In addition to that, the bootloader now indicates when there is data
being flashed using the DFU interface. In cases when one has more than
one device connected and accidently starts flashing a wrong device this
is very useful feature to have.
2016-02-14 23:47:57 -08:00
Piotr Esden-Tempski b7e5005679 [native] Check for hardware version by pull-up and -down. Print HW Version in mon command.
Until now the native hardware was pulling PB5-7 down and checking if
they were asserted high. BMPMV2b is pulling the pins down instead of
high. The hardware version routine now determines the hardware version
based on the fact if a pin is asserted at all. This means that if a pin
is left floating, the version number bit will be 0, and if the pin is
asserted either high or low the bit will be set to 1. While we were
already at it the "monitor version" command in GDB will now also print
the hardware version number.
2016-02-14 22:49:29 -08:00
Gareth McMullin 600f0d27d9 Use sniprintf on newlib platforms. 2015-11-11 12:41:13 -08:00
Antti Nykänen 3f9ea8250a Defined snprintf to sniprintf on launchpad-icdi 2015-10-22 19:33:45 +03:00
Antti Nykänen 2365bbe010 TI TM4C/LM4F cdc-acm fixes 2015-09-30 15:48:01 +03:00
Nicolas Schodet b60f5283ae Fix usage of USB_VBUS
USB_VBUS is not an alternate function, it is an additionnal function which is
always enabled.

If configured as an alternate function, it will draw current from VBUS.
2015-06-23 11:51:56 +02:00
Gareth McMullin 0fc635b3f8 Add functions for dynamically generating the XML memory map. 2015-04-03 21:18:16 -07:00
Gareth McMullin 482070c91b Merge branch 'v1.6-branch'
Conflicts:
	src/Makefile
	src/platforms/stlink/platform.h
	src/platforms/swlink/platform.h
2015-04-03 21:02:01 -07:00
Gareth McMullin 97824b7f02 Use git describe for version in generated header file. 2015-04-03 20:21:33 -07:00