FreeRTOS+ Ecosystem Showcase

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
FreeRTOS Home FreeRTOS+ Home Integration Services Contact / Enquiries


FreeRTOS+IO Board Support Packages


Introduction

Board support packages, or BSPs, target the FreeRTOS+IO code to a specific microcontroller, on a specific board. It is the equivalent to the port layer found in FreeRTOS itself.

The FreeRTOS+IO code includes a header file called FreeRTOS_IO_BSP.h. This header file should ether contain the BSP information directly, or itself just be used to include the BSP header file that is correct for the target being used.

It is best to locate FreeRTOS_IO_BSP.h in an application directory, along side FreeRTOSIOConfig.h, because the header file is specific to the hardware being used by the application rather than the core FreeRTOS+IO code.

A BSP includes:

  • A table that defines the supported peripherals, and how each peripheral is identified in calls to FreeRTOS_open().
  • Device specific peripheral drivers.
  • A set of constants that define peripheral pin outs, LED polarities, etc.
  • An example FreeRTOSIOConfig.h header file.
  • Documentation that describes any target specific FreeRTOS_ioctl() request codes.


Peripheral support definition

The table that defines the supported peripherals takes the form of an array of Available_Peripherals_t structures:


typedef struct xAVAILABLE_DEVICES
{
    /* Text name of the peripheral.  For example, "/UART0/", or "/SPI2/". */
    const int8_t * const pcPath;				
	
    /* The type of the peripheral, as defined by the Peripheral_Types_t enum. */
    const Peripheral_Types_t xPeripheralType;	
	
    /* The base address of the peripheral in the microcontroller memory map. */
    const void *pvBaseAddress;
} Available_Peripherals_t;
						
The Available_Peripheral_t structure


The array is assigned to the macro boardAVAILABLE_DEVICES_LIST, so appears in a BSP configuration files as something like:


#define boardAVAILABLE_DEVICES_LIST          \
{                                            \
    { "/UART3/", eUART_TYPE, MCU_UART3 },    \
    { "/SSP1/", eSSP_TYPE,   MCU_SPI1 },     \
    { "/I2C2/", eI2C_TYPE,   MCU_I2C2 }      \
}
						
An array of Available_Peripheral_t structures
assigned to the boardAVAILABLE_DEVICES_LIST macro


The above example defines three peripherals. The peripheral accessed using the path string "/UART3/" is of type UART, and has a base address of MCU_UART3. The same table also defines an SPI peripheral and an I2C peripheral at their respective addresses.

Assigning the array to the boardAVAILABLE_DEVICES_LIST macro allows the same core FreeRTOS+IO code to be used with multiple BSP configuration files, simply by changing the BSP header file.


[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2014 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.