This is an automated email from Gerrit. Mathias K?ster (kes...@freenet.de) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/367
-- gerrit commit 51cdfbaf9e68af539ac8061e977056d39e7f4310 Author: Mathias K <kes...@freenet.de> Date: Thu Jan 12 12:00:48 2012 +0100 stlink: add 8bit memory read/write and move to 8bit read/write This patch add 8bit memory read/write functions and change from 32bit read/write to 8bit read/write. Change-Id: Ie3a761cf006249b30d0691d1ea167d69a012c36a Signed-off-by: Mathias K <kes...@freenet.de> diff --git a/src/target/stm32_stlink.c b/src/target/stm32_stlink.c index c39d4c8..9bc21e3 100644 --- a/src/target/stm32_stlink.c +++ b/src/target/stm32_stlink.c @@ -561,31 +561,29 @@ static int stm32_stlink_read_memory(struct target *target, uint32_t address, uint8_t *buffer) { int res; - uint32_t *dst = (uint32_t *) buffer; + uint8_t *dst = buffer; uint32_t c; struct stlink_interface_s *stlink_if = target_to_stlink(target); if (!count || !buffer) return ERROR_COMMAND_SYNTAX_ERROR; - if (size != 4) { - LOG_DEBUG("%s %x %d %d", __func__, address, size, count); - return ERROR_COMMAND_SYNTAX_ERROR; - } + count *= size; + + LOG_DEBUG("%s %x %d %d", __func__, address, size, count); while (count) { - if (count > 128) - c = 128; + if (count > 64) + c = 64; else c = count; res = - stlink_if->layout->api->read_mem32(stlink_if->fd, address, + stlink_if->layout->api->read_mem8(stlink_if->fd, address, c, dst); - if (res != ERROR_OK) return res; + address += c; dst += c; - address += (c * 4); count -= c; } @@ -597,31 +595,30 @@ static int stm32_stlink_write_memory(struct target *target, uint32_t address, const uint8_t *buffer) { int res; - uint32_t *dst = (uint32_t *) buffer; + const uint8_t *dst = buffer; uint32_t c; struct stlink_interface_s *stlink_if = target_to_stlink(target); if (!count || !buffer) return ERROR_COMMAND_SYNTAX_ERROR; - if (size != 4) { - LOG_DEBUG("%s %x %d %d", __func__, address, size, count); - return ERROR_COMMAND_SYNTAX_ERROR; - } + count *= size; + + LOG_DEBUG("%s %x %d %d", __func__, address, size, count); while (count) { - if (count > 128) - c = 128; + if (count > 64) + c = 64; else c = count; res = - stlink_if->layout->api->write_mem32(stlink_if->fd, address, + stlink_if->layout->api->write_mem8(stlink_if->fd, address, c, dst); if (res != ERROR_OK) return res; dst += c; - address += (c * 4); + address += c; count -= c; } -- ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel