This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-J721S2: Bus fault in memcpy

Part Number: PROCESSOR-SDK-J721S2

I have a problem with using memcpy unaligned-16 address or sizes. When I do memcpy for DDR to internal memory (.data or .bss) if the source address or destination or even size it causes bus error (core dump).

for example 

device tree :

A72-memory@92000000 {
compatible = "shared-dma-pool";
reg = <0x0 0x92000000 0x0 0x01FFFFFF>;
no-map;
phandle = <0xf0>;
};

C code :

uint8 destination[0x100000u] ;

uio_fd = open("/dev/mem", O_RDWR);

shm = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, uio_fd, base_addr);

memcpy( destination ,((uint8*)shm + 0xC) , 0x100000u);

this memcpy causes (bus error) core dump because the shift of 0x0C.

All parameter must be aligned to 16 to work properly. How to solve this issue ?

Is there missing configration in device tree or in using mmap api ?

thanks in advance,