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.
/* Globally include or exclude transfer modes. -------------------------------*/ #define ioconfigUSE_ZERO_COPY_TX 1 #define ioconfigUSE_TX_CHAR_QUEUE 1 #define ioconfigUSE_CIRCULAR_BUFFER_RX 1 #define ioconfigUSE_RX_CHAR_QUEUE 1 /* Peripheral options --------------------------------------------------------*/ /* There is one group of definitions for each peripheral defined by the board support package. More details are provided below this example. */ /* Globally include or exclude the UART driver. */ #define ioconfigINCLUDE_UART 1 /* Include or exclude transfer modes for this particular peripheral. These are dependent on the global transfer mode settings at the top, and the global setting for the UART peripheral directly above. */ #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 /* As above, but for the SPI peripheral. */ #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 /* Etc. for any other peripherals defined by the board support package. */
| FreeRTOSIOConfig.h parameter | Usage |
| ioconfigUSE_ZERO_COPY_TX | Must be set to 1 if you are going to use the interrupt driven zero copy transfer mode. Otherwise, set to zero to ensure the best run time and code size efficiency. |
| ioconfigUSE_CIRCULAR_BUFFER_RX | Must be set to 1 if you are going to use the interrupt driven circular buffer transfer mode. Otherwise, set to zero to ensure the best run time and code size efficiency. |
| ioconfigUSE_TX_CHAR_QUEUE | Must be set to 1 if you are going to use the interrupt driven character queue transfer mode to write data. Otherwise, set to zero to ensure the best run time and code size efficiency. |
| ioconfigUSE_RX_CHAR_QUEUE | Must be set to 1 if you are going to use the interrupt driven character queue transfer mode to read data. Otherwise, set to zero to ensure the best run time and code size efficiency. |
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: