Stlink: Variant for Stlink V2 that works with the original ST bootloader.

Use https://github.com/jeanthom/stlink-tool.git for encrypted upload and
switch to BMP.
This commit is contained in:
Uwe Bonnes 2019-09-30 19:50:21 +02:00 committed by UweBonnes
parent 0ae7cea1ae
commit 8a1d8bfba3
2 changed files with 50 additions and 6 deletions

View File

@ -1,4 +1,5 @@
CROSS_COMPILE ?= arm-none-eabi- CROSS_COMPILE ?= arm-none-eabi-
ST_BOOTLOADER ?=
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
OBJCOPY = $(CROSS_COMPILE)objcopy OBJCOPY = $(CROSS_COMPILE)objcopy
@ -10,7 +11,12 @@ LDFLAGS_BOOT := $(LDFLAGS) --specs=nano.specs -lopencm3_stm32f1 \
-Wl,-T,platforms/stm32/stlink.ld -nostartfiles -lc \ -Wl,-T,platforms/stm32/stlink.ld -nostartfiles -lc \
-Wl,-Map=mapfile -mthumb -mcpu=cortex-m3 -Wl,-gc-sections \ -Wl,-Map=mapfile -mthumb -mcpu=cortex-m3 -Wl,-gc-sections \
-L../libopencm3/lib -L../libopencm3/lib
ifeq ($(ST_BOOTLOADER), 1)
$(info Load address 0x08004000 for original ST-LinkV2 Bootloader)
LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8004000
else
LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000 LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000
endif
ifeq ($(ENABLE_DEBUG), 1) ifeq ($(ENABLE_DEBUG), 1)
LDFLAGS += --specs=rdimon.specs LDFLAGS += --specs=rdimon.specs

View File

@ -8,10 +8,29 @@ Only if you have a Stlinkv2 with STM32F103C8 versus the STM32F103CB on V2/1
and you want to rewire and use the UART, consider reflashing the the Stlink and you want to rewire and use the UART, consider reflashing the the Stlink
firmware. firmware.
On StlinkV2, the original ST Bootloader can also be used with
- Compile firmware with "make PROBE_HOST=stlink ST_BOOTLOADER=1"
- Upload firmware with stlink-tool from [stlink-tool](https://github.com/jeanthom/stlink-tool.git).
Before upload, replug the stlink to enter the bootloader.
- After each stlink replug, use call "stlink-tool" without arguments
to enter BMP
Drawback: After each USB replug, DFU needs to be left explicit!
On Linux, add someting like :
`> cat /etc/udev/rules.d/98-stlink.rules`
`SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", ACTION=="add", RUN+="<path-to>/stlink-tool"`
for automatic switch to BMP on replug. However this defeats reflashing further
BMP reflash as long as this rule is active.
## Versions ## Versions
### [Standalone ST-LINKV2 ### [Standalone ST-LINKV2](https://www.st.com/content/st_com/en/products/development-tools/hardware-development-tools/development-tool-hardware-for-mcus/debug-hardware-for-mcus/debug-hardware-for-stm32-mcus/st-link-v2.html)
](https://www.st.com/content/st_com/en/products/development-tools/hardware-development-tools/development-tool-hardware-for-mcus/debug-hardware-for-mcus/debug-hardware-for-stm32-mcus/st-link-v2.html)
Accessible connectors for JTAG/SWD (20-pin) and SWIM. Accessible connectors for JTAG/SWD (20-pin) and SWIM.
ST-LINKV2/ISOL). ST-LINKV2/ISOL).
### ST-LINKV2 clones aka "baite" ### ST-LINKV2 clones aka "baite"
@ -21,8 +40,7 @@ board.
JTAG and target SWIM pins are accessible on connector (footprints). They are handled in the swlink branch. JTAG and target SWIM pins are accessible on connector (footprints). They are handled in the swlink branch.
### SWIM-only ST-LINK adapters on STM8 Nucleo-Stm8 boards ### SWIM-only ST-LINK adapters on STM8 Nucleo-Stm8 boards
As only a SWIM connector is accessible, they are not usefull as BMP target. As only a SWIM connector is accessible, they are not usefull as BMP target.
### [SWD only ST-LINK adapter ### [SWD only ST-LINK adapter](https://www.st.com/content/ccc/resource/technical/document/technical_note/group0/30/c8/1d/0f/15/62/46/ef/DM00290229/files/DM00290229.pdf/jcr:content/translations/en.DM00290229.pdf) (Stm32 Nucleo Boards, recent Discovery boards)
](https://www.st.com/content/ccc/resource/technical/document/technical_note/group0/30/c8/1d/0f/15/62/46/ef/DM00290229/files/DM00290229.pdf/jcr:content/translations/en.DM00290229.pdf)
SWD, SWO and Reset are accessible on a 6-pin connector row. SWD, SWO and Reset are accessible on a 6-pin connector row.
Jumper allow to route SWD to on-board target or off-board. Jumper allow to route SWD to on-board target or off-board.
Newer variants have UART TX/RX accessible on a connector Newer variants have UART TX/RX accessible on a connector
@ -35,8 +53,26 @@ CDCACM USART pins are not accessible. MCO output is used for LED.
#### ST-Link/V2 and ST-Link/V2-A #### ST-Link/V2 and ST-Link/V2-A
CDCACM USART pins are not accessible. MCO is connected to on board target. CDCACM USART pins are not accessible. MCO is connected to on board target.
#### ST-Link/V2-1 and ST-Link/V2-B #### ST-Link/V2-1 and ST-Link/V2-B
### [STLINK-V3SET ### [STLINK-V3SET](https://www.st.com/content/st_com/en/products/development-tools/hardware-development-tools/development-tool-hardware-for-mcus/debug-hardware-for-mcus/debug-hardware-for-stm32-mcus/stlink-v3set.html)
](https://www.st.com/content/st_com/en/products/development-tools/hardware-development-tools/development-tool-hardware-for-mcus/debug-hardware-for-mcus/debug-hardware-for-stm32-mcus/stlink-v3set.html)
## Wiring on Discovery and Nucleo Boards
If there is a 6-pin connector, connect an external target after removing
the 2 jumper shortening the 4-pin connector like this:
1: VCC sense, used only for measurement
2: SWCLK
3: GND
4: SWDIO
5: nSRST (pulled high by on board target. Will reset with on board target
unpowered.
6: SWO
## BMP version detection and handling ## BMP version detection and handling
All stlink variants All stlink variants
@ -45,3 +81,5 @@ UART RX/TX
PC13 low -> SWIM internal connection PC13 low -> SWIM internal connection
PC13/PC14 both low -> ST-LinkV2 on some F4_Diso boards.