The custom BSP helloworld is an example project of how to use your own BSP with Greenwaves SDK. It provides:
- A Custom BSP folder including fictional board and driver definition.
- A basic compile-only helloworld application.
Please, check out GAP SDK documentation to learn more about how to use the custom BSP feature.
This custom BSP provide a new board unknown to GAP SDK, it is defined in the following file:
custom_bsp/kconfig/board.kconfig
config BOARD_CUSTOMER_BOARD
bool "Customer Board"
select CHIP_GAP9_V2_WLCSP
select HAS_APS256XXN_HARDWARE
select HAS_MX25U51245G_HARDWARE
select HAS_TLV320_HARDWARE
select HAS_MCP9808_HARDWARE
This fictional board assume it embbeds a GAP9 processor with four hardware peripherals :
- A RAM device : APS256XXN
- A Flash device : MX25U51245G
- An ADC device : TLV320
- A temperature sensor device : MCP9808
Some of these drivers are known from the GAP SDK. The last one is a new one provided by the custom BSP in:
custom_bsp/kconfig/drivers.kconfig
config HAS_MCP9808_HARDWARE
bool
help
dummy temperature driver
menu "Custom drivers"
config DRIVER_MCP9808
bool "MCP9808"
depends on HAS_MCP9808_HARDWARE
select DRIVER_I2C
endmenu
CMake automatically manages the addition of these menus to those of the GAP SDK, simply by setting the cmake variable GAP_CUSTOM_BSP beforehand in your application CMakeLists.txt file (already done in this project).
This custom BSP also include a devicetree definition for the board defined above. This definition is available here:
custom_bsp/devicetree/customer_board.dts
/dts-v1/;
/plugin/;
/{
customer1
{
compatible = "gwt, gap9";
target-path = "/";
__overlay__
{
mcp9808: mcp9808
{
status = "okay";
sys
{
device_name = "mcp9808";
driver_name = "mcp9808";
device_type = "temperature";
device_board = "customer_board";
device_driver = "bsp/drivers/mcp9808.h";
};
conf
{
i2c_itf = <1>;
bsp_open = "NULL";
bsp_close = "NULL";
bsp_conf = "NULL";
};
pads
{
i2c_sda = "GAP9_PADMUX(42,0,-1)";
i2c_scl = "GAP9_PADMUX(43,0,-1)";
};
};
};
};
};
This devicetree tells that the MCP9808 device is connected to the GAP9's I2C1 interface via pads 42 and 43.
The custom BSP also provide a set of .c/.h files where to implement board related function. These files are available here :
custom_bsp/bsp/boards/bsp_customer_board.c.h
Concerning peripherals, their driver can be stored here :
custom_bsp/bsp/drivers
- Clone the last available verison of the GAP SDK
- Follow the GAP SDK installation process until its compilation
- Set the environnement variable GAP_CUSTOM_BSP to the path of this project's custom BSP.
- Go into this project's helloworld application.
cd helloworld
- Configure CMake for this application.
cmake -B build
- Build and run the application
cmake --build build -t run