On Fri, Jul 8, 2011 at 12:14 PM, Øyvind Harboe <[email protected]> wrote:
>> There is no particular need to cast this into uint8_t* and this can be
>> kept as a void*. Would that suppress the warnings ?
>
> It does look like this code is using uint8_t * in lieu of void *...
Why ? It is just an address of 1-byte placeholder to which you would
like to copy byte read from the memory.
All you have to do late is to copy values read into each memeber of
uint32_t array to each corresponding member of uint8_t array.
This loop :
for (i = 0; i < count; i++)
{
buf[i] = param_out[i];
}
I see no problem of alignment there, as actually uint32_t will be
casted to uint8_t, which should be OK (while the other way around is
dangerous).
But even that can be avoided, as
retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code,
ARRAY_SIZE(param_in), param_in, count, param_out, 1);
will get you values in param_out[] array. This array is an array of
uint32_t values, I do not know for which reason...
Actually, copy from RAM address to our buffer is done in this loop :
/* loop */
MIPS32_BEQ(0,10,8),
/* beq 0, $10, end */
MIPS32_NOP,
MIPS32_LBU(8,0,9),
/* lw $8,0($9), Load t4 with the byte @mem[t1] */
MIPS32_SW(8,0,11),
/* sw $8,0($11) */
MIPS32_ADDI(10,10,NEG16(1)),
/* $10-- */
MIPS32_ADDI(9,9,1),
/* $9 += 1 */
MIPS32_ADDI(11,11,4),
/* $11 += 4 */
MIPS32_B(NEG16(8)),
/* b loop */
/* end */
Where $11 holds the adress of our buffer member (dst addr). Because we
said that our destination buffer is consisted of uint32_t, this
address is incremented by 4 in every pass:
MIPS32_ADDI(11,11,4),
/* $11 += 4 */
I think that using uint8_t array and using $11 += 1 in the loop should
do the same thing...
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development