X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fecos.c;h=f6c2442f16c663e187ca4d022d31d376faadbbe4;hb=68c598e88d5e09728ea845a81ab279c615bbaf0f;hp=f467b74d8c4b17547bd14a4b8f80f413630549b8;hpb=6549d376e49a3dd4071a6cb4420bbba8f1ecf9c5;p=openocd.git diff --git a/src/flash/ecos.c b/src/flash/ecos.c index f467b74d8c..f6c2442f16 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 Øyvind Harboe * + * Copyright (C) 2007,2008 Øyvind Harboe * * oyvind.harboe@zylin.com * * * * This program is free software; you can redistribute it and/or modify * @@ -195,10 +195,11 @@ int loadDriver(ecosflash_flash_bank_t *info) image.base_address_set = 0; image.start_address_set = 0; target_t *target=info->target; + int retval; - if (image_open(&image, info->driverPath, NULL) != ERROR_OK) + if ((retval=image_open(&image, info->driverPath, NULL)) != ERROR_OK) { - return ERROR_FLASH_BANK_INVALID; + return retval; } info->start_address=image.start_address; @@ -211,10 +212,9 @@ int loadDriver(ecosflash_flash_bank_t *info) int retval; if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK) { - LOG_ERROR("image_read_section failed with error code: %i", retval); free(buffer); image_close(&image); - return ERROR_FLASH_BANK_INVALID; + return retval; } target_write_buffer(target, image.sections[i].base_address, buf_cnt, buffer); image_size += buf_cnt; @@ -303,7 +303,7 @@ int eCosBoard_erase(ecosflash_flash_bank_t *info, u32 address, u32 len) if (flashErr != 0x0) { LOG_ERROR("Flash erase failed with %d (%s)\n", flashErr, flash_errmsg(flashErr)); - return ERROR_JTAG_DEVICE_ERROR; + return ERROR_FAIL; } return ERROR_OK; @@ -362,7 +362,7 @@ int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, u32 address, u32 l if (flashErr != 0x0) { LOG_ERROR("Flash prog failed with %d (%s)\n", flashErr, flash_errmsg(flashErr)); - return ERROR_JTAG_DEVICE_ERROR; + return ERROR_FAIL; } } return ERROR_OK;