I would like to debug my code and can't access the internal layer in the process since this would disturb the communication with the hardware. (volatile operations are performed where the watchlist would interfere with the basic read accesses.)
So I'm testing the interface's return values but the IAR compiler does even optimize unused volatile variables away.
and a statement like this:
i = object.foo();
if (i)i=i;
doesn't help either.
I found here on SO just answers that advice for that case to use i/o operations. but that's no option either, since I don't have the option of including the C standard libraries. and the project itself doesn't need i/o there is no own variant of input/output functions.
So what are my options except disabling the optimizer?
volatile
variables. Writing and reading them is observable behavior and may not be optimized out, but then they're obviously no longer unused. – Literati#pragma required=symbol
? It should not work with local variables, but should keep any statically linked variable or function. – Bolide