Author: VivekK_11 Version: **
Translation - Japanese: Mbed OS アプリケーションで ModusToolbox コンフィグレータツールを使う - KBA228797- Community Translated (JA)
This article explains how to use ModusToolbox™ Configurator tools to modify the device configuration in PSoC 6 MCU-based Mbed OS applications. The article uses a CapSense® application as an example to explain that use case. This article applies to Mbed OS versions 5.14.0 or above, and ModusToolbox version 2.0 or above.
Default Device Configuration in PSoC 6 MCU-based Mbed OS Applications
Cypress PSoC 6 MCU-based development kits contain hardware (device) initialization/configuration code in the Mbed OS application folder \mbed-os\targets\TARGET_Cypress\TARGET_PSOC6\TARGET_TARGET_NAME\. For example, device configuration code of CY8CPROTO-062-4343W is present in \mbed-os\targets\TARGET_Cypress\TARGET_PSOC6\TARGET_CY8CPROTO_062_4343W\. The important files in that folder are listed below.
When a PSoC 6 MCU-based Mbed OS application is compiled, the build system includes the source files in the COMPONENT_BSP_DESIGN_MODUS folder of the specific target. This is done by adding the setting “components_add”: [“BSP_DESIGN_MODUS”] for the PSoC 6 MCU-based targets in the \mbed-os\targets\targets.json file. See https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-build-rules.html for more information on using the component type label directories for the build process.
Custom Device Configuration in PSoC 6 MCU-based Mbed OS Applications
A PSoC 6 mcu-based Mbed OS application may require a custom device configuration instead of the default configuration code available in the target folder as explained in the previous section. An example is the usage of the CapSense middleware component to allow the use of the PSoC 6 MCU CapSense feature in an Mbed OS application. An Mbed OS example application based on CapSense is available in the Cypress GitHub repository. The CapSense example uses the buttons and slider whose settings are generated by modifying two types of configurator-related files as explained below.
This process requires modifications to the default COMPONENT_BSP_DESIGN_MODUS component of the target in the Mbed OS folder. One option is to directly edit the files in this folder using the applicable configurators and regenerating the files. However, this is not a preferred solution beccause anytime you move between different Mbed OS versions or share projects, the process must be repeated.
A better solution is to have a modified COMPONENT_ BSP_DESIGN_MODUS component as part of the application top-level folder to reflect the changes required for the application for each required target. This approach is followed in the Mbed OS CapSense example at Cypress GitHub repository where the custom configuration for each target is placed inside the folder COMPONENT_CUSTOM_BSP_DESIGN_MODUS. To include this custom BSP configuration in the build process of a target, the mbed_app.json file in the top-level application folder contains the setting "target.components_add": ["CUSTOM_BSP_DESIGN_MODUS"] under each of the applicable targets. To also prevent the Mbed OS build process from including the default COMPONENT_BSP_DESIGN_MODUS component for the target, the mbed_app.json file also contains the setting "target.components_remove": ["BSP_DESIGN_MODUS"] to exclude the folder from the build process.
An example of how the mbed_app.json file will look like after the above changes is given below for the target
Some code examples using this approach are listed below for reference.