That's why, at first, I have created a new command to keep mass_erase behavious unchanged. I think that is the better way to do. I already try several TCL combination but none work properly. If someone post a (full) working TCL script, it is good for me. So I going to wait some days/weeks to see if anyone have a TCL solution, if not I will try to send a new patch for a new command.
Best regards,
Gaëtan

On 07/16/2010 04:24 PM, Andreas Fritiofson wrote:
On Fri, Jul 16, 2010 at 10:10 AM, gcembed<gcem...@gmail.com>  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
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to