Creating custom BSPs in ModusToolbox
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
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 click here.
Before you start, install ModusToolbox software. See ModusToolbox™ Software.
In this article you will get to know how to:
1. Create a Custom PSoC 6 BSP
2. Create a Custom WICED Bluetooth BSP
3. Troubleshooting
1. Create a Custom PSoC 6 BSP
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.
Figure 3.
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.
Figure 4.
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.
Figure 5.
6. Do one of the following to generate the BSP. See the ModusToolbox User Guide for details.
- Run the make bsp command with the corresponding parameters in CLI.
On Linux and macOS, you can use any terminal application. On Windows, navigate to the modus-shell directory ({ModusToolbox install directory}/tools_<version>/modus-shell) and run Cygwin.bat. - Create Build Targets in Eclipse IDE for ModusToolbox.
For example, to make a custom BSP named “MyBSP” which supports the CY8C624ABZI-D44 MCU, do the following:
In CLI:
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:
In Project Explorer, right-click Empty_PSoC6_App and select Build Targets > Create.
Figure 6
In the Create Build Target dialog that appears, type the following into the Target name field as Figure 7 shows, and click OK.
bsp TARGET_GEN=MyBSP DEVICE_GEN=CY8C624ABZI-D44
Figure 7
This creates the build target listed under Empty_PSoC6_App as Figure 8 shows:
Figure 8
See the “BSP Make Variables” section in the ModusToolbox User Guide for details of parameters used in the make bsp command. Normally, you specify five parameters as listed in Table 1.
Table 1
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:
Figure 9
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”.
Figure 10
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).
Figure 11
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.
Figure 12
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.
Figure 13
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.
Figure 14
Figure 15
2. Create a Custom WICED Bluetooth 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:
- There is no generic BSP which can be used as a template.
- The BSPs are managed in one place within the WICED SDK, not managed separately within the project directory.
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.
Figure 16
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.
Figure 17
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”.
Figure 18
4. Go to TARGET_mybsp, find CYW920819EVB-02.mk, and then rename it to mybsp.mk.
Figure 19
5. Double-click design.modus listed under TARGET_mybsp.
Figure 20
6. Open the Device Configurator to modify the pin configurations.
Figure 21
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:
- Set TARGET to mybsp.
- Add “mybsp” to SUPPORTED_TARGETSTARGET_DEVICE_MAP.
Figure 22
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”.
Figure 23
3. Troubleshooting
See ModusToolbox User Guide (002-29893).
Author: ChunleiL_51 Version: *A
Translation - Japanese: ModusToolboxでのカスタムBSPの作成 - KBA230822 - Community Translated (JA)
- Tags:
- board support package
- creating custom bsp
- custom Board Support Packages (BSPs)
- modustoolbox
- modustoolbox 2.1
- PSoC® 6 MCU
- WICED® Bluetooth