aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/pic32mx.c
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2013-09-28 22:14:49 +0200
committerSpencer Oliver <spen@spen-soft.co.uk>2013-10-31 20:44:47 +0000
commit4831236af4a49c315b79923ba31b80243969a901 (patch)
tree587c3c36ec9c2beba0e0d7d69c05f1bbe481e7ea /src/flash/nor/pic32mx.c
parentb310881e38c4519009726a3efe998c15e7ad7248 (diff)
downloadriscv-openocd-4831236af4a49c315b79923ba31b80243969a901.zip
riscv-openocd-4831236af4a49c315b79923ba31b80243969a901.tar.gz
riscv-openocd-4831236af4a49c315b79923ba31b80243969a901.tar.bz2
pic32mx: Fix byte order bug
Found by grepping for pointer casts. Change-Id: If73184a16904ec2958e7253ba98f44479fdcad3f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1772 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/flash/nor/pic32mx.c')
-rw-r--r--src/flash/nor/pic32mx.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c
index 6ede666..2b27ec5 100644
--- a/src/flash/nor/pic32mx.c
+++ b/src/flash/nor/pic32mx.c
@@ -449,8 +449,10 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
row_size = 512;
}
- retval = target_write_buffer(target, write_algorithm->address,
- sizeof(pic32mx_flash_write_code), (uint8_t *)pic32mx_flash_write_code);
+ uint8_t code[sizeof(pic32mx_flash_write_code)];
+ target_buffer_set_u32_array(target, code, ARRAY_SIZE(pic32mx_flash_write_code),
+ pic32mx_flash_write_code);
+ retval = target_write_buffer(target, write_algorithm->address, sizeof(code), code);
if (retval != ERROR_OK)
return retval;