]> git.sur5r.net Git - openocd/commitdiff
Alexei Babich <a.babich@rez.ru> fix problems with unecessary tailend byte accesses...
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 10 Sep 2009 13:17:05 +0000 (13:17 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 10 Sep 2009 13:17:05 +0000 (13:17 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2684 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/target.c

index b6ea65551632635d69aead809957c495b0be7455..56e124f75f1785b42135469592010ccc52c69221 100644 (file)
@@ -1239,7 +1239,19 @@ int target_read_buffer(struct target_s *target, uint32_t address, uint32_t size,
                address += aligned;
                size -= aligned;
        }
+       
+       /*prevent byte access when possible (avoid AHB access limitations in some cases)*/
+       if(size >=2)
+       {
+               int aligned = size - (size%2);
+               retval = target_read_memory(target, address, 2, aligned / 2, buffer);
+               if (retval != ERROR_OK)
+                       return retval;
 
+               buffer += aligned;
+               address += aligned;
+               size -= aligned;
+       }
        /* handle tail writes of less than 4 bytes */
        if (size > 0)
        {