A Board Support Package (BSP) provides a standard interface to a board's features and capabilities. The API is consistent across Cypress kits. Other software (such as middleware or the user's application) can use the BSP to configure and control the hardware. BSPs have the following characteristics:
COMPONENTS+=NEW_FEATURE This section provides a high-level view for using BSPs. You should be familiar with creating an application using both the ModusToolbox 2.0 IDE and command-line environments. To use a BSP for a Cypress kit you need to perform the following steps:
git clone [https://github.com/cypresssemiconductorco/TARGET_CY8CPROTO-062-4343W/#latest-v1.X] make getlibs command from a command shell in the top directory of the application.include "cybsp.h" to your main.c file.cybsp_init () at the start of main().This section presents a quick overview of the key resources that are part of a BSP. The contents may vary for different environments. The following shows a typical BSP in a PSoC 6 development scenario.
Defines the DEVICE and other BSP-specific make variables such as COMPONENTS.
These files contain the API interface to the board's resources.
You need to include only cybsp.h in your application to use all the features of a BSP. Call cybsp_init () from cybsp. to initialize the board.
The cybsp_types.h file contains the aliases (macro definitions) for all the board resources.
Linker scripts for all supported toolchains: GCC ARM, IAR, and ARM.
Contains the startup code with the reset handler for the target device, written in assembly language for all supported toolchains: GCC ARM, IAR, and ARM.
This folder contains the configuration files (such as design.modus) for use with various BSP configurator tools, including Device Configurator, QSPI Configurator, and CapSense Configurator. At the start of a build, the build system invokes these tools to generate the source files in the GeneratedSource directory. See Overriding the design.modus Provided by BSP to learn how the application can override this component.
This folder contains the .lib files that specify the required libraries for the underlying device family. You can use the make getlibs command to fetch these libraries. The IDE's New Application wizard, or the stand-alone Project Creator tool, invoke make getlibs automatically.
The docs directory contains the HTML based documentation. The README.md file serves as the GitHub repository documentation.
BSPs are packaged or organized differently depending on different IoT environment's rules.
In Mbed OS, BSPs are referred to as targets. All Cypress targets are located in the mbed-os/targets/TARGET_CYPRESS/TARGET_PSOC6 directory along with other libraries such as WHD, PDL driver, HAL, etc.
A BSP or target is placed inside the TARGET_(board-name) directory. For example, the directory TARGET_CY8CKIT_062_WIFI_BT packages the BSP for the CY8CKIT-062-WIFI-BT kit. Explaining the complete file structure is outside the scope of this document. See Cypress Firmware Deliverables in Mbed OS KBA228252 to learn more.
In Amazon FreeRTOS, the BSP is spread out in the /vendors/cypress directory.
The cycfg.c file generated by the Device Configurator contains a routine init_cycfg_all(). This function calls several other routines that initialize the device with the configuration defined through the Device Configurator.
The cybsp_init() function in the cybsp.c file does not call init_cycfg_all(). It calls the init_cycfg_system() function to initialize the device resources such as clocks and power supplies. You can call the other routines (for example, init_cycfg_routing()) in main() if required.
Note that you need to call init_cycfg_routing() when you use analog resources such as CapSense and SAR ADC. See the corresponding code examples at the Cypress GitHub webpage for details.
The BSP sets up a default board configuration in the design.modus file.
When you create an application that uses a BSP, the design.modus file is copied from the original BSP repository and put into your application. You can open the local copy of the file with the Device Configurator and modify the configuration. However, if you recreate the application, you get a new copy of the original design.modus file and your changes are lost.
Rather than make local changes, if necessary, you can override the BSP_DESIGN_MODUS component with a different configuration. Cypress code examples often override this component to use a different configuration than the one provided by a BSP. To do this, follow these steps:
DISABLE_COMPONENTS+=BSP_DESIGN_MODUSCreate a directory for each target that you want to support at the top-level directory in your application. The directory name must be TARGET_(board_name). For example, TARGET_CY8CPROTO-062-4343W.
Remember that the build system automatically includes all the source files inside a directory that begins with TARGET_ followed by the target name for compilation when that target is specified in the application make file. The file structure appears as follows. Here, the BSP_DESIGN_MODUS component is overridden for the targets CY8CPROTO-062-4343W and CY8CKIT-062-WIFI-BT.
Copy the design.modus file and other configuration files inside this new directory and customize as required. When you save the changes in the design.modus file, the source files are generated and placed under the GeneratedSource directory. The file structure appears as follows.
Cypress provides BSPs for its boards. When you design your own board, it is likely to have a different MCU, board peripherals, and other hardware features. You can create a custom BSP for your board to simplify interacting with your board's features.
DEVICE variable in the .mk file with the correct part number of the device/MCU if it is different than the BSP that you started from.DEVICE.If you changed DEVICE:
a. In your BSP’s COMPONENT_BSP_DESIGN_MODUS directory, delete the entire GeneratedSource directory.
b. Using the command line in your project space, run make build TARGET=MYBOARDNAME. The build system will automatically update the DEVICE in the design.modus file, build the generated source, and attempt to build the project for the new target.
c. The BSP used as your starting point may have source that is not needed by your custom BSP. In particular if you encounter issues with SDIO_HOST or SDIO_HOST_cfg source files, delete these.
cybsp_init() function in the cybsp.c file to correctly initialize your board.