Comments?

Flash programming on adu7024  w/working area does
not work out of the box with the shipping aduc702x.cfg config script.
I strongly suspect that a reset-init script is needed.... Patches anyone?

Using parport flash programming w/working area does not crash as
Thomas reported, it just doesn't work.

Attached is a patch that cleans up the error handling at least. This only
affects the reportedly broken codepath when programming flash
is trying to use working memory.


> flash write_image /home/oyvind/workspace/aduflash.bin 0x80000 bin
aduc702x detected error writing flash
error writing to flash at address 0x00080000 at offset 0x00000000 (-4)
> flash write_image /home/oyvind/workspace/aduflash.bin 0x80000 bin
aduc702x detected error writing flash
error writing to flash at address 0x00080000 at offset 0x00000000 (-4)


-- 
Øyvind Harboe
Embedded software and hardware consulting services
http://www.zylin.com
### Eclipse Workspace Patch 1.0
#P openocd
Index: src/flash/aduc702x.c
===================================================================
--- src/flash/aduc702x.c        (revision 2490)
+++ src/flash/aduc702x.c        (working copy)
@@ -193,6 +193,11 @@
        return ERROR_FLASH_OPERATION_FAILED;
 }
 
+/* If this fn returns ERROR_TARGET_RESOURCE_NOT_AVAILABLE, then the caller can 
fall
+ * back to another mechanism that does not require onboard RAM
+ *
+ * Caller should not check for other return values specifically
+ */
 static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, 
uint32_t offset, uint32_t count)
 {
        aduc702x_flash_bank_t *aduc702x_info = bank->driver_priv;
@@ -249,8 +254,11 @@
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        };
 
-       target_write_buffer(target, aduc702x_info->write_algorithm->address,
-                sizeof(aduc702x_flash_write_code), 
(uint8_t*)aduc702x_flash_write_code);
+       if ((retval=target_write_buffer(target, 
aduc702x_info->write_algorithm->address,
+                sizeof(aduc702x_flash_write_code), 
(uint8_t*)aduc702x_flash_write_code))!=ERROR_OK)
+       {
+               return retval;
+       }
 
        /* memory buffer */
        while (target_alloc_working_area(target, buffer_size, &source) != 
ERROR_OK)
@@ -281,7 +289,10 @@
        {
                uint32_t thisrun_count = (count > (buffer_size / 2)) ? 
(buffer_size / 2) : count;
 
-               target_write_buffer(target, source->address, thisrun_count * 2, 
buffer);
+               if ((retval=target_write_buffer(target, source->address, 
thisrun_count * 2, buffer))!=ERROR_OK)
+               {
+                       break;
+               }
 
                buf_set_u32(reg_params[0].value, 0, 32, source->address);
                buf_set_u32(reg_params[1].value, 0, 32, thisrun_count);
@@ -294,12 +305,14 @@
                         10000, &armv4_5_info)) != ERROR_OK)
                {
                        LOG_ERROR("error executing aduc702x flash write 
algorithm");
-                       retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
 
-               if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1) {
-                       retval = ERROR_FLASH_OPERATION_FAILED;
+               if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1)
+               {
+                       /* FIX!!!! what does this mean??? replace w/sensible 
error message */
+                       LOG_ERROR("aduc702x detected error writing flash");
+                       retval = ERROR_FAIL;
                        break;
                }
 
@@ -382,14 +395,9 @@
                                 return ERROR_FLASH_OPERATION_FAILED;
                         }
                 }
-                else if (retval == ERROR_FLASH_OPERATION_FAILED)
-                {
-                        LOG_ERROR("flash block writing failed");
-                        return ERROR_FLASH_OPERATION_FAILED;
-                }
         }
 
-        return ERROR_OK;
+        return retval;
 }
 
 static int aduc702x_probe(struct flash_bank_s *bank)
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to