]> git.sur5r.net Git - openocd/commitdiff
flash: less bogus errors
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 3 May 2010 16:11:34 +0000 (18:11 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 4 May 2010 07:11:21 +0000 (09:11 +0200)
Removed bogus errors when trying to allocate a large
a target memory buffer as possible.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/flash/nor/aduc702x.c
src/flash/nor/cfi.c
src/flash/nor/lpc2900.c
src/flash/nor/pic32mx.c
src/flash/nor/stellaris.c
src/flash/nor/stm32x.c
src/flash/nor/str9x.c

index 57c591d5360de63289deafecad24ac771efc43ae..82ea2bc6e326cfd57ee269056a567be28102087d 100644 (file)
@@ -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)
index f88f16c81af0aa05cb81c98c68b7466c92600506..99676529ba3958c15a09cb21c33e0d2ce74cdd35 100644 (file)
@@ -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)
index 360c14deffb6f690061b39a26d5bd422fe728e0d..5b004951bbfa2239aa251eeb3e5aedde876d2404 100644 (file)
@@ -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 )
        {
index 25403424535897de479a0398ed121446818c4731..4ebd2564bc9c6144c2c23683664ee833171d9f47 100644 (file)
@@ -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)
index 0b7c45a31f45ba241d6df6e21c869d0315a3dae4..cce5f3700121eb8e46761a84f005d3b14bcfb577 100644 (file)
@@ -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)
index 0fdd148e72df3ee3ec64fbd05a160704d0fd713d..7afd9597da007b8a55be609f00e048f7414b076d 100644 (file)
@@ -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)
index 3d8b84b3df2ef6187667386340ff6a215b41727e..2208fe326af285e35929288678d013cecd7d6906 100644 (file)
@@ -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)