Skip to content

Commit

Permalink
Added utility scripts to erase the NVM for SR6 devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Salvatore Messina committed Dec 20, 2024
1 parent 9484332 commit 8970559
Show file tree
Hide file tree
Showing 20 changed files with 1,093 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tcl/utility/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
this folder contains openocd scripts to full erase flash memory and check memory is fully erased


eg. to fully erase flash memory of spc582b (Chorus 1M):

open a dos command prompt and run following command:

C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_ALL.cfg

to check that all memory has been cleared use the following command

C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_CHECK.cfg



to flash an spc582b elf program the following command can be used:

C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f board\spc582b_dis.cfg -c "program blinkled_demo.elf reset exit"


be careful to use the right script for the device you are using
above command don't apply for elf file compiled to run from RAM


if your openocd installation come from SPC5Studio or StellarStudio the path above must be modified as follow

C:\SPC5Studio-6.0\openocd\bin\openocd.exe -d0 -s C:\SPC5Studio-6.0\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_ALL.cfg

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"

or

C:\StellarStudio-2.0\openocd\bin\openocd.exe -d0 -s C:\StellarStudio-2.0\openocd\scripts -f utility\sr5e1_evbe7000p_FLASH_ERASE_ALL.cfg

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"

61 changes: 61 additions & 0 deletions tcl/utility/SPC564B_program.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# SPC58NG-DISP Boards.
# https://www.st.com/en/evaluation-tools/spc58ng-disp.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

source [find target/spc564B.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 4000
adapter srst delay 100
adapter srst pulse_width 100

# C:\openOCD\openOCD.git\openocd\build\spc5\bin\openocd.exe -d0 -s C:\openOCD\openOCD.git\config\scripts -f utility\SPC564B_program.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

flash probe 0
puts -nonewline "TEST: flash probe 0 -> [flash probe 0]\n"
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]\n"
puts -nonewline "TEST: flash probe 2 -> [flash probe 2]\n"


puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts ""

puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts ""

puts -nonewline "TEST: flash info 2\n[flash info 2]"
puts ""



puts "TEST: flash erase_sector 0 0 last"
puts "[flash erase_sector 0 0 last]"

puts "TEST: flash erase_sector 1 0 last"
puts "[flash erase_sector 1 0 last]"

puts "TEST: flash erase_sector 2 0 last"
puts "[flash erase_sector 2 0 last]"


# puts "[flash write_image C:/Temp/out.elf]"
program c:/Temp/out.elf

reset init
resume

puts "TEST: Exit"
shutdown
44 changes: 44 additions & 0 deletions tcl/utility/spc582b_dis_FLASH_ERASE_ALL.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPC582B-DIS Boards.
# https://www.st.com/en/evaluation-tools/spc582b-dis.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

