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: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4797 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
parent
71eeda5da1
commit
270725f8ad
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue