Forcing file build type to release

Hi everyone,

I have a project (Gnuk fork) with complex linker script. One file (sys.c) is built and placed in the 1st flash memory page, and other files are built and placed in the rest of the flash memory.
If I build the project in debug mode, sys.c becomes too large to fit into one memory page.
Is it possible to always build sys.c in release mode, and other source files in debug mode?

You should be able to use GCC optimize pragmas to override the optimizatino level locally.

E.g.

#pragma GCC push_options
#pragma GCC optimize ("Os")

void some_function_to_be_optimized() {
}

#pragma GCC pop_options

See also here.