Doxygen file comments
[fw/openocd] / src / flash / nor / core.c
index 5eb51cd2dad99dcfe58ed5552ea0202b6c4e1daa..9083ed15ef92a95dda02aa4f0d9362922c2b4905 100644 (file)
 #include <target/image.h>
 
 
+/**
+ * @file
+ * Upper level of NOR flash framework.
+ * The lower level interfaces are to drivers.  These upper level ones
+ * primarily support access from Tcl scripts or from GDB.
+ */
+
 struct flash_bank *flash_banks;
 
 int flash_driver_erase(struct flash_bank *bank, int first, int last)
@@ -316,6 +323,7 @@ static int flash_iterate_address_range(struct target *target,
        /** @todo: handle erasures that cross into adjacent banks */
 
        addr -= c->base;
+       last_addr -= c->base;
 
        for (i = 0; i < c->num_sectors; i++)
        {
@@ -448,9 +456,12 @@ int flash_write_unlock(struct target *target, struct image *image,
                                break;
                        }
 
-                       /* REVISIT This needlessly touches sectors BETWEEN the
+                       /* FIXME This needlessly touches sectors BETWEEN the
                         * sections it's writing.  Without auto erase, it just
-                        * writes ones; unlikely to destroy data.
+                        * writes ones.  That WILL INVALIDATE data in cases
+                        * like Stellaris Tempest chips, corrupting internal
+                        * ECC codes; and at least FreeScale suggests issues
+                        * with that approach (in HC11 documentation).
                         *
                         * With auto erase enabled, data in those sectors will
                         * be needlessly destroyed; and some of the limited