Rolf Meeser <rolfm_9dq@yahoo.de> warning fix in previous commit was wrong. target_code_size needs the real value later.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2705 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
9816f2ecda
commit
8e39f86ef4
|
@ -1126,7 +1126,7 @@ static int cfi_intel_write_block(struct flash_bank_s *bank, uint8_t *buffer, uin
|
||||||
|
|
||||||
/* If we are setting up the write_algorith, we need target_code_src */
|
/* If we are setting up the write_algorith, we need target_code_src */
|
||||||
/* if not we only need target_code_size. */
|
/* if not we only need target_code_size. */
|
||||||
/* */
|
|
||||||
/* However, we don't want to create multiple code paths, so we */
|
/* However, we don't want to create multiple code paths, so we */
|
||||||
/* do the unecessary evaluation of target_code_src, which the */
|
/* do the unecessary evaluation of target_code_src, which the */
|
||||||
/* compiler will probably nicely optimize away if not needed */
|
/* compiler will probably nicely optimize away if not needed */
|
||||||
|
@ -1447,44 +1447,46 @@ static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer,
|
||||||
armv4_5_info.core_mode = ARMV4_5_MODE_SVC;
|
armv4_5_info.core_mode = ARMV4_5_MODE_SVC;
|
||||||
armv4_5_info.core_state = ARMV4_5_STATE_ARM;
|
armv4_5_info.core_state = ARMV4_5_STATE_ARM;
|
||||||
|
|
||||||
/* flash write code */
|
int target_code_size;
|
||||||
int target_code_size = 0;
|
const uint32_t *target_code_src;
|
||||||
if (!cfi_info->write_algorithm)
|
|
||||||
{
|
|
||||||
uint8_t *target_code;
|
|
||||||
const uint32_t *src;
|
|
||||||
|
|
||||||
/* convert bus-width dependent algorithm code to correct endiannes */
|
|
||||||
switch (bank->bus_width)
|
switch (bank->bus_width)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1 :
|
||||||
src = word_8_code;
|
target_code_src = word_8_code;
|
||||||
target_code_size = sizeof(word_8_code);
|
target_code_size = sizeof(word_8_code);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2 :
|
||||||
/* Check for DQ5 support */
|
/* Check for DQ5 support */
|
||||||
if( cfi_info->status_poll_mask & (1 << 5) )
|
if( cfi_info->status_poll_mask & (1 << 5) )
|
||||||
{
|
{
|
||||||
src = word_16_code;
|
target_code_src = word_16_code;
|
||||||
target_code_size = sizeof(word_16_code);
|
target_code_size = sizeof(word_16_code);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No DQ5 support. Use DQ7 DATA# polling only. */
|
/* No DQ5 support. Use DQ7 DATA# polling only. */
|
||||||
src = word_16_code_dq7only;
|
target_code_src = word_16_code_dq7only;
|
||||||
target_code_size = sizeof(word_16_code_dq7only);
|
target_code_size = sizeof(word_16_code_dq7only);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4 :
|
||||||
src = word_32_code;
|
target_code_src = word_32_code;
|
||||||
target_code_size = sizeof(word_32_code);
|
target_code_size = sizeof(word_32_code);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("Unsupported bank buswidth %d, can't do block memory writes", bank->bus_width);
|
LOG_ERROR("Unsupported bank buswidth %d, can't do block memory writes", bank->bus_width);
|
||||||
return ERROR_FLASH_OPERATION_FAILED;
|
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* flash write code */
|
||||||
|
if (!cfi_info->write_algorithm)
|
||||||
|
{
|
||||||
|
uint8_t *target_code;
|
||||||
|
|
||||||
|
/* convert bus-width dependent algorithm code to correct endiannes */
|
||||||
target_code = malloc(target_code_size);
|
target_code = malloc(target_code_size);
|
||||||
cfi_fix_code_endian(target, target_code, src, target_code_size / 4);
|
cfi_fix_code_endian(target, target_code, target_code_src, target_code_size / 4);
|
||||||
|
|
||||||
/* allocate working area */
|
/* allocate working area */
|
||||||
retval = target_alloc_working_area(target, target_code_size,
|
retval = target_alloc_working_area(target, target_code_size,
|
||||||
|
|
Loading…
Reference in New Issue