Translation - Japanese: ModusToolbox 2.2以降用：カスタムBSPを作成する - KBA231373 - Community Translated (JA)
How do I create a custom Board Support Package (BSP) for my own hardware?
Follow the steps in this article. This article is for ModusToolbox v2.2 and later. Some details of this process have changed. For information about ModusToolbox v2.1, see KBA230822.
The BSP is at the core of the ModusToolbox software. We provide a BSP for each of our kits. A BSP includes (among other things):
For a custom BSP, these elements must be adjusted for your hardware. This KBA explains how to accomplish that goal. At a high level, the steps are straightforward:
The new BSP includes a copy of the design.modus file, and it uses the same libraries as the original BSP. This KBA starts with the generic BSP and shows you how to add functionality. This results in a minimalist BSP to which you can add functionality for your hardware. The generic BSP is a lowest-common denominator that supports all PSoC 6 MCU devices; however, it will support very few code examples because most examples require some kit functionality.
As an alternative, you can create your application with a kit BSP that has more functionality. For example, if your design uses capacitive sensing, use a BSP for a kit that has CapSense functionality. The design files and libraries used by the BSP are set up for that kit. When you start with a more capable BSP, you modify and/or remove functionality to match your hardware, but the principles outlined here are identical.
Step 1: Create an application using an existing BSP.
When the Project Creator is done you have an application directory. The original BSP will be in the mtb_shared directory, adjacent to the application directory. However, you really don’t need to know where it is. You do your work in the application directory.
Step 2: Create a new BSP.
This command has three parameters:
Using the simple case of a new device, your command would look something like this:
$ make bsp TARGET_GEN=MyBSP DEVICE_GEN=CY8C6316BZI-BLF03
The ModusToolbox build system creates the new BSP at the top level of the application directory, and it is named TARGET_ followed by whatever you named it. In this example it is TARGET_MyBSP.
The new BSP includes part-specific linker scripts and startup code automatically. The design.modus file is identical to the original BSP. If the original design does not work for the new part, you will see an error.
In this example the new part cannot be clocked at the same frequency. You fix these errors in the next step.
Step 3: Update the new BSP.
There are two primary tasks: update the device configuration in the design.modus file, and add libraries. The application you used when creating the new BSP has a makefile. In this example it is in Empty_PSOC6_App.
The build system launches the Device Configurator for your new BSP/device. Resolve any errors and modify the design as required for your hardware. For example, in this case you must set the PLL frequency to a value supported by the part.
If you are unfamiliar with the Device Configurator read the documentation to learn how to enable and configure clocks, pins, peripherals, and other features of the device.
The libraries included with the BSP are in this directory: TARGET_MyBSP/deps. If you start with the generic BSP, these represent the minimal set of libraries required for your device. Each .lib and corresponding .mtbx file is a URL to a git repository that contains the library files.
Note The .mtbx files are used for the MTB library management flow while the .lib files are used by the LIB library management flow. Depending on the flow your application uses, only one of each pair of files will be used. Refer to the Library Manager Guide for descriptions of each flow.
To add an additional library to your BSP, simply put the corresponding .lib and .mtbx file in this directory.
If you create a custom BSP based on a kit BSP, there may be additional libraries. You can also study code examples to see which libraries they use. ModusToolbox libraries are all available on GitHub.
Step 4: Use the new BSP.
When you are done setting up the new BSP, you can move it anywhere you want; it is a self-contained library. Check the BSP into a version control system if you wish.
There are several ways you can use this BSP. Here are a few:
make import_deps IMPORT_PATH=TARGET_MyBsp
make import_deps IMPORT_PATH=TARGET_MyBsp