flash: remove algorithm exit_point address for supported targets
[fw/openocd] / src / flash / nor / pic32mx.c
index 58009ae57bf39259c12df8b5a8056c70008186ae..363f49e84a84f670643cd91fc7b588ce7b8274b3 100644 (file)
@@ -360,7 +360,7 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
 
                if ((retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
                                pic32mx_info->write_algorithm->address,
-                               pic32mx_info->write_algorithm->address + (sizeof(pic32mx_flash_write_code) - 76),
+                               0,
                                10000, &mips32_info)) != ERROR_OK)
                {
                        LOG_ERROR("error executing pic32mx flash write algorithm");
@@ -560,6 +560,12 @@ static int pic32mx_probe(struct flash_bank *bank)
 
        LOG_INFO("flash size = %" PRId32 "kbytes", num_pages / 1024);
 
+       if (bank->sectors)
+       {
+               free(bank->sectors);
+               bank->sectors = NULL;
+       }
+
        /* calculate numbers of pages */
        num_pages /= page_size;
        bank->size = (num_pages * page_size);