Commit 270725f8 authored by Tomas Vanek's avatar Tomas Vanek
Browse files

target: allow moving and resizing 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: default avatarTomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4797


Tested-by: jenkins
Reviewed-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
parent 71eeda5d
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment