What is the difference between the debug and release build configuration?
When creating a new EFM32 project from an existing example or using Configurator, Studio will prompt the user to select which build configurations to create. By default, for the GNU ARM toolchain, Studio will create two build configurations: debug and release.
Users can create any number of arbitrary build configurations with any name they choose. A build configuration is simply a collection of build settings that control how the project is built. This can include which files are built or excluded as well as what compiler options to use.
The default debug and release configuration options are listed below:
Generally, the debug configuration provides better debugging by reducing the compiler optimization level. This in turn keeps source code statements from being optimized away. This allows users to step through each line of source and place breakpoints at any line. The release configuration will generally merge several common pieces of code, making it difficult to step through code line by line. Another benefit of debugging with a debug build is that variables stored in memory stay in scope longer, whereas a variable in a release build may go out of scope the instant it's no longer used. This would result in an incorrect or invalid value in the expression window.
The DEBUG and NDEBUG compiler symbols can be used to include additional debug code in a project. For example, several emlib files use #ifndef NDEBUG and #endif clauses to include additional debug printf statements. While useful for debugging, users generally want to disable this in a production release build. This is done by defining NDEBUG as is done in the default release build configuration.