01-28-2020 05:55 AM
I try to debug the mircoblaze raw API echo server in SDK on an Artix7. I send an uint32_t to the server and want to change it in the recv_callback function and send it back. Copy the payloadpointer to dataPtr works, but dereference it to payloadvalue shifts the value by four bytes.
I dont know how to solve this issue.
Thank you for your help!
01-31-2020 07:07 AM
Seems to be an issue with the pointer data types or so... taking a look to the code I don't really spot the issue :S
Can you display the memory content of payload? I would also do a quick test using the following code:
payloadvalue = *(uint32_t*) p -> payload;
02-03-2020 12:59 AM - edited 02-03-2020 01:08 AM
Thank You for your reply, with your mentioned code I get the same results as before.
I recognized in the memory, that the pointer always takes the bytevalue of the even 4 byte adresses. So when the pointer is on 0x38d76 he takes the uint32 value of the 0x38d74 adresses. Looks like an alignment issue on the microblaze, but SDK displays the correct values. Are there any settings for the microblades where i can adjust this, so the microblaze shifts the 4 bytes of the uint32 to the right order?
02-03-2020 02:16 AM
For now I solved this problem with this workaround:
uint32_t *tempStoragePtr, *payloadPtr;
payloadPtr = (uint32_t*) p -> payload;
payloadLength = p -> len;
tempStoragePtr = (uint32_t*) malloc(payloadLength);
memcpy(tempStoragePtr, payloadPtr, payloadLength);
payloadValue = *tempStoragePtr;
But it would be nice, if someone find a better solution.