Pragma Controls

Much of UECIDE's internals can be controlled from within your sketch during compilation using #pragma options. This ranges from selecting which board / compiler is in use, to adding extra compilation flags and other settings.

#pragma options take the form of:

#pragma key value

Some compilers also use #pragma internally in the same format. UECIDE understands the following keys:

  • parameter

Sets, or overrides, an internal UECIDE variable. Exactly what variables are available for use depends on the board / core / compiler selected. Common usages include:

#pragma parameter extra.cflags=-Wunused-variable::-Wunused-local-typedefs
#pragma parameter extra.cppflags=-ffast-math
#pragma parameter extra.ldflags=-flto
#pragma parameter extra.libs=-lSDL2
  • board

Sets the current board. Good for locking a sketch down to always compiling for the same board. For example:

#pragma board chipkit-lenny
  • compiler

As for board but selectes a compiler:

#pragma compiler arm-none-eabi-gcc-7
  • core

As for board and compiler but selected a core:

#pragma core arduino
  • option

Similar to parameter but is used to select an entry in the Options menu. Format is:

#pragma option key=value

Where key is the name of a group and value is a selection within that group. The Copy settings option in the Options menu will copy the currently selected options into the clipboard in this #pragma format so you can paste them into your sketch.

  • port

Selects a serial port for you. For example:

#pragma port /dev/ttyUSB1