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

Ruud Derwig

Hi Nikola,


It looks like a similar known issue, see

Thanks for reporting. In many cases other uncached accessor functions for IO read/writes are used instead of the uncached attribute, but let’s see if I can boost priority for fixing this with your report.

Your workaround should be fine for now, let me know if you need more help.





From: users@... <users@...> On Behalf Of nikola.neskovic995@...
Sent: Friday, March 11, 2022 2:49 PM
To: users@...
Subject: [Zephyr-users] Use of __attribute__((uncached)) using the ARC toolchain


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 to automatically receive all group messages.