Skip to content

Commit d85db44

Browse files
Add ST-Link/OpenOCD support as a programmer
1 parent 9cc3282 commit d85db44

File tree

688 files changed

+27362
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

688 files changed

+27362
-0
lines changed

boards.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dragonfly.build.arch=STM32L4
2828
dragonfly.build.core=stm32l4
2929
dragonfly.build.extra_flags=-DSTM32L476xx -D__FPU_PRESENT=1 -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mabi=aapcs -mslow-flash-data -fsingle-precision-constant
3030
dragonfly.build.ldscript=linker_scripts/STM32L476RE_FLASH.ld
31+
dragonfly.build.openocdscript=openocd_scripts/stm32l476re_dragonfly.cfg
3132
dragonfly.build.variant=STM32L476RE-Dragonfly
3233
dragonfly.build.variant_system_libs="-L{build.variant.path}" "-L{runtime.platform.path}/system/CMSIS/Lib" -lstm32l476 -larm_cortexM4lf_math
3334
dragonfly.build.variant_system_include="-I{runtime.platform.path}/system/CMSIS/Include" "-I{runtime.platform.path}/system/CMSIS/Device/ST/STM32L4xx/Include" "-I{runtime.platform.path}/system/libstm32l4/USB/HAL/Inc" "-I{runtime.platform.path}/system/libstm32l4/USB/Core/Inc" "-I{runtime.platform.path}/system/libstm32l4/USB/Class/CDC/Inc" "-I{runtime.platform.path}/system/libstm32l4/USB/Class/MSC/Inc" "-I{runtime.platform.path}/system/libstm32l4/USB" "-I{runtime.platform.path}/system/libstm32l4"

platform.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,24 @@ tools.stm32l4_upload.bootloader.params.verbose=-v
121121
tools.stm32l4_upload.bootloader.params.quiet=
122122
tools.stm32l4_upload.bootloader.pattern="{path}/{cmd}" "{runtime.platform.path}/bootloaders/{bootloader.file}"
123123

124+
tools.openocd.path={runtime.platform.path}/tools/windows
125+
tools.openocd.path.macosx={runtime.platform.path}/tools/macosx
126+
tools.openocd.path.linux={runtime.platform.path}/tools/linux/openocd
127+
tools.openocd.cmd=bin/openocd
128+
tools.openocd.cmd.windows=bin/openocd.exe
129+
130+
tools.openocd.upload.params.verbose=-d2
131+
tools.openocd.upload.params.quiet=-d0
132+
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{runtime.platform.path}/tools/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.bin}} verify reset; shutdown"
133+
134+
tools.openocd.program.params.verbose=-d2
135+
tools.openocd.program.params.quiet=-d0
136+
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{runtime.platform.path}/tools/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.elf}} verify reset; shutdown"
137+
138+
tools.openocd.erase.params.verbose=-d3
139+
tools.openocd.erase.params.quiet=-d0
140+
tools.openocd.erase.pattern=
141+
142+
tools.openocd.bootloader.params.verbose=-d2
143+
tools.openocd.bootloader.params.quiet=-d0
144+
tools.openocd.bootloader.pattern="{path}/{cmd}" {program.verbose} -s "{runtime.platform.path}/tools/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.elf}} verify reset; shutdown"

programmers.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ dfu.protocol=dfu
44
dfu.program.protocol=
55
dfu.program.tool=stm32l4_upload
66
dfu.program.extra_params=
7+
8+
stlink.name=ST-Link V2
9+
stlink.communication=USB
10+
stlink.protocol=
11+
stlink.program.protocol=
12+
stlink.program.tool=openocd
13+
stlink.program.extra_params=

tools/linux/openocd/bin/openocd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
LD_LIBRARY_PATH="$(dirname "$0")/../lib" "$0.bin" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
4+

tools/linux/openocd/bin/openocd.bin

8.47 MB
Binary file not shown.
37.8 KB
Binary file not shown.
37.8 KB
Binary file not shown.
Binary file not shown.
56.5 KB
Binary file not shown.
56.5 KB
Binary file not shown.
Binary file not shown.

tools/linux/openocd/lib/libjaylink.so

51.7 KB
Binary file not shown.
51.7 KB
Binary file not shown.
51.7 KB
Binary file not shown.

