Use of __attribute__((uncached)) using the ARC toolchain


nikola.neskovic995@...
 

Hi, I am trying to make an array that would bypass cache. I declare it like this:
volatile __attribute__((aligned(64))) __attribute__((packed)) uint32_t __attribute__((uncached)) buffer[4] = {0}

After the declaration I fill my buffer in a simple for loop:
for(i = 0; i < size; i++) { buffer[i] = i; }

And after compilation for my for loop I get the following asm code:
mov_sr    0,0
mov_s    r14,<buffer_address>
add2    r1,r14,r0
st_s    r0,[r1,0]
add_s    r0,r0,1
brne_nt    r0,<size>,-14

From what I understand about the _uncached_ attribute instead of the st_s command, in my disassembly, I should get st.di.

I found a workaround using pointers, so if I just declare a pointer like this:
volatile uint32_t __attribute__((uncached)) *help = (volatile uint32_t *)(buffer)
and I use it in the for loop instead of the buffer I get the st.di commands correctly.

I am using the zephyr_sdk_0.12.4 version of ARC toolchain.
I don't know if this is the best place to ask this question, but if anyone has an answer for this of can direct me to another list I would very much appreciate that.

Thanks in advance :)

Join users@lists.zephyrproject.org to automatically receive all group messages.