[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself

Search:


View post   

>> No.2510130 [View]
File: 27 KB, 707x395, file.png [View same] [iqdb] [saucenao] [google]
2510130

I am trying to use interrupts and volatile variables but I think somehow avr gcc is still optimizing stuff

Pic related is my interrupt code and it updates g_curDmaBuff which is a volatile. And later in a loop I am checking g_curDmaBuff like this


while(pxEnd > g_curDmaBuff);

Which should eventually become true but it doesn't. It works if I do this

while(pxEnd > g_curDmaBuff) delay(0);

So delay(0) probably un-optimize g_curDmaBuff

What am I missing?

Navigation
View posts[+24][+48][+96]