Skip to content

Commit 8970559

Browse files
author
Salvatore Messina
committed
Added utility scripts to erase the NVM for SR6 devices
1 parent 9484332 commit 8970559

20 files changed

Lines changed: 1093 additions & 0 deletions

tcl/utility/README.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
this folder contains openocd scripts to full erase flash memory and check memory is fully erased
2+
3+
4+
eg. to fully erase flash memory of spc582b (Chorus 1M):
5+
6+
open a dos command prompt and run following command:
7+
8+
C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_ALL.cfg
9+
10+
to check that all memory has been cleared use the following command
11+
12+
C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_CHECK.cfg
13+
14+
15+
16+
to flash an spc582b elf program the following command can be used:
17+
18+
C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f board\spc582b_dis.cfg -c "program blinkled_demo.elf reset exit"
19+
20+
21+
be careful to use the right script for the device you are using
22+
above command don't apply for elf file compiled to run from RAM
23+
24+
25+
if your openocd installation come from SPC5Studio or StellarStudio the path above must be modified as follow
26+
27+
C:\SPC5Studio-6.0\openocd\bin\openocd.exe -d0 -s C:\SPC5Studio-6.0\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_ALL.cfg
28+
29+
C:\SPC5Studio-6.0\openocd\bin\openocd.exe -d0 -s C:\SPC5Studio-6.0\openocd\scripts -f board\spc582b_dis.cfg -c "program blinkled_demo.elf reset exit"
30+
31+
or
32+
33+
C:\StellarStudio-2.0\openocd\bin\openocd.exe -d0 -s C:\StellarStudio-2.0\openocd\scripts -f utility\sr5e1_evbe7000p_FLASH_ERASE_ALL.cfg
34+
35+
C:\StellarStudio-2.0\openocd\bin\openocd.exe -d0 -s C:\StellarStudio-2.0\openocd\scripts -f board\sr5e1_evbe7000p.cfg -c "program blinkled_portE13.elf reset exit"
36+

