What I'm trying to do is to generate hold and disable times for SPI CS, which should be about 50 ns
That resolution is too high for any system timer.
I started by an empty for loop but it seems optimization gets rid of it (I haven't researched the issue properly). Then I thought a proper function would be better but got stuck in that expression "sleep resolution"
Add volatile to the loop counter variable and the optimizer will not remove it.