On Fri, Jul 16, 2010 at 10:10 AM, gcembed <[email protected]> wrote:
> Hello,
> I am back.
> Andreas, can I add something in stm32x_mass_erase() like
>
> stm32x_read_options()
> if (protected) : unlock + reset
>
> continue with current code
> /* unlock option flash registers */
> target_write_u32(target, STM32_FLASH_KEYR, KEY1);
> target_write_u32(target, STM32_FLASH_KEYR, KEY2);
>
> Should I add a flag to mass_erase command to force or enable this feature.
> Does this check must be done automatically ?
> Thank you for your advise,
> Gaëtan
>
I would like to see this added. What the maintainers think, I don't
know. Unless someone steps up and demonstrates the feasibility of
doing it in tcl instead, I would say go for it. (Actually, I'd like to
see the tcl solution anyway, it would help me see how other similar
stuff could be handled.)
The check could be done always, but in order not to change current
behavior we should probably only print a warning if the flash is
locked. The warning should suggest that a flag be passed to mass_erase
to automatically unlock it.
Note also that if the flash IS locked, the unlock procedure performs a
mass erase, so we shouldn't need to do it explicitly. Also I'm unsure
as to whether the reset should be part of the auto-unlock-mass_erase
procedure. It's probably most convenient, but it means there's a
discrepancy in behavior between the case when the flash IS locked and
when its NOT. Another option is to always reset when the "auto"
("force", "unlock", whatever) flag is present. The only time that
would be an issue is when you're executing code in ram or external
memory and want to erase flash but preserve execution state.
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development