source [find target/spc582b.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 4000
adapter srst delay 100
adapter srst pulse_width 100

# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_ALL.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
puts ""

puts "TEST: flash banks\n[flash banks]"

puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts ""

puts "TEST: flash erase_sector 0 0 13"
puts "[flash erase_sector 0 0 13]"

puts "TEST: flash erase_sector 1 0 3"
puts "[flash erase_sector 1 0 3]"

puts "TEST: Exit"
shutdown
44 changes: 44 additions & 0 deletions tcl/utility/spc582b_dis_FLASH_ERASE_CHECK.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPC582B-DIS Boards.
# https://www.st.com/en/evaluation-tools/spc582b-dis.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

source [find target/spc582b.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 4000
adapter srst delay 100
adapter srst pulse_width 100

# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc582b_dis_FLASH_ERASE_CHECK.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
puts ""

puts "TEST: flash banks\n[flash banks]"

puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts ""

puts -nonewline "TEST: flash erase_check 0 -> "
puts "[flash erase_check 0]"

puts -nonewline "TEST: flash erase_check 1 -> "
puts "[flash erase_check 1]"

puts "TEST: Exit"
shutdown
46 changes: 46 additions & 0 deletions tcl/utility/spc584b_cut_12_dis_FLASH_ERASE_ALL.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPC584B-DIS Boards.
# https://www.st.com/en/evaluation-tools/spc584b-dis.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

set TAPID 0x20144041

source [find target/spc584b.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 2000
adapter srst delay 100
adapter srst pulse_width 100

# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc584b_cut_12_dis_FLASH_ERASE_ALL.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
puts ""

puts "TEST: flash banks\n[flash banks]"

puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts ""

puts "TEST: flash erase_sector 0 0 12"
puts "[flash erase_sector 0 0 12]"

puts "TEST: flash erase_sector 1 0 1"
puts "[flash erase_sector 1 0 1]"

puts "TEST: Exit"
shutdown
46 changes: 46 additions & 0 deletions tcl/utility/spc584b_cut_12_dis_FLASH_ERASE_CHECK.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPC584B-DIS Boards.
# https://www.st.com/en/evaluation-tools/spc584b-dis.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

set TAPID 0x20144041

source [find target/spc584b.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 2000
adapter srst delay 100
adapter srst pulse_width 100

# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc584b_cut_12_dis_FLASH_ERASE_CHECK.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

puts -nonewline "TEST: flash probe 0 -> [flash probe 0]"
puts -nonewline "TEST: flash probe 1 -> [flash probe 1]"
puts ""

puts "TEST: flash banks\n[flash banks]"

puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts ""

puts -nonewline "TEST: flash erase_check 0 -> "
puts "[flash erase_check 0]"

puts -nonewline "TEST: flash erase_check 1 -> "
puts "[flash erase_check 1]"

puts "TEST: Exit"
shutdown
56 changes: 56 additions & 0 deletions tcl/utility/spc58ec_dis_FLASH_ERASE_ALL.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPC58EC-DIS Boards.
# https://www.st.com/en/evaluation-tools/spc58ec-dis.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

set TAPID 0x01142041

source [find target/spc58xc.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 4000
adapter srst delay 100
adapter srst pulse_width 100

# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc58ec_dis_FLASH_ERASE_ALL.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

puts "TEST: flash probe 0 -> [flash probe 0]"
puts "TEST: flash probe 1 -> [flash probe 1]"
puts "TEST: flash probe 2 -> [flash probe 2]"
puts "TEST: flash probe 3 -> [flash probe 3]"
puts ""

puts "TEST: flash banks\n[flash banks]"

puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts -nonewline "TEST: flash info 2\n[flash info 2]"
puts -nonewline "TEST: flash info 3\n[flash info 3]"
puts ""

puts "TEST: flash erase_sector 0 0 23"
puts "[flash erase_sector 0 0 23]"

puts "TEST: flash erase_sector 1 0 2"
puts "[flash erase_sector 1 0 2]"

puts "TEST: flash erase_sector 2 0 1"
puts "[flash erase_sector 2 0 1]"

puts "TEST: flash erase_sector 3 0 3"
puts "[flash erase_sector 3 0 3]"

puts "TEST: Exit"
shutdown
56 changes: 56 additions & 0 deletions tcl/utility/spc58ec_dis_FLASH_ERASE_CHECK.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPC58EC-DIS Boards.
# https://www.st.com/en/evaluation-tools/spc58ec-dis.html

source [find interface/ftdi/stellarlink.cfg]

transport select jtag

set TAPID 0x01142041

source [find target/spc58xc.cfg]

# use hardware reset
reset_config trst_and_srst

# reasonable default
adapter speed 4000
adapter srst delay 100
adapter srst pulse_width 100

# C:\StellarLINK\openocd\bin\openocd.exe -d0 -s C:\StellarLINK\openocd\scripts -f utility\spc58ec_dis_FLASH_ERASE_CHECK.cfg

init
catch {halt}
catch {reset init}
catch {halt}

puts "\nTEST: Reset init and halt: [reg pc]"

puts "TEST: flash probe 0 -> [flash probe 0]"
puts "TEST: flash probe 1 -> [flash probe 1]"
puts "TEST: flash probe 2 -> [flash probe 2]"
puts "TEST: flash probe 3 -> [flash probe 3]"
puts ""

puts "TEST: flash banks\n[flash banks]"

puts -nonewline "TEST: flash info 0\n[flash info 0]"
puts -nonewline "TEST: flash info 1\n[flash info 1]"
puts -nonewline "TEST: flash info 2\n[flash info 2]"
puts -nonewline "TEST: flash info 3\n[flash info 3]"
puts ""

puts -nonewline "TEST: flash erase_check 0 -> "
puts "[flash erase_check 0]"

puts -nonewline "TEST: flash erase_check 1 -> "
puts "[flash erase_check 1]"

puts -nonewline "TEST: flash erase_check 2 -> "
puts "[flash erase_check 2]"

puts -nonewline "TEST: flash erase_check 3 -> "
puts "[flash erase_check 3]"

puts "TEST: Exit"
shutdown
Loading

0 comments on commit 8970559

Please sign in to comment.