Removed bogus errors when trying to allocate a large
a target memory buffer as possible.

Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com>
---
 src/flash/nor/aduc702x.c  |    2 +-
 src/flash/nor/cfi.c       |    4 ++--
 src/flash/nor/lpc2900.c   |    2 +-
 src/flash/nor/pic32mx.c   |    2 +-
 src/flash/nor/stellaris.c |    2 +-
 src/flash/nor/stm32x.c    |    2 +-
 src/flash/nor/str9x.c     |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/flash/nor/aduc702x.c b/src/flash/nor/aduc702x.c
index 57c591d..82ea2bc 100644
--- a/src/flash/nor/aduc702x.c
+++ b/src/flash/nor/aduc702x.c
@@ -227,7 +227,7 @@ static int aduc702x_write_block(struct flash_bank *bank, 
uint8_t *buffer, uint32
        }
 
        /* memory buffer */
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index a64d78f..caa8068 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -1116,7 +1116,7 @@ static int cfi_intel_write_block(struct flash_bank *bank, 
uint8_t *buffer, uint3
        /* Get a workspace buffer for the data to flash starting with 32k size.
           Half size until buffer would be smaller 256 Bytem then fail back */
        /* FIXME Why 256 bytes, why not 32 bytes (smallest flash write page */
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
@@ -1444,7 +1444,7 @@ static int cfi_spansion_write_block(struct flash_bank 
*bank, uint8_t *buffer, ui
        }
        /* the following code still assumes target code is fixed 24*4 bytes */
 
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index 360c14d..5b00495 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -1288,7 +1288,7 @@ static int lpc2900_write(struct flash_bank *bank, uint8_t 
*buffer,
           reduced size if that fails. */
        struct working_area *warea;
        uint32_t buffer_size = lpc2900_info->max_ram_block - 1 * KiB;
-       while( (retval = target_alloc_working_area(target,
+       while( (retval = target_alloc_working_area_try(target,
                                                   buffer_size + 
target_code_size,
                                                   &warea)) != ERROR_OK )
        {
diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c
index 2540342..4ebd256 100644
--- a/src/flash/nor/pic32mx.c
+++ b/src/flash/nor/pic32mx.c
@@ -322,7 +322,7 @@ static int pic32mx_write_block(struct flash_bank *bank, 
uint8_t *buffer,
                return retval;
 
        /* memory buffer */
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c
index 0b7c45a..cce5f37 100644
--- a/src/flash/nor/stellaris.c
+++ b/src/flash/nor/stellaris.c
@@ -846,7 +846,7 @@ static int stellaris_write_block(struct flash_bank *bank,
                buffer_size = wcount * 4;
 
        /* memory buffer */
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= buf_min)
diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c
index 0fdd148..7afd959 100644
--- a/src/flash/nor/stm32x.c
+++ b/src/flash/nor/stm32x.c
@@ -481,7 +481,7 @@ static int stm32x_write_block(struct flash_bank *bank, 
uint8_t *buffer,
                return retval;
 
        /* memory buffer */
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c
index 3d8b84b..2208fe3 100644
--- a/src/flash/nor/str9x.c
+++ b/src/flash/nor/str9x.c
@@ -385,7 +385,7 @@ static int str9x_write_block(struct flash_bank *bank,
                        (uint8_t*)str9x_flash_write_code);
 
        /* memory buffer */
-       while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != 
ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
-- 
1.6.3.3

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to