Good day,
I’m running a ST ARM9, the STR912FAW44 (512k flash, 96k SRAM).
It seems asif many of the OpenOCD command have interdependencies that isn’t necessarily reflected in the error codes when command fail.
I’ve listed my findings below. Would it be possible to add dependency checking in the command interpreter of OpenOCD? This might help to guide novice users to OpenOCD to quickly narrow down why things aren’t working as expected and also reduce the traffic on the mailing list regarding unnecessary errors due to incomplete configurations.
Regards,
Frikkie Thirion
Here goes:
str9x flash_config 0 4 2 0 0x80000
The server configuration script “$ocd/lib/openocd/target/str912.cfg” already contains the flash layout:
flash bank str9x 0x00000000 0x00080000 0 0 0
flash bank str9x 0x00080000 0x00008000 0 0 0
It is unclear to me why the ‘str9x flash_config’ command must also be issued in the client session. If the “flash_config” line isn’t issued from the client, then many of
the problems in the following section appear:
Interdependency between “flash protect_check” and “str9x flash_config”
flash protect_check 0
All OK: (‘flash_config’ was applied)
successfully checked protect state
Error: (‘flash_config’ was not applied)
memory read caused data abort (address: 0x00080010, size: 0x2, count: 0x1)
unknown error when checking protection state of flash bank ‘#0’ at 0x00000000
Interdependency between “flash info” and “flash protect_check”
flash protect 0 0 4 off
cleared protection for sectors 0 through 4 on flash bank 0
flash info 0
Error: (Sectors 0…4 still reported as protected)
#0: str9x at 0x00000000, size 0x00080000, buswidth 0, chipwidth 0
0: 0x00000000 (0x10000 64kB) protected
1: 0x00010000 (0x10000 64kB) protected
2: 0x00020000 (0x10000 64kB) protected
3: 0x00030000 (0x10000 64kB) protected
4: 0x00040000 (0x10000 64kB) protected
5: 0x00050000 (0x10000 64kB) protected
6: 0x00060000 (0x10000 64kB) protected
7: 0x00070000 (0x10000 64kB) protected
str9x flash driver info
flash protect_check 0
successfully checked protect state
flash info 0
#0: str9x at 0x00000000, size 0x00080000, buswidth 0, chipwidth 0
0: 0x00000000 (0x10000 64kB) not protected
1: 0x00010000 (0x10000 64kB) not protected
2: 0x00020000 (0x10000 64kB) not protected
3: 0x00030000 (0x10000 64kB) not protected
4: 0x00040000 (0x10000 64kB) not protected
5: 0x00050000 (0x10000 64kB) protected
6: 0x00060000 (0x10000 64kB) protected
7: 0x00070000 (0x10000 64kB) protected
str9x flash driver info
interdependency between “flash erase_check” and “str9x flash_config”
flash erase_check 0
All OK: (‘flash_config’ was applied)
successfully checked erase state
0: 0x00000000 (0x10000 64kB) not erased
1: 0x00010000 (0x10000 64kB) erased
2: 0x00020000 (0x10000 64kB) erased
3: 0x00030000 (0x10000 64kB) erased
4: 0x00040000 (0x10000 64kB) erased
5: 0x00050000 (0x10000 64kB) erased
6: 0x00060000 (0x10000 64kB) erased
7: 0x00070000 (0x10000 64kB) erased
Error: (‘flash_config’ was not applied)
timed out while waiting for target halted
target not halted
Running slow fallback erase check - add working memory
Target not halted
unknown error when checking erase state of flash bank #0 at 0x00000000
0: 0x00000000 (0x10000 64kB) not erased
1: 0x00010000 (0x10000 64kB) erase state unknown
2: 0x00020000 (0x10000 64kB) erase state unknown
3: 0x00030000 (0x10000 64kB) erase state unknown
4: 0x00040000 (0x10000 64kB) erase state unknown
5: 0x00050000 (0x10000 64kB) erase state unknown
6: 0x00060000 (0x10000 64kB) erase state unknown
7: 0x00070000 (0x10000 64kB) erase state unknown
(Note: It reports that the target was not halted, even though it was placed into
halt before the command was issued)
Unclear error code for “flash erase_sector” when the sector is still write protected:
flash erase_sector 0 0 0
All OK:
erased sectors 0 through 0 on flash bank 0 in 1.171942s
Error:
error erasing flash bank, status: 0xa2
failed erasing sectors 0 to 0 (-902)
(Note: The sector is still write protected. First clear it with:
“flash protect 0 0 0 off”)
Interdependency between “flash write_image” and “str9x flash_config”
flash write_image main.hex 0 ihex
All OK: (‘flash_config’ was applied)
wrote 33788 byte from file main.hex in 2.924507s (11.282617 kb/s)
Error: (‘flash_config’ was not applied)
timed out while waiting for target halted
error executing str9x flash write algorithm
flash writing failed with error code: 0xfffffc7a
error writing to flash at address 0x00000000 at offset 0x00000000 (-902)
(Note: It reports that the target was not halted, even though it was placed
into halt before the command was issued)