Hi.
I ran into different problems today and lost amounts of time on them. Here they are:
- first, the bank numbers. In OpenOCD, there is only one bank for STR7X, having sectors 0 to 9. The STR7x is designed with 2 banks, bank 0 with sectors 0-7 and bank one with sector 0-1. If you try, after having patched 0x10 to 0x100, and try to do 'flash erase 0 0 9', it will fail: it seems that the STR7x refuses to erase sectors in both banks at the same time. The flash error register (FLASH_ER) is then set to 0x00000041. So to be the closest to the datasheet, I suggest that Openocd defines 2 banks for STR7X, so no one like me will spend hours trying to erase sectors in different banks at the same time even when the correct bits in the correct registers are correctly set
Note also that in the current version, there is no error message if FLASH_ER is set to 0x41: only the timing difference between a successfull erase or a failed one (the successfull is longer!) tells the user that the operation went fine or not.
- Then Openocd does not clean FLASH_ER before doing flash operations: if this register is not null, all flash operations will fail! So you do a mistake once, or the tested program on the target leaves the register dirty and then you can try anything, no flash command will correctly work afterward! I suggest that all flash operations start by cleaning FLASH_ER to zero.
- The STR7 supports two kind of protections: write protection and debug protection. Instead of 'protected', can we have 'write (un)protected' in the 'flash info' report?
- Someone working with me is seeing how to speed up the write process (with the 'ram' trick. In fact the time is spend expecting results from the USB, he found a 6ms between two queries. It appears that the 'ram' speedup is a speedup because registers' flags will be processed inside the chip and not in openocd so queries over USB will be much less numerous).
Bernard