In my code I have many of constants have same value. I cannot use same name of constant due to logic.
On optimization will keil take different memory of each or same memory.
I am using three setting of optimization: 1. O0 2. Cross + microlib + O2 3. Cross + Time + O3
I don't know what the C spec says about that, but I wouldn't expect folding constants to be a standard optimization. The compiler doesn't know the purpose of the constant -- it may be changed in a patch.
But idk.