dirtyjtag / dirtyjtag Goto Github PK
View Code? Open in Web Editor NEWJTAG probe firmware
License: MIT License
JTAG probe firmware
License: MIT License
As of today, our understanding of the ST-Link/V2 bootloader and STM32F103's USB core is not sufficient to allow for smooth operation: USB reenumeration has always been a PITA to get working across multiple platforms, interrupts are wonky, etc.
Until further notice, ST-Link/V2 DFU firmware is not supported.
An automated JTAG test procedure using an STM32 dev boards could be used for regression tests.
Add documentation for flashing over DFU.
I have a blue pill board with STM32F103C6T6 instead of xC8T6. They are all over Aliexpress etc, you can either buy the board with the C8T6 or C6T6, C8 is 2-3 times the price.
As far as I can see from here: https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html
they are very similar, 32/10 kB flash/ram vs 64/20 kB, and 2 UARTs instead of 3.
Judging from the binary size, DirtyJTAG should easily fit, but when flashed it does not enumerate as a USB device on a working board (verified by flashing STM32Duino and using serial via USB with it.
I'm willing to debug, and I could buy and donate a second one of those if it helps?
Here's the output of st-probe and st-flash:
#st-info --probe
Found 1 stlink programmers
serial: 2d3804016215303030303032
openocd: "\x2d\x38\x04\x01\x62\x15\x30\x30\x30\x30\x30\x32"
flash: 32768 (pagesize: 1024)
sram: 10240
chipid: 0x0412
descr: F1 Low-density device
#st-flash --reset write dirtyjtag.bluepill.bin 0x8000000
st-flash 1.6.0
2021-08-24T21:46:24 INFO common.c: Loading device parameters....
2021-08-24T21:46:24 INFO common.c: Device connected is: F1 Low-density device, id 0x10006412
2021-08-24T21:46:24 INFO common.c: SRAM size: 0x2800 bytes (10 KiB), Flash: 0x8000 bytes (32 KiB) in pages of 1024 bytes
2021-08-24T21:46:24 INFO common.c: Attempting to write 8600 (0x2198) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08002000 erased
2021-08-24T21:46:24 INFO common.c: Finished erasing 9 pages of 1024 (0x400) bytes
2021-08-24T21:46:24 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2021-08-24T21:46:24 INFO flash_loader.c: Successfully loaded flash loader in sram
9/9 pages written
2021-08-24T21:46:25 INFO common.c: Starting verification of write complete
2021-08-24T21:46:25 INFO common.c: Flash written and verified! jolly good!
and plugging that into the USB gives:
[45057.384431] usb 1-10: new full-speed USB device number 5 using xhci_hcd
[45057.590460] usb 1-10: device descriptor read/64, error -71
[45057.873445] usb 1-10: device descriptor read/64, error -71
[45058.161404] usb 1-10: new full-speed USB device number 6 using xhci_hcd
[45058.366459] usb 1-10: device descriptor read/64, error -71
[45058.650437] usb 1-10: device descriptor read/64, error -71
[45058.758436] usb usb1-port10: attempt power cycle
[45059.452411] usb 1-10: new full-speed USB device number 7 using xhci_hcd
[45059.479181] usb 1-10: Device not responding to setup address.
[45059.714225] usb 1-10: Device not responding to setup address.
[45059.918394] usb 1-10: device not accepting address 7, error -71
[45060.096405] usb 1-10: new full-speed USB device number 8 using xhci_hcd
[45060.123234] usb 1-10: Device not responding to setup address.
[45060.353163] usb 1-10: Device not responding to setup address.
[45060.558403] usb 1-10: device not accepting address 8, error -71
[45060.558436] usb usb1-port10: unable to enumerate USB device
What else can I provide?
Hi,
I just found out that someone packages the cross-compilers for ARM for Alpine, so I rewrote the Dockerfile to use it:
FROM alpine:3.12
MAINTAINER Benjamin Henrion <[email protected]>
LABEL Description="DirtyJTAG firmware for STM32 Bluepill board"
RUN echo -e "http://dl-cdn.alpinelinux.org/alpine/edge/main\nhttp://dl-cdn.alpinelinux.org/alpine/e
dge/testing\nhttp://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk update
RUN apk add gcc-arm-none-eabi sudo make python2 git bash
RUN mkdir -pv /code
COPY . /code
WORKDIR /code
RUN git submodule init
RUN git submodule sync
RUN git submodule update
RUN make PLATFORM=bluepill
RUN make PLATFORM=stlinkv2
RUN make PLATFORM=stlinkv2dfu
RUN make PLATFORM=baite
RUN make PLATFORM=olimexstm32h103
RUN make PLATFORM=stlinkv2white
But when I build it I have this weird shell error, adding bash does not help:
---> Running in 4f4ec574bb98
make -C /code/unicore-mx lib/stm32/f1
make[1]: Entering directory '/code/unicore-mx'
GENHDR include/unicore-mx/stm32/f3/irq.json
GENHDR include/unicore-mx/stm32/f1/irq.json
GENHDR include/unicore-mx/stm32/l1/irq.json
GENHDR include/unicore-mx/stm32/f7/irq.json
GENHDR include/unicore-mx/stm32/f4/irq.json
GENHDR include/unicore-mx/stm32/l0/irq.json
GENHDR include/unicore-mx/stm32/f0/irq.json
GENHDR include/unicore-mx/stm32/l4/irq.json
GENHDR include/unicore-mx/stm32/f2/irq.json
GENHDR include/unicore-mx/lm3s/irq.json
GENHDR include/unicore-mx/nrf/51/irq.json
GENHDR include/unicore-mx/sam/3x/irq.json
GENHDR include/unicore-mx/sam/3s/irq.json
GENHDR include/unicore-mx/sam/3n/irq.json
GENHDR include/unicore-mx/sam/3a/irq.json
GENHDR include/unicore-mx/sam/3u/irq.json
GENHDR include/unicore-mx/sam/4l/irq.json
GENHDR include/unicore-mx/lpc13xx/irq.json
GENHDR include/unicore-mx/lpc43xx/m0/irq.json
BUILD lib/stm32/f1
/bin/sh: syntax error: unterminated quoted string
make[1]: *** [Makefile:70: lib/stm32/f1] Error 2
make[1]: Leaving directory '/code/unicore-mx'
make: *** [Makefile:54: ucmx] Error 2
The command '/bin/sh -c make PLATFORM=bluepill' returned a non-zero code: 2
Any idea?
Hi,
Just got a GD32 RISC-V, which is pin to pin compatible with the stm32f103.
How hard would it be to port DirtyJTAG there?
The library unicore-mx does not seem to have support for it...
Here someone tweets about flashing an STM32 with a CH552G:
https://twitter.com/atc1441/status/1286517974153736192
Hello! Great software. Thank you for it.
I was trying to use this:
https://github.com/jeanthom/DirtyJTAG/blob/master/docs/install-bluepill.md
And I needed to unprotect my stm32 with this commands first. I think it would be helpfull if you put them in the doc because people are using the vendor propietary sofware for windows to unlock because then don't know stm32flash can do it. I almost use that software too.
If you get a NACK when trying to erase you need to remove write protection and if you get a NACK trying to make write unprotection then you need to remove read protection first. So I put the two commands.
stm32flash -k /dev/ttyUSB0
stm32flash -u /dev/ttyUSB0
Thank you again.
Reference: http://stm32duinoforum.com/forum/viewtopic_f_20_t_747.html
Frequency control is not working yet. We should accurately measure the delay created by the functions in delay.c
to ensure proper frequency control.
With the travis-ci.org to travis-ci.com migration, I'm thinking about reconsidering the current CI solution for DirtyJTAG. I tried sr.ht for gram this summer. It works quite well, you get a build slot quickly, and you can SSH if the build fails.
What do you think?
Hi what driver do i use for the firmware
OpenFPGALoader is supporting DirtyJTAG, it would be good to add at least a link to the project, if not a nice picture and a screenshot:
#include <unicore-mx/stm32/desig.h>
It seems to have everything we need.
Hi,
I would like to buy bluepill to flash it with DirtyJTAG, and I wonder what is the required flash size for the firmware !
There appear to be two bluepill versions on aliexpress, one with STM32F103C6T6 and the other with STM32F103C8T6 !
Would dirtyjtag fit on the earlier, or do I need the later ?
Thanks !
ST-Link v2 clone seems to have a DFU bootloader that allow for encrypted firmware upgrades. This will require a specific linker script (trivial) and bootloader patching (in the current situation, the DFU bootloader would not exit DFU until we would launch an st-info command).
Interesting links :
Most of the jlink ob clones on aliexpress comes with this chip. As far as I could see, these clones have 4 3V tolerant pins, and 2 5V tolerant pins for VCOM. There also seems to be a hardwired reset pin too.
I think this document has the correct pinmap(https://github.com/idrnyu/dllGetSt072JlinkOb/blob/master/%E7%94%B5%E8%B7%AF072%E6%B3%A8%E6%84%8F.txt)
I'm wondering if it would be possible to port dirtyjtag to this chip, it supports usb dfu too.
Make a PDF to create pinout stickers, to cut with cisors and glue on the stlinkv2 dongles with "scotch" tape.
Objects are built only once, not for every platform:
arm-none-eabi-gcc -g -O2 -Wall -Wextra -Werror -fno-common -ffunction-sections -fdata-sections -std=gnu11 -DPLATFORM='HW_bluepill' -MD -g -Wall -Wundef -I/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/include -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -o src/dirtyjtag.bluepill.o -c src/dirtyjtag.c
arm-none-eabi-gcc -g -O2 -Wall -Wextra -Werror -fno-common -ffunction-sections -fdata-sections -std=gnu11 -DPLATFORM='HW_bluepill' -MD -g -Wall -Wundef -I/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/include -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -o src/jtag.bluepill.o -c src/jtag.c
arm-none-eabi-gcc -g -O2 -Wall -Wextra -Werror -fno-common -ffunction-sections -fdata-sections -std=gnu11 -DPLATFORM='HW_bluepill' -MD -g -Wall -Wundef -I/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/include -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -o src/usb.bluepill.o -c src/usb.c
arm-none-eabi-gcc -g -O2 -Wall -Wextra -Werror -fno-common -ffunction-sections -fdata-sections -std=gnu11 -DPLATFORM='HW_bluepill' -MD -g -Wall -Wundef -I/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/include -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -o src/delay.bluepill.o -c src/delay.c
arm-none-eabi-gcc -g -O2 -Wall -Wextra -Werror -fno-common -ffunction-sections -fdata-sections -std=gnu11 -DPLATFORM='HW_bluepill' -MD -g -Wall -Wundef -I/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/include -DSTM32F1 -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -o src/cmd.bluepill.o -c src/cmd.c
arm-none-eabi-gcc --static -nostartfiles -L"/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/lib" -Tld/bluepill.ld -Wl,-Map=src/dirtyjtag.baite.map -Wl,--gc-sections -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd src/dirtyjtag.bluepill.o src/jtag.bluepill.o src/usb.bluepill.o src/delay.bluepill.o src/cmd.bluepill.o -lucmx_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o src/dirtyjtag.baite.elf
arm-none-eabi-size src/dirtyjtag.baite.elf
text data bss dec hex filename
8556 80 1176 9812 2654 src/dirtyjtag.baite.elf
arm-none-eabi-objcopy -Obinary src/dirtyjtag.baite.elf src/dirtyjtag.baite.bin
arm-none-eabi-gcc --static -nostartfiles -L"/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/lib" -Tld/bluepill.ld -Wl,-Map=src/dirtyjtag.bluepill.map -Wl,--gc-sections -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd src/dirtyjtag.bluepill.o src/jtag.bluepill.o src/usb.bluepill.o src/delay.bluepill.o src/cmd.bluepill.o -lucmx_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o src/dirtyjtag.bluepill.elf
arm-none-eabi-size src/dirtyjtag.bluepill.elf
text data bss dec hex filename
8556 80 1176 9812 2654 src/dirtyjtag.bluepill.elf
arm-none-eabi-objcopy -Obinary src/dirtyjtag.bluepill.elf src/dirtyjtag.bluepill.bin
arm-none-eabi-gcc --static -nostartfiles -L"/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/lib" -Tld/bluepill.ld -Wl,-Map=src/dirtyjtag.olimexstm32h103.map -Wl,--gc-sections -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd src/dirtyjtag.bluepill.o src/jtag.bluepill.o src/usb.bluepill.o src/delay.bluepill.o src/cmd.bluepill.o -lucmx_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o src/dirtyjtag.olimexstm32h103.elf
arm-none-eabi-size src/dirtyjtag.olimexstm32h103.elf
text data bss dec hex filename
8556 80 1176 9812 2654 src/dirtyjtag.olimexstm32h103.elf
arm-none-eabi-objcopy -Obinary src/dirtyjtag.olimexstm32h103.elf src/dirtyjtag.olimexstm32h103.bin
arm-none-eabi-gcc --static -nostartfiles -L"/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/lib" -Tld/bluepill.ld -Wl,-Map=src/dirtyjtag.stlinkv2.map -Wl,--gc-sections -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd src/dirtyjtag.bluepill.o src/jtag.bluepill.o src/usb.bluepill.o src/delay.bluepill.o src/cmd.bluepill.o -lucmx_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o src/dirtyjtag.stlinkv2.elf
arm-none-eabi-size src/dirtyjtag.stlinkv2.elf
text data bss dec hex filename
8556 80 1176 9812 2654 src/dirtyjtag.stlinkv2.elf
arm-none-eabi-objcopy -Obinary src/dirtyjtag.stlinkv2.elf src/dirtyjtag.stlinkv2.bin
arm-none-eabi-gcc --static -nostartfiles -L"/home/jeanthomas/Documents/DirtyJTAG/unicore-mx/lib" -Tld/bluepill.ld -Wl,-Map=src/dirtyjtag.stlinkv2white.map -Wl,--gc-sections -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd src/dirtyjtag.bluepill.o src/jtag.bluepill.o src/usb.bluepill.o src/delay.bluepill.o src/cmd.bluepill.o -lucmx_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o src/dirtyjtag.stlinkv2white.elf
arm-none-eabi-size src/dirtyjtag.stlinkv2white.elf
text data bss dec hex filename
8556 80 1176 9812 2654 src/dirtyjtag.stlinkv2white.elf
arm-none-eabi-objcopy -Obinary src/dirtyjtag.stlinkv2white.elf src/dirtyjtag.stlinkv2white.bin
rm src/delay.bluepill.o src/usb.bluepill.o src/dirtyjtag.baite.elf src/dirtyjtag.bluepill.o src/dirtyjtag.olimexstm32h103.elf src/jtag.bluepill.o src/cmd.bluepill.o src/dirtyjtag.stlinkv2white.elf
Make an texane/stlink debian/ubuntu/fedora binary package on OpenBuildService (OBS).
This is quite easy, and there is nothing to do, at least for Debian/Ubuntu.
It would be nice to backup the ST-Link original firmware and put it back if needed. Maybe this could be done using stlink.
Add support for OpenOCD.
Related to build : https://travis-ci.org/jeanthom/DirtyJTAG/builds/332513762
ST-Linkv2 and Bluepill builds fail but Travis says everything is OK.
Problem: Dockerfile does not build on docker hub, seems docker hub does not like submodules:
Step 16/22 : RUN git submodule sync
---> Running in 26afeae2b5f3
Synchronizing submodule url for 'unicore-mx'
fatal: Not a git repository: /src/bb7tgzbayspbeirfmajq3t4/.git/modules/unicore-mx
fatal: Not a git repository: /src/bb7tgzbayspbeirfmajq3t4/.git/modules/unicore-mx
fatal: Not a git repository: /src/bb7tgzbayspbeirfmajq3t4/.git/modules/unicore-mx
Removing intermediate container 26afeae2b5f3
---> d2c5456aa385
Step 17/22 : RUN git submodule update
---> Running in e85bb4aabfae
fatal: Not a git repository: /src/bb7tgzbayspbeirfmajq3t4/.git/modules/unicore-mx
Unable to find current revision in submodule path 'unicore-mx'
Removing intermediate container e85bb4aabfae
The command '/bin/sh -c git submodule update' returned a non-zero code: 1
As reported by @zoobab https://github.com/jeanthom/DirtyJTAG/blob/master/docs/install-stlinkv2-swd.md has the wrong title
The command parsing loop can currently go into an infinite loop if we don't end our command sequence with either a data-returning command or with CMD_STOP. We should add protection to avoid buffer overruns.
Bluepill (and blackpill) boards are flashed with a serial bootloader. We could use this to flash DirtyJTAG without an SWD programmer.
Builds that are compatible with bootloaders have to be compiled with a special linker script.
add/test support for the Ugly board:
A frsh recursive checkout as documented fails on building it:
me@blender:~/develop/dirtyjtag$ make PLATFORM=bluepill
make -C /home/me/develop/dirtyjtag/unicore-mx lib/stm32/f1
make[1]: Entering directory '/home/me/develop/dirtyjtag/unicore-mx'
GENHDR include/unicore-mx/efm32/tg/irq.json
GENHDR include/unicore-mx/efm32/g/irq.json
GENHDR include/unicore-mx/efm32/gg/irq.json
GENHDR include/unicore-mx/efm32/lg/irq.json
GENHDR include/unicore-mx/stm32/f1/irq.json
GENHDR include/unicore-mx/stm32/f3/irq.json
GENHDR include/unicore-mx/stm32/f2/irq.json
GENHDR include/unicore-mx/stm32/f0/irq.json
GENHDR include/unicore-mx/stm32/f4/irq.json
GENHDR include/unicore-mx/stm32/l1/irq.json
GENHDR include/unicore-mx/stm32/f7/irq.json
GENHDR include/unicore-mx/stm32/l0/irq.json
GENHDR include/unicore-mx/stm32/l4/irq.json
GENHDR include/unicore-mx/lm3s/irq.json
GENHDR include/unicore-mx/vf6xx/irq.json
GENHDR include/unicore-mx/lpc43xx/m0/irq.json
GENHDR include/unicore-mx/lpc43xx/m4/irq.json
GENHDR include/unicore-mx/nrf/51/irq.json
GENHDR include/unicore-mx/lpc13xx/irq.json
GENHDR include/unicore-mx/lpc17xx/irq.json
GENHDR include/unicore-mx/sam/3x/irq.json
GENHDR include/unicore-mx/sam/3u/irq.json
GENHDR include/unicore-mx/sam/3a/irq.json
GENHDR include/unicore-mx/sam/4l/irq.json
GENHDR include/unicore-mx/sam/3s/irq.json
GENHDR include/unicore-mx/sam/3n/irq.json
GENUCH include/unicore-mx/stm32/f3/opamp.h
GENUCH include/unicore-mx/stm32/common/st_usbfs_v1.h
GENUCH include/unicore-mx/stm32/common/st_usbfs_common.h
GENUCH include/unicore-mx/stm32/common/st_usbfs_v2.h
GENUCH include/unicore-mx/common/dwc_otg.h
BUILD lib/stm32/f1
/bin/sh: 1: Syntax error: Unterminated quoted string
make[1]: *** [Makefile:70: lib/stm32/f1] Error 2
make[1]: Leaving directory '/home/me/develop/dirtyjtag/unicore-mx'
make: *** [Makefile:54: ucmx] Error 2
Furthermore I had to change line 240 in scripts/uc-def/uc-def from:
if inp[0] is not 'r':
to
if inp[0] != 'r':
STM32 dongles have 3 built-in serial IF, we could use them in addition to JTAG (bluepill targets mainly).
Inspiration : https://github.com/satoshinm/pill_serial
README.md
is growing day after day with tons of informations. This is daunting for new users. We could deal with that by writing Markdown files in the docs/
folder.
add/test support for the maple mini
Since the boot0 jumper will be removed and the power cycled after flashing, there is no point in adding the "-g 0x8000000" to tell the bootloader to jump to the start of flash after writing.
It seems like unicore-mx repo was migrated to GitLab, the GitHub repository wasn't updated in a very long time.
USB device isn't recognized on DirtyJTAG master.
Following the instructions on stlinkv2-swd on a CK32 clone:
I get this:
$ openocd -f interface/stlink.cfg -f target/stm32f1x.cfg
Open On-Chip Debugger v0.10.0-esp32-20201202-2-g7e342cad (2021-01-02-23:47)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.135834
Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
Which is easily solved by modifying interfaces/stlink.cfg
accordingly, let's create a new file under target
call it stlink-ck32.cfg
:
--- stm32f1x.cfg 2021-01-28 22:55:43.000000000 +1100
+++ ck32.cfg 2021-01-28 22:55:55.000000000 +1100
@@ -39,7 +39,7 @@
set _CPUTAPID 0x3ba00477
} {
# this is the SW-DP tap id not the jtag tap id
- set _CPUTAPID 0x1ba01477
+ set _CPUTAPID 0x2ba01477
}
}
Trying again with the CK32 TAPID:
$ openocd -f interface/stlink.cfg -f target/ck32.cfg
Open On-Chip Debugger v0.10.0-esp32-20201202-2-g7e342cad (2021-01-02-23:47)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.135834
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'telnet' connection on tcp/4444
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x0800128e msp: 0x200007d8
Info : device id = 0x20036410
Info : flash size = 64kbytes
Then following the official documentation for unlocking works fine:
$ telnet localhost 4444
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x0800128e msp: 0x200007d8
> stm32f1x unlock 0
device id = 0x20036410
flash size = 64kbytes
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
> reset
> exit
Connection closed by foreign host.
And also following the flashing docs for STlink v2 via SWD, one should see the following messages:
$ st-flash write dirtyjtag.stlinkv2.bin 0x8000000
st-flash 1.6.0
2021-01-28T20:40:19 INFO common.c: Loading device parameters....
2021-01-28T20:40:19 INFO common.c: Device connected is: F1 Medium-density device, id 0x20036410
2021-01-28T20:40:19 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2021-01-28T20:40:19 INFO common.c: Attempting to write 8504 (0x2138) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08002000 erased
2021-01-28T20:40:19 INFO common.c: Finished erasing 9 pages of 1024 (0x400) bytes
2021-01-28T20:40:19 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2021-01-28T20:40:19 INFO flash_loader.c: Successfully loaded flash loader in sram
9/9 pages written
2021-01-28T20:40:19 INFO common.c: Starting verification of write complete
2021-01-28T20:40:20 INFO common.c: Flash written and verified! jolly good!
Otherwise a locked target errors look like this:
(..)
2021-01-28T20:34:11 INFO flash_loader.c: Successfully loaded flash loader in sram
2021-01-28T20:34:14 ERROR flash_loader.c: flash loader run error
2021-01-28T20:34:14 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1
stlink_fwrite_flash() == -1
Hope this helps folks! ;)
Currently when the STM32 is reset, its USB peripheral doesn't re-enumerate. According to this GitHub project, we could do this using some GPIO tricks :
On "generic" boards, the USB reset (to force re-enumeration by the host), is triggered by reconfiguring USB line D+ (PA12) into GPIO mode, and driving PA12 low for a short period, before setting the pin back to its USB operational mode. This system to reset the USB was written by @Victor_pv. Note. It is not guaranteed to work on all "generic" STM32 boards, and relies on PA12 having a pull-up resistor of around 1.5k - however most "generic" boards seem to have this. Its unclear if this method to reset the USB bus conforms precisely to the USB standard, but it seems to work fine on all PC's and Mac's (and Linux boxes) on which its been tested - and seems usable for hobby / non commericial / non-critical systems.
Problem: website wiki.stm32duino.com vanished, link to http://wiki.stm32duino.com/index.php?title=Black_Pill is broken
Solution: https://web.archive.org/web/20190220175310/http://wiki.stm32duino.com/index.php?title=Black_Pill
Making printing-friendly sticker for gluing on top of the engraved pinout.
Add some benchmarks table, comparing the speed with other dongles.
With a versaloon stm32 and openocd, flashing a file can take a minute, while it takes 1s with an FT2232H.
https://github.com/jeanthom/DirtyJTAG/blob/master/docs/building-dirtyjtag.md
"Currently there are two platforms :
bluepill : Default build setting
stlinkv2 : Chinese ST-Link clone with specific pinout"
Make a docker automated build on docker hub, that would require probably creating an organization that has access to this repo.
Add a build logo (success/failure) on the frontpage if possible.
$ make PLATFORM=stlinkv2
make -C /home/anubis/git/DirtyJTAG/unicore-mx lib/stm32/f1
make[1]: Entering directory '/home/anubis/git/DirtyJTAG/unicore-mx'
GENHDR include/unicore-mx/efm32/g/irq.json
GENHDR include/unicore-mx/efm32/gg/irq.json
GENHDR include/unicore-mx/efm32/lg/irq.json
GENHDR include/unicore-mx/efm32/tg/irq.json
GENHDR include/unicore-mx/lm3s/irq.json
GENHDR include/unicore-mx/lpc13xx/irq.json
GENHDR include/unicore-mx/lpc17xx/irq.json
GENHDR include/unicore-mx/lpc43xx/m0/irq.json
GENHDR include/unicore-mx/lpc43xx/m4/irq.json
GENHDR include/unicore-mx/nrf/51/irq.json
GENHDR include/unicore-mx/sam/3a/irq.json
GENHDR include/unicore-mx/sam/3n/irq.json
GENHDR include/unicore-mx/sam/3s/irq.json
GENHDR include/unicore-mx/sam/3u/irq.json
GENHDR include/unicore-mx/sam/3x/irq.json
GENHDR include/unicore-mx/sam/4l/irq.json
GENHDR include/unicore-mx/stm32/f0/irq.json
GENHDR include/unicore-mx/stm32/f1/irq.json
GENHDR include/unicore-mx/stm32/f2/irq.json
GENHDR include/unicore-mx/stm32/f3/irq.json
GENHDR include/unicore-mx/stm32/f4/irq.json
GENHDR include/unicore-mx/stm32/f7/irq.json
GENHDR include/unicore-mx/stm32/l0/irq.json
GENHDR include/unicore-mx/stm32/l1/irq.json
GENHDR include/unicore-mx/stm32/l4/irq.json
GENHDR include/unicore-mx/vf6xx/irq.json
GENUCH include/unicore-mx/common/dwc_otg.h
./scripts/uc-def/uc-def:240: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if inp[0] is not 'r':
GENUCH include/unicore-mx/stm32/common/st_usbfs_common.h
./scripts/uc-def/uc-def:240: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if inp[0] is not 'r':
GENUCH include/unicore-mx/stm32/common/st_usbfs_v1.h
./scripts/uc-def/uc-def:240: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if inp[0] is not 'r':
GENUCH include/unicore-mx/stm32/common/st_usbfs_v2.h
./scripts/uc-def/uc-def:240: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if inp[0] is not 'r':
GENUCH include/unicore-mx/stm32/f3/opamp.h
./scripts/uc-def/uc-def:240: SyntaxWarning: "is not" with a literal. Did you mean "!="?
if inp[0] is not 'r':
BUILD lib/stm32/f1
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make[1]: *** [Makefile:70: lib/stm32/f1] Error 1
make[1]: Leaving directory '/home/anubis/git/DirtyJTAG/unicore-mx'
make: *** [Makefile:54: ucmx] Error 2
In a discussion with @phdussud he suggested an evolution of the current USB protocol to allow for better performance. This GitHub issue is here to discuss how we should implement the next iteration of the DirtyJTAG USB protocol.
The current protocol is nicknamed "DJTAG1". You can actually query this with CMD_INFO (source code).
We should ideally make it retrocompatible by making DJTAG2 a superset of DJTAG1. Newer software should CMD_INFO to query whether or not they can use DJTAG2 commands or if they're stuck with DJTAG1.
One last thing is that I believe the biggest improvement that can be made after this is increasing the packet length from 32 to 64. This requires changing the cmd structure (2 bytes for the length), therefore clients will have to change. This is the reason I didn't do it.
Personnal comment: USB bulk transaction for full-speed devices (like DirtyJTAG) are limited to 64 bytes. For a transfer we would need:
That would push the maximum transfer size to 61 bytes.
Another simple substantial improvement: we can introduce a transfer that does not send back a USB packet. Most of the programming involves only a write operation to the device. I implemented it and my timing improves quite a bit. With the best clock rate (SPI) it takes 253us for each 30byte of transfer. Only 53us is actually spend on the Jtag bus. The rest is USB overhead.
If I implement the transfer with no read, the time goes down to 172us. In my example, the fastest wall clock time for the end to end programming is 2.9sec with normal transfers and 2s with no read transfer
This is with OpenFPGALoader which already knows when it does not need to read back.
Using DirtyJTAG with a bootloader is currently very limited. Adding a command for jumping to bootloader would allow seamless upgrades. For dapboot we have to set magic values into the RTC backup registers before resetting the MCU.
add/test support for the Blackpill
Make a docker multistage build with only the binaries and the flashing tools.
According to http://www.diygoodies.org.ua/?p=417 the pinout should be the following:
TCK PA5
TDO PA6
TDI PA7
TMS PB14
NRST PB0
JRST PB1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.