I am using command:
~~~
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink.cfg -c 
"transport select hla_swd" -c "hla_serial 066AFF323535474B43082644" -f 
/opt/openocd/scripts/target/stm32f1x.cfg -c init -c "reset halt" -c "flash 
erase_address 0x08000000 0xC0000" -c reset -c exit
~~~
The console output:
~~~
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink.cfg -c 
"transport select hla_swd" -c "hla_serial 0671FF515455777867021019" -f 
/opt/openocd/scripts/target/stm32f1x_orig.cfg -c init -c "reset halt" -c 
"wait_halt" -c "flash erase_address 0x08000000 0xC0000" -c reset -c exit
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-12-07-17:30)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
hla_swd
DEPRECATED! use 'adapter serial' not 'hla_serial'
Info : The selected transport took over low-level target control. The results 
might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events 
{pre,post}-{enable,disable}
Info : clock speed 1000 kHz
Info : STLINK V2J36M26 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.250752
Info : stm32f1x.cpu: Cortex-M3 r1p1 processor detected
Info : stm32f1x.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fffedcc msp: 0x200003dc
Info : device id = 0x10006430
Info : flash size = 512kbytes
Error: No flash at address 0x08080000
~~~
Next step: manually added 
set FLASH_SIZE 0xC0000
After this, looks like evrything is fine
Log output:
~~~
$ /opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink.cfg -c 
"transport select hla_swd" -c "hla_serial 0671FF515455777867021019" -f 
/opt/openocd/scripts/target/stm32f1x_orig.cfg -c init -c "reset halt" -c 
"wait_halt" -c "flash erase_address 0x08000000 0xC0000" -c reset -c exit
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-12-07-17:30)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
hla_swd
DEPRECATED! use 'adapter serial' not 'hla_serial'
Info : The selected transport took over low-level target control. The results 
might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events 
{pre,post}-{enable,disable}
Info : clock speed 1000 kHz
Info : STLINK V2J36M26 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.250752
Info : stm32f1x.cpu: Cortex-M3 r1p1 processor detected
Info : stm32f1x.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fffedcc msp: 0x200003dc
Info : device id = 0x10006430
Info : ignoring flash probed value, using configured bank size
Info : flash size = 768kbytes
erased address 0x08000000 (length 786432) in 0.025483s (30137.740 KiB/s)
~~~

But...
if I will check status of the Flash by using ST-Link -- start from the 
0x08080000 flash was not erased

additional configuration in to the **scripts/target/stm32f1x_orig.cfg** -- 
fixed issue with Erase
~~~
flash bank $_CHIPNAME.bank1.cpu stm32f1x 0x08000000 0 0 0 $_TARGETNAME
flash bank $_CHIPNAME.bank2.cpu stm32f1x 0x08080000 0 0 0 $_TARGETNAME
~~~
Log output:
~~~
$ /opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink.cfg -c 
"transport select hla_swd" -c "hla_serial 0671FF515455777867021019" -f 
/opt/openocd/scripts/target/stm32f1x.cfg -c init -c "reset halt" -c "wait_halt" 
-c "flash erase_address 0x08000000 0xC0000" -c reset -c exit
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-12-07-17:30)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
hla_swd
DEPRECATED! use 'adapter serial' not 'hla_serial'
Info : The selected transport took over low-level target control. The results 
might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events 
{pre,post}-{enable,disable}
Info : clock speed 1000 kHz
Info : STLINK V2J36M26 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.247613
Info : stm32f1x.cpu: Cortex-M3 r1p1 processor detected
Info : stm32f1x.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fffedcc msp: 0x200003dc
Info : device id = 0x10006430
Info : flash size = 512kbytes
Info : device id = 0x10006430
Info : flash size = 256kbytes
erased address 0x08000000 (length 786432) in 0.052616s (14596.320 KiB/s)
~~~

But...
Another issue with Programming has been detected when I am trying to program 
Log output:
~~~
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink.cfg -c 
"transport select hla_swd" -c "hla_serial 0671FF515455777867021019" -f 
/opt/openocd/scripts/target/stm32f1x.cfg -c init -c "reset halt" -c "wait_halt" 
-c "flash write_image image.hex 0 ihex" -c "reset" -c "exit"
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df 
(2020-06-26-09:27)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Warn : ignoring extra IDs in hla_vid_pid (maximum is 8 pairs)
hla_swd
Info : The selected transport took over low-level target control. The results 
might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J36M26 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.250752
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x1fffedcc msp: 0x200003dc
Info : device id = 0x10006430
Info : flash size = 512kbytes
Error: timed out while waiting for target halted
Error: timed out while waiting for target halted
Error: error waiting for target flash write algorithm
Error: error writing to flash at address 0x08000000 at offset 0x0000000
~~~





---

** [tickets:#333] STM32F103RF: Unable to erase full chip**

**Status:** new
**Milestone:** 0.11.0
**Created:** Tue Jan 18, 2022 10:46 PM UTC by Artem Kravchenko
**Last Updated:** Tue Jan 18, 2022 10:46 PM UTC
**Owner:** nobody


Unable to erase full chip: STM32F103RF

Chip has flash with size 0xC0000 but OpenOCD is capible erace only the first 
0x80000


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to