X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fpic32mx.c;h=5e82ba63d58b08c72255e1f0b06bee72f548ec73;hp=842fd76bba7fc5193fca83ad3c6b3eaeb8a74820;hb=f618725e1a857838bc4ad4488522b3751265ff72;hpb=4da4e1cfb7d93dcedc333c11c787b83b8baf7dfa diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 842fd76bba..5e82ba63d5 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -410,7 +410,7 @@ static uint32_t pic32mx_flash_write_code[] = { 0x00000000 /* nop */ }; -static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer, +static int pic32mx_write_block(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; @@ -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; @@ -569,7 +571,7 @@ static int pic32mx_write_word(struct flash_bank *bank, uint32_t address, uint32_ return pic32mx_nvm_exec(bank, NVMCON_OP_WORD_PROG, 5); } -static int pic32mx_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int pic32mx_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { uint32_t words_remaining = (count / 4); uint32_t bytes_remaining = (count & 0x00000003);