This is an automated email from Gerrit.

Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/4797

-- gerrit

commit 572932ced38e22741994cf048ba19612f26b11f1
Author: Tomas Vanek <[email protected]>
Date:   Fri Dec 7 18:45:06 2018 +0100

    target: allow moving and resing working area on running target
    
    target configure -work-area-xxx calls target_free_all_working_areas()
    and sets the desired new parameter. Without this change the working area 
does not
    get reallocated if it has been allocated before. 
target_free_all_working_areas()
    results in work area containing one block marked as free.
    
    Completely free working area in target_free_all_working_areas()
    
    Change-Id: I79c681082f32f2a96a2b40eb3b8751e427549693
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index 3d33a43..b4bf5d3 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1949,6 +1949,14 @@ static void target_free_all_working_areas_restore(struct 
target *target, int res
 void target_free_all_working_areas(struct target *target)
 {
        target_free_all_working_areas_restore(target, 1);
+
+       /* Now we have none or only one working area marked as free */
+       if (target->working_areas) {
+               /* Free the last one to allow on-the-fly moving and resizing */
+               free(target->working_areas->backup);
+               free(target->working_areas);
+               target->working_areas = NULL;
+       }
 }
 
 /* Find the largest number of bytes that can be allocated */
@@ -1989,11 +1997,6 @@ static void target_destroy(struct target *target)
        }
 
        target_free_all_working_areas(target);
-       /* Now we have none or only one working area marked as free */
-       if (target->working_areas) {
-               free(target->working_areas->backup);
-               free(target->working_areas);
-       }
 
        /* release the targets SMP list */
        if (target->smp) {

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to