Hi,
I'm seeing a strange behavior with static const variables declared in a function.
uint32_t function1 (void) { static const uint16_t var1 = 14000; static const uint16_t var2 = 2000; static const uint16_t var3 = 1750; /* Some computations */ return computedValue;
}
If I step in these functions in Debug mode (no optimization) and add a watch expression on these variables, I get:
var1: identifier not found: var1
var2: 240
var3: 16383
If I remove the "static" from the declarations, then I get the right values:
var1: 14000
var2: 2000
var3: 1750
I thought it might just be the debugger, but the computed value actually changes if I add or remove the "static" attribute.
Is this compiler specific? I'm using TI v18.1.6.LTS, but I've also tried v18.12.2.LTS, and both had the same behavior.
Edit: I've also tried 19.6.0.STS
Thanks,
Fred