- register uint32_t var1 = 123;
- DRAM_ATTR uint32_t var2 = 123;
- IRAM_ATTR uint32_t var3 = 123;
Can I use IRAM_ATTR on variables or structures?
You most likely shouldn't.I usually use "register"
The desired effect being...?to get the same effect?
Ok.
Code: Select all
// Make the compiler believe that some volatile magic happens to "value"
// to prevent reordering of code/expression w.r.t. other "volatiles".
static uint32_t vltle(uint32_t value) {
// This assembly is empty (does nothing), but tells the compiler that it may have changed ("+r") the contents of "value"
asm volatile ( "\n" : "+r" (value) );
return value;
}
...
start = XTHAL_GET_CCOUNT();
delay_us = vltle( (_baseDelay_ns - (uint32_t)((float)( vltle( _dT_us_first ) - _dT_us_current) *kefK)) /1000 );
start2 = XTHAL_GET_CCOUNT();
Users browsing this forum: No registered users and 109 guests