This is an automated email from Gerrit.

Han Hartgers ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/5241

-- gerrit

commit 8bc6810e57706174f09b1fd1d58fbeca8c54b8b9
Author: Han Hartgers <[email protected]>
Date:   Tue Jun 18 21:34:09 2019 +0200

    topic: restore dsp563xx_write_memory and dsp563xx_read_memory functionality
    
    The functions dsp563xx_write_memory and dsp563xx_read_memory returns
    ERROR_COMMAND_SYNTAX_ERROR when size is equal to the buffer size and count 
is equal
    to 0. This happens when dump_image and load_image  commands are called.
    My patch solves this by recalculating count and set size to 4 when these 
two parameters
    are not defined correctly. This is a bit crude solution; This can also be 
solved by
    fixing size=4 and calculating count on a higher level in functions 
dsp563xx_write_memory_default
    and dsp563xx_read_memory_default.
    With this patch is it possible again to up- and download code to the dsp 
memory.
    
    Change-Id: I2bf685e335036fc23e68da440bb5ac66f7ef325b
    Signed-off-by: Han Hartgers <[email protected]>

diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c
index 6a5c868..b7f3834 100644
--- a/src/target/dsp563xx.c
+++ b/src/target/dsp563xx.c
@@ -1605,6 +1605,7 @@ static int dsp563xx_read_memory(struct target *target,
 {
        int err;
        uint32_t i, i1;
+       uint32_t l_size;
        uint8_t *buffer_y, *buffer_x;
 
        /* if size equals zero we are called from target read memory
@@ -1618,6 +1619,18 @@ static int dsp563xx_read_memory(struct target *target,
                count = (count - size) / 4;
                size = 4;
        }
+       if ((size >= 4) && (count == 0)) {
+               /* it can be that size and count are not properly defined.
+                * try to fix this by calculating count. */
+               l_size = size % 4;
+
+               if (l_size)
+                       LOG_DEBUG("size is not aligned to 4 byte");
+
+               count = (size - l_size) / 4;
+               size = 4;
+       }
+
 
        /* we only support 4 byte aligned data */
        if ((size != 4) || (!count))
@@ -1779,6 +1792,7 @@ static int dsp563xx_write_memory(struct target *target,
 {
        int err;
        uint32_t i, i1;
+       uint32_t l_size;
        uint8_t *buffer_y, *buffer_x;
 
        /* if size equals zero we are called from target write memory
@@ -1793,6 +1807,19 @@ static int dsp563xx_write_memory(struct target *target,
                size = 4;
        }
 
+       if ((size >= 4) && (count == 0)) {
+               /* it can be that size and count are not properly defined.
+                * try to fix this by calculating count. */
+
+               l_size = size % 4;
+
+               if (l_size)
+                       LOG_DEBUG("size is not aligned to 4 byte");
+
+               count = (size - l_size) / 4;
+               size = 4;
+       }
+
        /* we only support 4 byte aligned data */
        if ((size != 4) || (!count))
                return ERROR_COMMAND_SYNTAX_ERROR;

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to