Author: ChunleiL_51 Version: *A
Translation - Japanese: ModusToolboxでのカスタムBSPの作成 - KBA230822 - Community Translated (JA)
ModusToolbox® uses Board Support Packages (BSPs) that are used by middleware and applications to configure and control the hardware. Currently, ModusToolbox supports two types of BSPs: PSoC® 6 MCU and WICED® Bluetooth. ModusToolbox provides various BSPs by default, but they are limited to the development kit which the BSP was developed for. Therefore, before adding custom hardware to ModusToolbox, you need to create a BSP for it.
This article is for ModusToolbox 2.1 and earlier. Some details of this process are changed in the latest version. For information about ModusToolbox v2.2 and later, see KBA231373.
Before you start, install ModusToolbox software. See https://www.cypress.com/products/modustoolbox-software-environment
The best way to create a custom PSoC 6 BSP is to start with the BSP that closely matches your board requirements and customize it. For example, if your board contains a PSoC 6 MCU device with 2 MB flash, you could start with the BSP for the CY8CPROTO-062-4343W kit which has PSoC 6 MCU with 2 MB flash, and modify it to fit your board.
This section describes how to create a custom BSP based on the template BSP in ModusToolbox (PSOC6-GENERIC). These steps use the Eclipse IDE for ModusToolbox.
1. Select File > New > ModusToolbox Application.
Figure 1. Create a ModusToolbox application
2. Select PSOC6-GENERIC and click Next.
Figure 2. Select the kit
3. In the Select Application dialog that appears, select Empty PSoC6 App and click Create.
Note that by default, Empty_PSoC6_App includes the BSPs for CY8CPROTO-062-4343W and the PSOC6-GENERIC.
4. Open Library Manager from the Quick Panel and then select CY8CPROTO-062-4343W in Active BSP.
5. (OPTIONAL) If you need to generate your own BSP from the BSPs other than these two, select the BSP you need from the PSoC 6 BSPs group and then enable it in Active BSP:. Figure 5 shows how to generate your own BSP from CY8CKIT-062-BLE.
6. Do one of the following to generate the BSP. See the ModusToolbox User Guide for details.
For example, to make a custom BSP named “MyBSP” which supports the CY8C624ABZI-D44 MCU, do the following:
Execute the following command from the root of Empty_PSoC6_App:
make bsp TARGET_GEN=MyBSP DEVICE_GEN=CY8C624ABZI-D44
In Eclipse IDE for ModusToolbox:
bsp TARGET_GEN=MyBSP DEVICE_GEN=CY8C624ABZI-D44
This creates the build target listed under Empty_PSoC6_App as Figure 8 shows:
7. Specify your parameters for the make bsp command, and then double-click on the corresponding build target.
The build process starts running and produces logs as shown below:
The BSP is created in the root of the Empty_PSoC6_App application. The target is named with the value you specified in the TARGET_GEN parameter. In this example, it appears as “TARGET_MyBSP”.
8. (OPTIONAL) If you see errors in Step 7, fix the errors and go back to Step 7. Ensure that you are using the closest official BSP to generate your own BSP. Ensure that you delete all “TARGET_xxx” directories in the root of the Empty_PSoC6_App application before going back to Step 7.
9. Copy the entire TARGET_MyBSP folder to your project directory (typically, under the libs directory).
10. Update the TARGET variable in the Makefile under your project root directory with the name of the BSP that you created. This ensures that your project builds your program using the custom BSP that you created, and not the original BSP.
11. Rebuild your project.
A new directory named “MyBSP” is created under build directory, which indicates that binary files inside that directory are built using MyBSP. This means that you have successfully created your custom BSP.
12. Use the Device Configurator to enable and configure clocks, pins, peripherals, and other features of the device. Click the PSOC6-GENERIC BSP link in the Documentation group on the Quick Panel to view the documentation and learn about default settings and how to reconfigure your own BSP.
Similar to the case of creating a custom BSP for PSoC 6 MCU projects in ModusToolbox, for creating a custom WICED Bluetooth BSP, start with the closet-matching official BSP and customize it. However, this case differs from PSoC 6 BSPs in the following two ways:
The following example shows how to make a custom BSP named “mybsp” from the pre-defined BSP “CYW920819EVB-02”.
1. Click New Application in the Quick Panel, select CYW920819EVB-02 under WICED Bluetooth BSPs, and then click Next.
This deploys WICED SDK in your workspace.
2. Select wiced_btsdk and click Create.
This creates “wiced_btsdk” as a shared project in your workspace. Note that you need to do this only once.
3. Go to \wiced_btsdk\dev-kit\bsp\, make a copy of TARGET_CYW920819EVB-02 in the same folder, and then rename it to “TARGET_mybsp”.
4. Go to TARGET_mybsp, find CYW920819EVB-02.mk, and then rename it to mybsp.mk.
5. Double-click design.modus listed under TARGET_mybsp.
6. Open the Device Configurator to modify the pin configurations.
This configures the BSP.
7. Go to your working project directory, open the “Makefile” in the root directory, and then change the variables as follows:
8. Rebuild your project to generate the binary files based on “mybsp”.
You can confirm this by looking for the directory .\build\mybsp\ under your project directory, which indicates the binary files inside that folder are generated based on “mybsp”.
See ModusToolbox User Guide (002-29893).