tcl/utility/SPC564B_program.cfg

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# SPC58NG-DISP Boards.
2+
# https://www.st.com/en/evaluation-tools/spc58ng-disp.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
source [find target/spc564B.cfg]
9+
10+
# use hardware reset
11+
reset_config trst_and_srst
12+
13+
# reasonable default
14+
adapter speed 4000
15+
adapter srst delay 100
16+
adapter srst pulse_width 100
17+
18+
# C:\openOCD\openOCD.git\openocd\build\spc5\bin\openocd.exe -d0 -s C:\openOCD\openOCD.git\config\scripts -f utility\SPC564B_program.cfg
19+
20+
init
21+
catch {halt}
22+
catch {reset init}
23+
catch {halt}
24+
25+
puts "\nTEST: Reset init and halt: [reg pc]"
26+
27+
flash probe 0
28+
puts -nonewline "TEST: flash probe 0 -> [flash probe 0]\n"
29+
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]\n"
30+
puts -nonewline "TEST: flash probe 2 -> [flash probe 2]\n"
31+
32+
33+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
34+
puts ""
35+
36+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
37+
puts ""
38+
39+
puts -nonewline "TEST: flash info 2\n[flash info 2]"
40+
puts ""
41+
42+
43+
44+
puts "TEST: flash erase_sector 0 0 last"
45+
puts "[flash erase_sector 0 0 last]"
46+
47+
puts "TEST: flash erase_sector 1 0 last"
48+
puts "[flash erase_sector 1 0 last]"
49+
50+
puts "TEST: flash erase_sector 2 0 last"
51+
puts "[flash erase_sector 2 0 last]"
52+
53+
54+
# puts "[flash write_image C:/Temp/out.elf]"
55+
program c:/Temp/out.elf
56+
57+
reset init
58+
resume
59+
60+
puts "TEST: Exit"
61+
shutdown
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPC582B-DIS Boards.
2+
# https://www.st.com/en/evaluation-tools/spc582b-dis.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
source [find target/spc582b.cfg]
9+
10+
# use hardware reset
11+
reset_config trst_and_srst
12+
13+
# reasonable default
14+
adapter speed 4000
15+
adapter srst delay 100
16+
adapter srst pulse_width 100
17+
18+
# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_ALL.cfg
19+
20+
init
21+
catch {halt}
22+
catch {reset init}
23+
catch {halt}
24+
25+
puts "\nTEST: Reset init and halt: [reg pc]"
26+
27+
puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
28+
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
29+
puts ""
30+
31+
puts "TEST: flash banks\n[flash banks]"
32+
33+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
34+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
35+
puts ""
36+
37+
puts "TEST: flash erase_sector 0 0 13"
38+
puts "[flash erase_sector 0 0 13]"
39+
40+
puts "TEST: flash erase_sector 1 0 3"
41+
puts "[flash erase_sector 1 0 3]"
42+
43+
puts "TEST: Exit"
44+
shutdown
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPC582B-DIS Boards.
2+
# https://www.st.com/en/evaluation-tools/spc582b-dis.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
source [find target/spc582b.cfg]
9+
10+
# use hardware reset
11+
reset_config trst_and_srst
12+
13+
# reasonable default
14+
adapter speed 4000
15+
adapter srst delay 100
16+
adapter srst pulse_width 100
17+
18+
# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_CHECK.cfg
19+
20+
init
21+
catch {halt}
22+
catch {reset init}
23+
catch {halt}
24+
25+
puts "\nTEST: Reset init and halt: [reg pc]"
26+
27+
puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
28+
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
29+
puts ""
30+
31+
puts "TEST: flash banks\n[flash banks]"
32+
33+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
34+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
35+
puts ""
36+
37+
puts -nonewline "TEST: flash erase_check 0 -> "
38+
puts "[flash erase_check 0]"
39+
40+
puts -nonewline "TEST: flash erase_check 1 -> "
41+
puts "[flash erase_check 1]"
42+
43+
puts "TEST: Exit"
44+
shutdown
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPC584B-DIS Boards.
2+
# https://www.st.com/en/evaluation-tools/spc584b-dis.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
set TAPID 0x20144041
9+
10+
source [find target/spc584b.cfg]
11+
12+
# use hardware reset
13+
reset_config trst_and_srst
14+
15+
# reasonable default
16+
adapter speed 2000
17+
adapter srst delay 100
18+
adapter srst pulse_width 100
19+
20+
# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc584b_cut_12_dis_FLASH_ERASE_ALL.cfg
21+
22+
init
23+
catch {halt}
24+
catch {reset init}
25+
catch {halt}
26+
27+
puts "\nTEST: Reset init and halt: [reg pc]"
28+
29+
puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
30+
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
31+
puts ""
32+
33+
puts "TEST: flash banks\n[flash banks]"
34+
35+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
36+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
37+
puts ""
38+
39+
puts "TEST: flash erase_sector 0 0 12"
40+
puts "[flash erase_sector 0 0 12]"
41+
42+
puts "TEST: flash erase_sector 1 0 1"
43+
puts "[flash erase_sector 1 0 1]"
44+
45+
puts "TEST: Exit"
46+
shutdown
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPC584B-DIS Boards.
2+
# https://www.st.com/en/evaluation-tools/spc584b-dis.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
set TAPID 0x20144041
9+
10+
source [find target/spc584b.cfg]
11+
12+
# use hardware reset
13+
reset_config trst_and_srst
14+
15+
# reasonable default
16+
adapter speed 2000
17+
adapter srst delay 100
18+
adapter srst pulse_width 100
19+
20+
# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc584b_cut_12_dis_FLASH_ERASE_CHECK.cfg
21+
22+
init
23+
catch {halt}
24+
catch {reset init}
25+
catch {halt}
26+
27+
puts "\nTEST: Reset init and halt: [reg pc]"
28+
29+
puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
30+
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
31+
puts ""
32+
33+
puts "TEST: flash banks\n[flash banks]"
34+
35+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
36+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
37+
puts ""
38+
39+
puts -nonewline "TEST: flash erase_check 0 -> "
40+
puts "[flash erase_check 0]"
41+
42+
puts -nonewline "TEST: flash erase_check 1 -> "
43+
puts "[flash erase_check 1]"
44+
45+
puts "TEST: Exit"
46+
shutdown
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# SPC58EC-DIS Boards.
2+
# https://www.st.com/en/evaluation-tools/spc58ec-dis.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
set TAPID 0x01142041
9+
10+
source [find target/spc58xc.cfg]
11+
12+
# use hardware reset
13+
reset_config trst_and_srst
14+
15+
# reasonable default
16+
adapter speed 4000
17+
adapter srst delay 100
18+
adapter srst pulse_width 100
19+
20+
# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc58ec_dis_FLASH_ERASE_ALL.cfg
21+
22+
init
23+
catch {halt}
24+
catch {reset init}
25+
catch {halt}
26+
27+
puts "\nTEST: Reset init and halt: [reg pc]"
28+
29+
puts "TEST: flash probe 0 -> [flash probe 0]"
30+
puts "TEST: flash probe 1 -> [flash probe 1]"
31+
puts "TEST: flash probe 2 -> [flash probe 2]"
32+
puts "TEST: flash probe 3 -> [flash probe 3]"
33+
puts ""
34+
35+
puts "TEST: flash banks\n[flash banks]"
36+
37+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
38+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
39+
puts -nonewline "TEST: flash info 2\n[flash info 2]"
40+
puts -nonewline "TEST: flash info 3\n[flash info 3]"
41+
puts ""
42+
43+
puts "TEST: flash erase_sector 0 0 23"
44+
puts "[flash erase_sector 0 0 23]"
45+
46+
puts "TEST: flash erase_sector 1 0 2"
47+
puts "[flash erase_sector 1 0 2]"
48+
49+
puts "TEST: flash erase_sector 2 0 1"
50+
puts "[flash erase_sector 2 0 1]"
51+
52+
puts "TEST: flash erase_sector 3 0 3"
53+
puts "[flash erase_sector 3 0 3]"
54+
55+
puts "TEST: Exit"
56+
shutdown
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# SPC58EC-DIS Boards.
2+
# https://www.st.com/en/evaluation-tools/spc58ec-dis.html
3+
4+
source [find interface/ftdi/stellarlink.cfg]
5+
6+
transport select jtag
7+
8+
set TAPID 0x01142041
9+
10+
source [find target/spc58xc.cfg]
11+
12+
# use hardware reset
13+
reset_config trst_and_srst
14+
15+
# reasonable default
16+
adapter speed 4000
17+
adapter srst delay 100
18+
adapter srst pulse_width 100
19+
20+
# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc58ec_dis_FLASH_ERASE_CHECK.cfg
21+
22+
init
23+
catch {halt}
24+
catch {reset init}
25+
catch {halt}
26+
27+
puts "\nTEST: Reset init and halt: [reg pc]"
28+
29+
puts "TEST: flash probe 0 -> [flash probe 0]"
30+
puts "TEST: flash probe 1 -> [flash probe 1]"
31+
puts "TEST: flash probe 2 -> [flash probe 2]"
32+
puts "TEST: flash probe 3 -> [flash probe 3]"
33+
puts ""
34+
35+
puts "TEST: flash banks\n[flash banks]"
36+
37+
puts -nonewline "TEST: flash info 0\n[flash info 0]"
38+
puts -nonewline "TEST: flash info 1\n[flash info 1]"
39+
puts -nonewline "TEST: flash info 2\n[flash info 2]"
40+
puts -nonewline "TEST: flash info 3\n[flash info 3]"
41+
puts ""
42+
43+
puts -nonewline "TEST: flash erase_check 0 -> "
44+
puts "[flash erase_check 0]"
45+
46+
puts -nonewline "TEST: flash erase_check 1 -> "
47+
puts "[flash erase_check 1]"
48+
49+
puts -nonewline "TEST: flash erase_check 2 -> "
50+
puts "[flash erase_check 2]"
51+
52+
puts -nonewline "TEST: flash erase_check 3 -> "
53+
puts "[flash erase_check 3]"
54+
55+
puts "TEST: Exit"
56+
shutdown

0 commit comments

Comments
 (0)