On Wednesday 06 January 2010, Spencer Oliver wrote:
> If fastdata access fails, then fallback to default mips_m4k_write_memory
> Remove unnecessary fastdata loader verify check
> 
> Signed-off-by: Spencer Oliver <[email protected]>

Looks plausible to me, though I think that LOG_WARNING on the fallback
should be less severe -- maybe LOG_DEBUG.  The logic seems to be "try
fastdata if possible, else do the other way" ... so users will have no
control over what it uses, and a WARNING won't help.  A single warning
at startup -- "you didn't provide a work area, so writes will be slow"
might do; but ISTR the ARM code doesn't particularly warn about such
stuff for now either.

Also you might merge a cleanup patch to make sure pracc.c (and any
others which need the fix) don't have all that needless end-of-line
whitespace.

Similarly in pracc.c you're doing runtime init of an array of opcodes,
THEN checking if source->size (work area done without the work area
utils?) is cooperating ... the ARM stuff has all those opcode arrays
"static const" and copies them into a scratch buffer before tweaking
(e.g. byteswapping).

Those large static on-stack arrays will cause trouble on "deeply"
embedded boxes (Zylin).  And you could easily check the size before
initializing them ... :)

> ---
>   src/target/mips32_pracc.c |   10 +---------
>   src/target/mips_m4k.c     |    6 ++++++
>   2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c
> index 26d5a6b..ac1d1b3 100644
> --- a/src/target/mips32_pracc.c
> +++ b/src/target/mips32_pracc.c
> @@ -968,15 +968,7 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag 
> *ejtag_info, struct working_are
>       /* write program into RAM */
>       mips32_pracc_write_mem32(ejtag_info, source->address, 
> ARRAY_SIZE(handler_code), handler_code);
> 
> -     /* quick verify RAM is working */
> -     mips32_pracc_read_u32(ejtag_info, source->address, &val);
> -     if (val != handler_code[0])
> -     {
> -             LOG_ERROR("fastdata handler verify failed\n");
> -             return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
> -     }
> -
> -     LOG_INFO("%s using 0x%.8x for write handler\n", __func__, 
> source->address);
> +     LOG_DEBUG("%s using 0x%.8x for write handler\n", __func__, 
> source->address);
> 
>       jmp_code[1] |= UPPER16(source->address);
>       jmp_code[2] |= LOWER16(source->address);
> diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
> index 4adc1f1..312fc09 100644
> --- a/src/target/mips_m4k.c
> +++ b/src/target/mips_m4k.c
> @@ -1001,6 +1001,12 @@ int mips_m4k_bulk_write_memory(struct target 
> *target, uint32_t address, uint32_t
>       }
> 
>       retval = mips32_pracc_fastdata_xfer(ejtag_info, source, write, 
> address, count, (uint32_t*) buffer);
> +     if (retval != ERROR_OK)
> +     {
> +             /* FASTDATA access failed, try normal memory write */
> +             LOG_WARNING("Fastdata access Failed, falling back to non-bulk 
> write");
> +             retval = mips_m4k_write_memory(target, address, 4, count, 
> buffer);
> +     }
> 
>       if (source)
>               target_free_working_area(target, source);
> 
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to