-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunbrick.cfg
89 lines (63 loc) · 2.42 KB
/
unbrick.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# 2021-11-22 pds initial cut
# 2022-03-24 pds mod asic_ram_load and asic_rom_load for deprecations: brace args of expr; replace mem2array with read_memory
# 2022-06-15 pds create unbrick.cfg
#---------- interface/ftdi/olimex-arm-usb-tiny-h.cfg ---------------------
# Olimex ARM-USB-TINY-H
adapter driver ftdi
ftdi device_desc "Olimex OpenOCD JTAG ARM-USB-TINY-H"
ftdi vid_pid 0x15ba 0x002a
#ftdi layout_init 0x0808 0x0a1b ;# BUG!!! tiny 10us glitch on nTRST at startup
ftdi layout_init 0x0b08 0x0b1b ;# BUG FIX: rst lines (out) and (push-pull)
ftdi layout_signal nSRST -oe 0x0200
ftdi layout_signal nTRST -data 0x0100 -oe 0x0100
ftdi layout_signal LED -data 0x0800
#---------- interface/ftdi/olimex-arm-usb-tiny-h.cfg ---------------------
#-------------------------------------------
#
# USAGE
#
# openocd -f interface/xxx/xxx.cfg <-- the hardware connections (optional, with above)
# -f unbrick.cfg <-- the target device (this file)
# -c shutdown -c exit <-- optional, without gdb debugger
#-------------------------------------------
# override on command line with -c option
# as needed to change speed or make interactive session
adapter speed 500
gdb_port 3333 ;# 3333 or 'disabled'
tcl_port disabled ;# 6666 or 'disabled'
telnet_port disabled ;# 4444 or 'disabled'
#------------- fe310-g002.cfg -------------------------
#
# TARGET
#
transport select jtag
#
# SiFive FE310-G002 is "riscv" with cpuid "0x20000913"
#
jtag newtap riscv cpu -irlen 5 -expected-id 0x20000913 -ignore-version -ignore-bypass
target create riscv.cpu.0 riscv -chain-position riscv.cpu -coreid 0
riscv.cpu.0 configure -work-area-phys 0x80000000 -work-area-size 0x10000 -work-area-backup 0
flash bank spi0 fespi 0x20000000 0 0 0 riscv.cpu.0 0x10014000
#----- unbricking steps here
reset_config none
init
halt
#mww 0x10008004 0x40000000 ;# HFXOSCCFG::hfxoscen[30]=1 enable ext xtal
#mww 0x10008008 0x00040000 ;# PLLCFG::pllbypass[18]=1 bypass pll
#-----
#----- RAM
#-----
echo [load_image main-ram.bin 0x80000000 bin]
echo [verify_image main-ram.bin 0x80000000 bin]
echo [resume 0x80000000]
#-----
#----- ROM
#-----
#echo [flash protect 0 0 2 off]
#echo [flash erase_sector 0 0 2]
##echo [flash write_bank 0 main-rom.bin]
##echo [flash verify_bank 0 main-rom.bin]
#echo [flash protect 0 0 2 on]
#echo [resume 0x20000000]
#shutdown ;# optional, without gdb debugger
#exit ;# optional, without gdb debugger