You need to re-post patches when they change substantially. You added new code that was not in the original patch.
It still has whitespace problems. On Wed, 2009-07-08 at 20:29 +0200, ohar...@mail.berlios.de wrote: > Author: oharboe > Date: 2009-07-08 20:29:03 +0200 (Wed, 08 Jul 2009) > New Revision: 2499 > > Modified: > trunk/src/flash/aduc702x.c > Log: > Fix SEGFAULTs and broken error handling for flash programming w/working area > > Modified: trunk/src/flash/aduc702x.c > =================================================================== > --- trunk/src/flash/aduc702x.c 2009-07-08 10:38:50 UTC (rev 2498) > +++ trunk/src/flash/aduc702x.c 2009-07-08 18:29:03 UTC (rev 2499) > @@ -193,6 +193,11 @@ > return ERROR_FLASH_OPERATION_FAILED; > } > > +/* If this fn returns ERROR_TARGET_RESOURCE_NOT_AVAILABLE, then the caller > can fall > + * back to another mechanism that does not require onboard RAM > + * > + * Caller should not check for other return values specifically > + */ > static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, > uint32_t offset, uint32_t count) > { > aduc702x_flash_bank_t *aduc702x_info = bank->driver_priv; > @@ -204,6 +209,12 @@ > armv4_5_algorithm_t armv4_5_info; > int retval = ERROR_OK; > > + if (((count%2)!=0)||((offset%2)!=0)) > + { > + LOG_ERROR("write block must be multiple of two bytes in offset > & length"); > + return ERROR_FAIL; > + } > + > /* parameters: > > r0 - address of source data (absolute) > @@ -249,8 +260,12 @@ > return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; > }; > > - target_write_buffer(target, aduc702x_info->write_algorithm->address, > + retval=target_write_buffer(target, > aduc702x_info->write_algorithm->address, > sizeof(aduc702x_flash_write_code), > (uint8_t*)aduc702x_flash_write_code); > + if (retval!=ERROR_OK) > + { > + return retval; > + } > > /* memory buffer */ > while (target_alloc_working_area(target, buffer_size, &source) != > ERROR_OK) > @@ -279,12 +294,16 @@ > > while (count > 0) > { > - uint32_t thisrun_count = (count > (buffer_size / 2)) ? > (buffer_size / 2) : count; > + uint32_t thisrun_count = (count > buffer_size) ? buffer_size : > count; > > - target_write_buffer(target, source->address, thisrun_count * 2, > buffer); > + retval=target_write_buffer(target, source->address, > thisrun_count, buffer); > + if (retval!=ERROR_OK) > + { > + break; > + } > > buf_set_u32(reg_params[0].value, 0, 32, source->address); > - buf_set_u32(reg_params[1].value, 0, 32, thisrun_count); > + buf_set_u32(reg_params[1].value, 0, 32, thisrun_count/2); > buf_set_u32(reg_params[2].value, 0, 32, address); > buf_set_u32(reg_params[4].value, 0, 32, 0xFFFFF800); > > @@ -294,17 +313,19 @@ > 10000, &armv4_5_info)) != ERROR_OK) > { > LOG_ERROR("error executing aduc702x flash write > algorithm"); > - retval = ERROR_FLASH_OPERATION_FAILED; > break; > } > > - if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1) { > - retval = ERROR_FLASH_OPERATION_FAILED; > + if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1) > + { > + /* FIX!!!! what does this mean??? replace w/sensible > error message */ > + LOG_ERROR("aduc702x detected error writing flash"); > + retval = ERROR_FAIL; > break; > } > > - buffer += thisrun_count * 2; > - address += thisrun_count * 2; > + buffer += thisrun_count; > + address += thisrun_count; > count -= thisrun_count; > } > > @@ -382,14 +403,9 @@ > return ERROR_FLASH_OPERATION_FAILED; > } > } > - else if (retval == ERROR_FLASH_OPERATION_FAILED) > - { > - LOG_ERROR("flash block writing failed"); > - return ERROR_FLASH_OPERATION_FAILED; > - } > } > > - return ERROR_OK; > + return retval; > } > > static int aduc702x_probe(struct flash_bank_s *bank) > > _______________________________________________ > Openocd-svn mailing list > openocd-...@lists.berlios.de > https://lists.berlios.de/mailman/listinfo/openocd-svn _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development