Giter Site home page Giter Site logo

dirtyjtag's People

Contributors

jeanthom avatar phdussud avatar psyborg55 avatar thierer avatar zapashcanon avatar zoobab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dirtyjtag's Issues

ST-Link/V2 woes (when using ST's bootloader)

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.

Support for STM32F103C6?

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?

Alpine as build distro?

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?

stm32flash write protected

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

No frequency control

Frequency control is not working yet. We should accurately measure the delay created by the functions in delay.c to ensure proper frequency control.

CI migration?

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?

Required flash size for STM32F1

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 !

dirtyjtag-release target is buggy

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

Problem: Dockerfile does not build on docker hub

Problem: Dockerfile does not build on docker hub, seems docker hub does not like submodules:

https://hub.docker.com/repository/registry-1.docker.io/zoobab/dirtyjtag/builds/3ded2054-f2f9-4d00-8d58-94c7809ddfbe

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

Baite dongle

  • Test the changes made in master
  • Add documentation for the dongle

Harden command parsing

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 flashing using UART bootloader

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.

Build fails on Debian 11

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':

Make README.md smaller

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.

superfluous -g 0x8000000 for stm32flash

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.

Dongle programming documentation for the CK32-based clones (of the stlinkv2 clones)

Following the instructions on stlinkv2-swd on a CK32 clone:

IMG_1125
IMG_1124

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! ;)

No USB enumeration on STM32 reset

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.

Add some benchmarks table

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.

Make a docker automated build on docker hub

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.

Can't build

$ 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

DJTAG2 protocol discussion

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.

Proposal 1: increase maximum transfer size

@phdussud wrote in #76:

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:

  • 1 command identification byte
  • 2 bytes for transfer length

That would push the maximum transfer size to 61 bytes.

Proposal 2: specify if transfers should return data

@phdussud wrote in #76:

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.

Proposal 3: add bootloader support

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.