Just like the FreeRTOS kernel itself, FreeRTOS+IO is configured using a header file.
Whereas the FreeRTOS configuration header file is called FreeRTOSConfig.h,
the FreeRTOS+IO configuration header file is called FreeRTOSIOConfig.h.
The settings in the kernel's configuration file (FreeRTOSConfig.h) do not
greatly impact the size of the executable binary created when the code is
compiled. This is because, for the most part,
the settings it contains are used to include or exclude entire functions.
The default* behaviour of most linkers is to remove any unreferenced
functions from the executable binary anyway.
The settings in the FreeRTOS+IO configuration file (FreeRTOSIOConfig.h), on the
other hand, do greatly impact code size. This is because they are used to optionally
include or exclude code within functions, rather than optionally include or exclude the entire function itself.
It is important to ensure FreeRTOSIOConfig.h is configured optimally if flash/ROM
space is at a premium.
* GCC is the exception to this, where specific compile time
options are required to request that unreferenced code is removed.
An example FreeRTOSIOConfig.h header file
The details of the parameters contained in a FreeRTOSIOConfig.h header
file are dependent on the board support package being used.
Below is an example, and below that an explanation.
#define ioconfigUSE_ZERO_COPY_TX 1
#define ioconfigUSE_TX_CHAR_QUEUE 1
#define ioconfigUSE_CIRCULAR_BUFFER_RX 1
#define ioconfigUSE_RX_CHAR_QUEUE 1
#define ioconfigINCLUDE_UART 1
#define ioconfigUSE_UART_POLLED_TX 0
#define ioconfgiUSE_UART_POLLED_RX 0
#define ioconfigUSE_UART_ZERO_COPY_TX 0
#define ioconfigUSE_UART_TX_CHAR_QUEUE 1
#define ioconfigUSE_UART_CIRCULAR_BUFFER_RX 0
#define ioconfigUSE_UART_RX_CHAR_QUEUE 1
#define ioconfigINCLUDE_SPI 1
#define ioconfigUSE_SPI_POLLED_TX 0
#define ioconfigUSE_SPI_POLLED_RX 0
#define ioconfigUSE_SPI_ZERO_COPY_TX 1
#define ioconfigUSE_SPI_CIRCULAR_BUFFER_RX 1
#define ioconfigUSE_SPI_RX_CHAR_QUEUE 0
#define ioconfigUSE_SPI_TX_CHAR_QUEUE 0
Global transfer mode options
In the example above, the top group of options are used to include or exclude
specific transfer modes from FreeRTOS+IO. The polling mode is always available,
so there is no option specific to that.
Peripheral specific options
The board support package defines which peripherals are available.
For each peripheral there is a global include or exclude option. For
example, to include the SPI peripheral, set configINCLUDE_SPI to 1. To
exclude the SPI peripheral, set configINCLUDE_SPI to 0.
Each peripheral then has a sub-option for each transfer mode supported
by the peripheral. For example, if you want to use the SPI port in
interrupt driven zero copy mode set ioconfigUSE_SPI_ZERO_COPY_TX to 1,
otherwise set ioconfigUSE_SPI_ZERO_COPY_TX to 0.
Therefore, to continue the example, to use the SPI port in interrupt
driven zero copy mode three settings are required:
ioconfigUSE_ZERO_COPY_TX must be set to 1 to enable the transfer
mode in FreeRTOS+IO.
ioconfigINCLUDE_SPI must be set to 1 to enable SPI support.
ioconfigUSE_SPI_ZERO_COPY_TX must be set to 1 to specifically
enable the use of the zero copy transfer mode on the SPI port.