tools/linux/openocd/lib/libusb-1.0.so

288 KB
Binary file not shown.
288 KB
Binary file not shown.
288 KB
Binary file not shown.

tools/macosx/openocd/bin/openocd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
DYLD_LIBRARY_PATH="$(dirname "$0")/../lib" "$0.bin" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
4+

tools/macosx/openocd/bin/openocd.bin

3.1 MB
Binary file not shown.
24.9 KB
Binary file not shown.
24.9 KB
Binary file not shown.
53.2 KB
Binary file not shown.
53.2 KB
Binary file not shown.
111 KB
Binary file not shown.
111 KB
Binary file not shown.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#----------------------------------------
2+
# Purpose - Create some $BIT variables
3+
# Create $K and $M variables
4+
# and some bit field extraction variables.
5+
# Creat helper variables ...
6+
# BIT0.. BIT31
7+
8+
for { set x 0 } { $x < 32 } { set x [expr $x + 1]} {
9+
set vn [format "BIT%d" $x]
10+
global $vn
11+
set $vn [expr (1 << $x)]
12+
}
13+
14+
# Create K bytes values
15+
# __1K ... to __2048K
16+
for { set x 1 } { $x < 2048 } { set x [expr $x * 2]} {
17+
set vn [format "__%dK" $x]
18+
global $vn
19+
set $vn [expr (1024 * $x)]
20+
}
21+
22+
# Create M bytes values
23+
# __1M ... to __2048K
24+
for { set x 1 } { $x < 2048 } { set x [expr $x * 2]} {
25+
set vn [format "__%dM" $x]
26+
global $vn
27+
set $vn [expr (1024 * 1024 * $x)]
28+
}
29+
30+
proc create_mask { MSB LSB } {
31+
return [expr (((1 << ($MSB - $LSB + 1))-1) << $LSB)]
32+
}
33+
34+
# Cut Bits $MSB to $LSB out of this value.
35+
# Example: % format "0x%08x" [extract_bitfield 0x12345678 27 16]
36+
# Result: 0x02340000
37+
38+
proc extract_bitfield { VALUE MSB LSB } {
39+
return [expr [create_mask $MSB $LSB] & $VALUE]
40+
}
41+
42+
43+
# Cut bits $MSB to $LSB out of this value
44+
# and shift (normalize) them down to bit 0.
45+
#
46+
# Example: % format "0x%08x" [normalize_bitfield 0x12345678 27 16]
47+
# Result: 0x00000234
48+
#
49+
proc normalize_bitfield { VALUE MSB LSB } {
50+
return [expr [extract_bitfield $VALUE $MSB $LSB ] >> $LSB]
51+
}
52+
53+
proc show_normalize_bitfield { VALUE MSB LSB } {
54+
set m [create_mask $MSB $LSB]
55+
set mr [expr $VALUE & $m]
56+
set sr [expr $mr >> $LSB]
57+
echo [format "((0x%08x & 0x%08x) -> 0x%08x) >> %2d => (0x%x) %5d " $VALUE $m $mr $LSB $sr $sr]
58+
return $sr
59+
}
60+
61+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# board config file for AcTux3/XBA IXP42x board
2+
# Date: 2010-12-16
3+
# Author: Michael Schwingen <[email protected]>
4+
5+
reset_config trst_and_srst separate
6+
7+
adapter_nsrst_delay 100
8+
jtag_ntrst_delay 100
9+
10+
source [find target/ixp42x.cfg]
11+
12+
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 0x10000 -work-area-backup 0
13+
14+
$_TARGETNAME configure -event reset-init { init_actux3 }
15+
16+
proc init_actux3 { } {
17+
##########################################################################
18+
# setup expansion bus CS
19+
##########################################################################
20+
mww 0xc4000000 0xbd113842 ;#CS0 : Flash, write enabled @0x50000000
21+
mww 0xc4000004 0x94d10013 ;#CS1
22+
mww 0xc4000008 0x95960003 ;#CS2
23+
mww 0xc400000c 0x00000000 ;#CS3
24+
mww 0xc4000010 0x80900003 ;#CS4
25+
mww 0xc4000014 0x9d520003 ;#CS5
26+
mww 0xc4000018 0x81860001 ;#CS6
27+
mww 0xc400001c 0x80900003 ;#CS7
28+
29+
ixp42x_init_sdram $::IXP42x_SDRAM_16MB_4Mx16_1BANK 2100 3
30+
31+
#mww 0xc4000020 0xffffee ;# CFG0: remove expansion bus boot flash mirror at 0x00000000
32+
33+
ixp42x_set_bigendian
34+
35+
flash probe 0
36+
}
37+
38+
proc flash_boot { {FILE "/tftpboot/actux3/u-boot.bin"} } {
39+
echo "writing bootloader: $FILE"
40+
flash write_image erase $FILE 0x50000000 bin
41+
}
42+
43+
set _FLASHNAME $_CHIPNAME.flash
44+
flash bank $_FLASHNAME cfi 0x50000000 0x400000 2 2 $_TARGETNAME
45+
46+
init
47+
reset init
48+
49+
# setup to debug u-boot in flash
50+
proc uboot_debug {} {
51+
gdb_breakpoint_override hard
52+
xscale vector_catch 0xFF
53+
54+
xscale vector_table low 1 0xe59ff018
55+
xscale vector_table low 2 0xe59ff018
56+
xscale vector_table low 3 0xe59ff018
57+
xscale vector_table low 4 0xe59ff018
58+
xscale vector_table low 5 0xe59ff018
59+
xscale vector_table low 6 0xe59ff018
60+
xscale vector_table low 7 0xe59ff018
61+
62+
xscale vector_table high 1 0xe59ff018
63+
xscale vector_table high 2 0xe59ff018
64+
xscale vector_table high 3 0xe59ff018
65+
xscale vector_table high 4 0xe59ff018
66+
xscale vector_table high 5 0xe59ff018
67+
xscale vector_table high 6 0xe59ff018
68+
xscale vector_table high 7 0xe59ff018
69+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Adapteva Parallella-I board (via Porcupine-1 adapter board)
3+
#
4+
5+
reset_config srst_only
6+
7+
source [find target/zynq_7000.cfg]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
source [find target/alphascale_asm9260t.cfg]
2+
3+
reset_config trst_and_srst
4+
5+
$_TARGETNAME configure -event reset-init {
6+
echo "Configure clock"
7+
# Enable SRAM clk
8+
mww 0x80040024 0x4
9+
# Enable IRQ clk
10+
mww 0x80040034 0x100
11+
# Enable DMA0,1 clk
12+
mww 0x80040024 0x600
13+
# Make sysre syspll is enabled
14+
mww 0x80040238 0x750
15+
#CPU = PLLCLK/2
16+
mww 0x8004017C 0x2
17+
#SYSAHBCLK = CPUCLK/2
18+
mww 0x80040180 0x2
19+
# Set PLL freq to 480MHz
20+
mww 0x80040100 480
21+
# normally we shoul waiting here until we get 0x1 (0x80040104)&0x1)==0x0)
22+
sleep 100
23+
24+
# select PLL as main source
25+
mww 0x80040120 0x1
26+
# disable and enble main clk to update changes?
27+
mww 0x80040124 0x0
28+
mww 0x80040124 0x1
29+
30+
echo "Configure memory"
31+
#enable EMI CLK
32+
mww 0x80040024 0x40
33+
34+
# configure memory controller for internal SRAM
35+
mww 0x80700000 0x1188
36+
# change default emi clk delay
37+
mww 0x8004034C 0xA0503
38+
# make sure chip_select_register2_low has correct value (why?)
39+
mww 0x8070001c 0x20000000
40+
# set type to sdram and size to 32MB
41+
mww 0x8070005c 0xa
42+
# configure internal SDRAM timing
43+
mww 0x80700004 0x024996d9
44+
# configure Static Memory timing
45+
mww 0x80700094 0x00542b4f
46+
47+
echo "Configure uart4"
48+
# enable pinctrl clk
49+
mww 0x80040024 0x2000000
50+
# mux GPIO3_0 and GPIO3_1 to UART4
51+
mww 0x80044060 0x2
52+
mww 0x80044064 0x2
53+
# configure UART4CLKDIV
54+
mww 0x800401a8 0x1
55+
# enable uart4 clk
56+
mww 0x80040024 0x8000
57+
# clear softrst and clkgate on uart4
58+
mww 0x80010008 0xC0000000
59+
# set bandrate 115200 12M
60+
mww 0x80010030 0x00062070
61+
# enable Rx&Tx
62+
mww 0x80010024 0x301
63+
# clear hw control
64+
mww 0x80010028 0xc000
65+
}
66+
67+
$_TARGETNAME configure -work-area-phys 0x21ffe000 -work-area-virt 0xc1ffe000 -work-area-size 0x1000
68+
$_TARGETNAME arm7_9 fast_memory_access enable
69+
$_TARGETNAME arm7_9 dcc_downloads enable
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Cyclone V SocKit board
3+
# http://www.altera.com/b/arrow-sockit.html
4+
#
5+
# Software support page:
6+
# http://www.rocketboards.org/
7+
8+
# openocd does not currently support the on-board USB Blaster II.
9+
# Install the JTAG header and use a USB Blaster instead.
10+
interface usb_blaster
11+
12+
source [find target/altera_fpgasoc.cfg]
13+
14+
# If the USB Blaster II were supported, these settings would be needed
15+
#usb_blaster_vid_pid 0x6810 0x09fb
16+
#usb_blaster_device_desc "USB-Blaster II"
17+
18+
adapter_khz 100
19+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# DANGER!!!! early work in progress for this PCB/target.
2+
#
3+
# The most basic operations work well enough that it is
4+
# useful to have this in the repository for cooperation
5+
# alpha testing purposes.
6+
#
7+
# TI AM3517
8+
#
9+
# http://focus.ti.com/docs/prod/folders/print/am3517.html
10+
# http://processors.wiki.ti.com/index.php/Debug_Access_Port_(DAP)
11+
# http://processors.wiki.ti.com/index.php?title=How_to_Find_the_Silicon_Revision_of_your_OMAP35x
12+
13+
set CHIPTYPE "am35x"
14+
source [find target/amdm37x.cfg]
15+
16+
# The TI-14 JTAG connector does not have srst. CPU reset is handled in
17+
# hardware.
18+
reset_config trst_only
19+
20+
# "amdm37x_dbginit am35x.cpu" needs to be run after init.
21+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This board is from ARM and has an samsung s3c45101x01 chip
2+
3+
source [find target/samsung_s3c4510.cfg]
4+
5+
#
6+
# FIXME:
7+
# Add (A) sdram configuration
8+
# Add (B) flash cfi programing configuration
9+
#
10+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# http://wikidevi.com/wiki/ASUS_RT-N16
3+
#
4+
5+
set partition_list {
6+
CFE { Bootloader 0xbc000000 0x00040000 }
7+
firmware { "Kernel+rootfs" 0xbc040000 0x01fa0000 }
8+
nvram { "Config space" 0xbdfe0000 0x00020000 }
9+
}
10+
11+
source [find target/bcm4718.cfg]
12+
13+
# External 32MB NOR Flash (Macronix MX29GL256EHTI2I-90Q)
14+
set _FLASHNAME $_CHIPNAME.flash
15+
flash bank $_FLASHNAME cfi 0xbc000000 0x02000000 1 1 $_TARGETNAME x16_as_x8
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# http://wikidevi.com/wiki/Asus_RT-N66U
3+
#
4+
5+
echo "ATTENTION: you need to solder a 4.7-10k pullup resistor to pin 21 of flash IC"
6+
echo "to enable JTAG, see http://wl500g.info/album.php?albumid=28&attachmentid=8991 ,"
7+
echo "there is an unpopulated footprint near U8.\n"
8+
9+
set partition_list {
10+
CFE { Bootloader 0xbc000000 0x00040000 }
11+
firmware { "Kernel+rootfs" 0xbc040000 0x01fa0000 }
12+
nvram { "Config space" 0xbdfe0000 0x00020000 }
13+
}
14+
15+
source [find target/bcm4706.cfg]
16+
17+
# External 32MB NOR Flash (Spansion S29GL256P10TF101
18+
set _FLASHNAME $_CHIPNAME.flash
19+
flash bank $_FLASHNAME cfi 0xbc000000 0x02000000 2 2 $_TARGETNAME

0 commit comments

Comments
 (0)