Edgar Grimberg wrote: > The default state of the flash after a reset init is unlocked. > The information in the flash driver reflects this. > > The information about the lock status cannot be read from the > flash chip, so the user is informed that flash info might not > contain accurate information. > > Signed-off-by: Edgar Grimberg <[email protected]> > --- > src/flash/nor/str7x.c | 5 +++-- > tcl/target/str710.cfg | 6 +++++- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c > index 040097a..0745496 100644 > --- a/src/flash/nor/str7x.c > +++ b/src/flash/nor/str7x.c > @@ -93,7 +93,7 @@ static int str7x_build_block_list(struct flash_bank *bank) > bank->sectors[num_sectors].offset = > mem_layout_str7bank0[i].sector_start; > bank->sectors[num_sectors].size = > mem_layout_str7bank0[i].sector_size; > bank->sectors[num_sectors].is_erased = -1; > - bank->sectors[num_sectors].is_protected = 1; > + bank->sectors[num_sectors].is_protected = 0; > str7x_info->sector_bits[num_sectors++] = > mem_layout_str7bank0[i].sector_bit; > } > > @@ -102,7 +102,7 @@ static int str7x_build_block_list(struct flash_bank *bank) > bank->sectors[num_sectors].offset = > mem_layout_str7bank1[i].sector_start; > bank->sectors[num_sectors].size = > mem_layout_str7bank1[i].sector_size; > bank->sectors[num_sectors].is_erased = -1; > - bank->sectors[num_sectors].is_protected = 1; > + bank->sectors[num_sectors].is_protected = 0; > str7x_info->sector_bits[num_sectors++] = > mem_layout_str7bank1[i].sector_bit; > } > > @@ -600,6 +600,7 @@ COMMAND_HANDLER(str7x_handle_part_id_command) > static int str7x_info(struct flash_bank *bank, char *buf, int buf_size) > { > snprintf(buf, buf_size, "str7x flash driver info"); > + LOG_WARNING("STR7x protect information is not reliable."); > return ERROR_OK; > } > > diff --git a/tcl/target/str710.cfg b/tcl/target/str710.cfg > index 9da69ac..10307e8 100644 > --- a/tcl/target/str710.cfg > +++ b/tcl/target/str710.cfg > @@ -30,7 +30,11 @@ set _TARGETNAME $_CHIPNAME.cpu > target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position > $_TARGETNAME -variant arm7tdmi > > $_TARGETNAME configure -event reset-start { jtag_khz 10 } > -$_TARGETNAME configure -event reset-init { jtag_khz 6000 } > +$_TARGETNAME configure -event reset-init { > + jtag_khz 6000 > + flash protect 0 0 last off > + flash protect 1 0 last off > +} > $_TARGETNAME configure -event gdb-flash-erase-start { > flash protect 0 0 7 off > flash protect 1 0 1 off
The protection state will never be known until a protection check is done anyway. The default state is more likely to be unprotected (factory default), as few users set the write protection anyway. Issuing a warning about the str7 protection status is a bit misleading. It is 'valid' after a reset, but any changes after the reset are not reflected in the flash info cmd. The gdb-flash-erase-start can be removed as you are already removing the protection in the reset init script. Cheers Spen _______________________________________________ Openocd-development mailing list [email protected] https://lists.berlios.de/mailman/listinfo/openocd-development
