You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by wb0gaz April 9, 2022
I'm editing this as my work today (4/9/2022) has yielded progress but led me to a specific problem preventing me from using the tool.
The problem I'm encountering is unable to flash device - the STLINK device itself is being detected, and it can detect the target device properly (chip ID 0x412), however, the two errors below tell me that st-flash may not be performing the task required of it.
I populated /usr/local/stlink/chips (which was not installed when I installed 1.7.0 .deb package) by copying the /chips/ directory to /usr/local/stlink/chips.
The target is STM32F103C6T6 low-density type (0x412), 32K flash, and is being correctly identified.
Below are sessions where I have attempted to erase the target device, and then attempted to read back from the target device (expecting erased flash, FF bytes.) I removed the prefix characters from comment lines in the chips file as this was interacting with HTML.
st-flash erase yields "Failed to parse flash type or unrecognized flash type" and does not appear to run.
$ st-flash --debug erase 0x08000000 4096
st-flash 1.7.0-186-gc4762e6
Failed to parse flash type or unrecognized flash type
2022-04-09T19:48:55 DEBUG common.c: *** looking up stlink version
2022-04-09T19:48:55 DEBUG common.c: st vid = 0x0483 (expect 0x0483)
2022-04-09T19:48:55 DEBUG common.c: stlink pid = 0x3748
2022-04-09T19:48:55 DEBUG common.c: stlink version = 0x2
2022-04-09T19:48:55 DEBUG common.c: jtag version = 0x1d
2022-04-09T19:48:55 DEBUG common.c: swim version = 0x7
2022-04-09T19:48:55 DEBUG common.c: stlink current mode: mass
2022-04-09T19:48:55 DEBUG usb.c: JTAG/SWD freq set to 0
2022-04-09T19:48:55 DEBUG common.c: stlink current mode: mass
2022-04-09T19:48:55 DEBUG common.c: *** stlink_enter_swd_mode ***
2022-04-09T19:48:55 DEBUG common.c: Loading device parameters....
2022-04-09T19:48:55 DEBUG common.c: *** stlink_core_id ***
2022-04-09T19:48:55 DEBUG common.c: core_id = 0x1ba01477
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_read_debug32 0x411fc231 at 0xe000ed00
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_read_debug32 0x10006412 at 0xe0042000
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_read_debug32 0000000000 at 0x1ffff7e0
2022-04-09T19:57:12 INFO common.c: STM32F1xx_LD: 10 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
2022-04-09T19:57:12 DEBUG common.c: *** stlink_force_debug_mode ***
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_read_debug32 0x00000300 at 0xe0042004
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_write_debug32 0x00000300 to 0xe0042004
2022-04-09T19:57:12 DEBUG common.c: *** stlink_status ***
2022-04-09T19:57:12 DEBUG usb.c: core status: 02010001
2022-04-09T19:57:12 DEBUG common.c: core status: reset
2022-04-09T19:57:12 INFO common.c: read from address 0x08000000 size 32768
2022-04-09T19:57:12 DEBUG common.c: *** stlink_exit_debug_mode ***
2022-04-09T19:57:12 DEBUG common.c: *** stlink_close ***
$
Expect command to generate read.bin of length 32768 bytes filled with FF bytes
$ ls -l read.bin
-rwx------ 1 user user 0 Apr 9 19:57 read.bin
$
Now read again, but this time with --flash=32k option (and debug disabled). The file now contains the expected number of data bytes, however, the data bytes are 00 rather than FF.
2022-04-09T19:59:59 INFO common.c: STM32F1xx_LD: 10 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
Forcing flash size: --flash=0x00008000
2022-04-09T19:59:59 INFO common.c: read from address 0x08000000 size 32768
$
Resulting file:
$ ls -l read.bin
-rwx------ 1 user user 32768 Apr 9 19:59 read.bin
$
Discussed in #1242
Originally posted by wb0gaz April 9, 2022
I'm editing this as my work today (4/9/2022) has yielded progress but led me to a specific problem preventing me from using the tool.
The problem I'm encountering is unable to flash device - the STLINK device itself is being detected, and it can detect the target device properly (chip ID 0x412), however, the two errors below tell me that st-flash may not be performing the task required of it.
I populated /usr/local/stlink/chips (which was not installed when I installed 1.7.0 .deb package) by copying the /chips/ directory to /usr/local/stlink/chips.
The target is STM32F103C6T6 low-density type (0x412), 32K flash, and is being correctly identified.
Below are sessions where I have attempted to erase the target device, and then attempted to read back from the target device (expecting erased flash, FF bytes.) I removed the prefix characters from comment lines in the chips file as this was interacting with HTML.
st-flash erase yields "Failed to parse flash type or unrecognized flash type" and does not appear to run.
$ st-flash --debug erase 0x08000000 4096
st-flash 1.7.0-186-gc4762e6
Failed to parse flash type or unrecognized flash type
2022-04-09T19:48:55 DEBUG common.c: *** looking up stlink version
2022-04-09T19:48:55 DEBUG common.c: st vid = 0x0483 (expect 0x0483)
2022-04-09T19:48:55 DEBUG common.c: stlink pid = 0x3748
2022-04-09T19:48:55 DEBUG common.c: stlink version = 0x2
2022-04-09T19:48:55 DEBUG common.c: jtag version = 0x1d
2022-04-09T19:48:55 DEBUG common.c: swim version = 0x7
2022-04-09T19:48:55 DEBUG common.c: stlink current mode: mass
2022-04-09T19:48:55 DEBUG usb.c: JTAG/SWD freq set to 0
2022-04-09T19:48:55 DEBUG common.c: stlink current mode: mass
2022-04-09T19:48:55 DEBUG common.c: *** stlink_enter_swd_mode ***
2022-04-09T19:48:55 DEBUG common.c: Loading device parameters....
2022-04-09T19:48:55 DEBUG common.c: *** stlink_core_id ***
2022-04-09T19:48:55 DEBUG common.c: core_id = 0x1ba01477
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_read_debug32 0x411fc231 at 0xe000ed00
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_read_debug32 0x10006412 at 0xe0042000
detected chip_id parametres
Device Type: STM32F1xx_LD
Reference Manual: RM0008
chip_id 0x412
flash_type 1
flash_size_reg 0x1ffff7e0
flash_pagesize 0x400
sram_size 0x2800
bootrom_base 0x1ffff000
bootrom_size 0x800
option_base 0x1ffff800
option_size 0x10
flags 2
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_read_debug32 0000000000 at 0x1ffff7e0
2022-04-09T19:48:55 INFO common.c: STM32F1xx_LD: 10 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
2022-04-09T19:48:55 DEBUG common.c: *** stlink_force_debug_mode ***
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_read_debug32 0x00000300 at 0xe0042004
2022-04-09T19:48:55 DEBUG read_write.c: *** stlink_write_debug32 0x00000300 to 0xe0042004
2022-04-09T19:48:55 DEBUG common.c: *** stlink_status ***
2022-04-09T19:48:55 DEBUG usb.c: core status: 02010001
2022-04-09T19:48:55 DEBUG common.c: core status: reset
2022-04-09T19:48:55 ERROR common_flash.c: Invalid address, it should be within 0x08000000 - 0x07ffffff
stlink_erase_flash_mass() == -1
2022-04-09T19:48:55 DEBUG common.c: *** stlink_exit_debug_mode ***
2022-04-09T19:48:55 DEBUG common.c: *** stlink_close ***
$
st-flash --flash=32k still yields "Failed to parse flash type or unrecognized flash type" but appears to run.
$ st-flash --flash=32k erase 0x08000000 4096
st-flash 1.7.0-186-gc4762e6
Failed to parse flash type or unrecognized flash type
detected chip_id parametres
Device Type: STM32F1xx_LD
Reference Manual: RM0008
chip_id 0x412
flash_type 1
flash_size_reg 0x1ffff7e0
flash_pagesize 0x400
sram_size 0x2800
bootrom_base 0x1ffff000
bootrom_size 0x800
option_base 0x1ffff800
option_size 0x10
flags 2
2022-04-09T19:51:06 INFO common.c: STM32F1xx_LD: 10 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
Forcing flash size: --flash=0x00008000
-> Flash page at 0x8000000 erased (size: 0x400)
-> Flash page at 0x8000400 erased (size: 0x400)
-> Flash page at 0x8000800 erased (size: 0x400)
-> Flash page at 0x8000c00 erased (size: 0x400)
$
After erase, expect FF bytes, however, without --flash=32k option, the read file contains no data bytes.
$ st-flash --debug read read.bin 0x08000000 32768
st-flash 1.7.0-186-gc4762e6
Failed to parse flash type or unrecognized flash type
2022-04-09T19:57:12 DEBUG common.c: *** looking up stlink version
2022-04-09T19:57:12 DEBUG common.c: st vid = 0x0483 (expect 0x0483)
2022-04-09T19:57:12 DEBUG common.c: stlink pid = 0x3748
2022-04-09T19:57:12 DEBUG common.c: stlink version = 0x2
2022-04-09T19:57:12 DEBUG common.c: jtag version = 0x1d
2022-04-09T19:57:12 DEBUG common.c: swim version = 0x7
2022-04-09T19:57:12 DEBUG common.c: stlink current mode: mass
2022-04-09T19:57:12 DEBUG usb.c: JTAG/SWD freq set to 0
2022-04-09T19:57:12 DEBUG common.c: stlink current mode: mass
2022-04-09T19:57:12 DEBUG common.c: *** stlink_enter_swd_mode ***
2022-04-09T19:57:12 DEBUG common.c: Loading device parameters....
2022-04-09T19:57:12 DEBUG common.c: *** stlink_core_id ***
2022-04-09T19:57:12 DEBUG common.c: core_id = 0x1ba01477
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_read_debug32 0x411fc231 at 0xe000ed00
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_read_debug32 0x10006412 at 0xe0042000
detected chip_id parametres
Device Type: STM32F1xx_LD
Reference Manual: RM0008
chip_id 0x412
flash_type 1
flash_size_reg 0x1ffff7e0
flash_pagesize 0x400
sram_size 0x2800
bootrom_base 0x1ffff000
bootrom_size 0x800
option_base 0x1ffff800
option_size 0x10
flags 2
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_read_debug32 0000000000 at 0x1ffff7e0
2022-04-09T19:57:12 INFO common.c: STM32F1xx_LD: 10 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
2022-04-09T19:57:12 DEBUG common.c: *** stlink_force_debug_mode ***
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_read_debug32 0x00000300 at 0xe0042004
2022-04-09T19:57:12 DEBUG read_write.c: *** stlink_write_debug32 0x00000300 to 0xe0042004
2022-04-09T19:57:12 DEBUG common.c: *** stlink_status ***
2022-04-09T19:57:12 DEBUG usb.c: core status: 02010001
2022-04-09T19:57:12 DEBUG common.c: core status: reset
2022-04-09T19:57:12 INFO common.c: read from address 0x08000000 size 32768
2022-04-09T19:57:12 DEBUG common.c: *** stlink_exit_debug_mode ***
2022-04-09T19:57:12 DEBUG common.c: *** stlink_close ***
$
Expect command to generate read.bin of length 32768 bytes filled with FF bytes
$ ls -l read.bin
-rwx------ 1 user user 0 Apr 9 19:57 read.bin
$
Now read again, but this time with --flash=32k option (and debug disabled). The file now contains the expected number of data bytes, however, the data bytes are 00 rather than FF.
$ st-flash --flash=32k read read.bin 0x08000000 32768
st-flash 1.7.0-186-gc4762e6
Failed to parse flash type or unrecognized flash type
detected chip_id parametres
Device Type: STM32F1xx_LD
Reference Manual: RM0008
chip_id 0x412
flash_type 1
flash_size_reg 0x1ffff7e0
flash_pagesize 0x400
sram_size 0x2800
bootrom_base 0x1ffff000
bootrom_size 0x800
option_base 0x1ffff800
option_size 0x10
flags 2
2022-04-09T19:59:59 INFO common.c: STM32F1xx_LD: 10 KiB SRAM, 0 KiB flash in at least 1 KiB pages.
Forcing flash size: --flash=0x00008000
2022-04-09T19:59:59 INFO common.c: read from address 0x08000000 size 32768
$
Resulting file:
$ ls -l read.bin
-rwx------ 1 user user 32768 Apr 9 19:59 read.bin
$
File expected to contain FF bytes
$ xxd read.bin | more
00000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
The text was updated successfully, but these errors were encountered: