I have used the following #pragma using GCC ARM in Atmel Studio and I am hoping to re-use the technique with my KDS development:
//------------------------------------------------------------------------
//------ Set optimization level for this module ------------------------
//------ Overrides global settings -------------------------------------
//------------------------------------------------------------------------
//Values are 0 for no optimization, to 3 for most. "s" is for size
#pragma GCC optimize ("Os")
There is more than one way to express this to GCC, but this is the form I have been using successfully for some time now.
BTW - I am looking for feedback as to the difference between the "Cross ARM Compiler" in KDS and the "GNU ARM Compiler" - Difference between the "Cross ARM C++ Compiler" and the "GNU ARM C++ Compiler"?