Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame] | 1 |  |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 2 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 3 | # Mbed-OS add new hardware target |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 4 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 5 | ## Overview |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 6 | |
| 7 | This document shows how to add the new Mbed OS hardware target to Matter |
| 8 | project. |
| 9 | |
| 10 | Please check the list of supported |
| 11 | [development boards](https://os.mbed.com/platforms/) which are compatible with |
| 12 | Mbed OS. |
| 13 | |
| 14 | In order to adapt the new hardware target to the Matter project, you need to |
| 15 | remember about the following requirements: |
| 16 | |
| 17 | - Bluetooth Low Energy support. |
| 18 | - Wireless communication module with WiFi or Thread network support (IPv6 |
| 19 | protocol is required). |
| 20 | - Serial port support |
| 21 | - On-chip debug with OpenOCD support |
| 22 | |
| 23 | Additional target component requirements are different for each of example |
| 24 | application. Check the **Device UI** paragraph in example description. |
| 25 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 26 | ## Example Application |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 27 | |
| 28 | The first step to add the new target to each of example application is to modify |
| 29 | the `examples/example_name/mbed/mbed_app.json` file. It contains the common |
| 30 | project settings and override the default values for supported boards. You |
| 31 | should add the necessary components and parameters for the target there. |
| 32 | |
| 33 | If the new target uses the external libraries, it will be required to link it in |
| 34 | the CMakeLists.txt file. |
| 35 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 36 | ## Building |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 37 | |
| 38 | To add the new hardware target to the build system the |
| 39 | `scripts/examples/mbed_example.sh` script should be modify. Extend |
| 40 | **SUPPORTED_TARGET_BOARD** variable with a new target name. |
| 41 | |
| 42 | Example: |
| 43 | |
| 44 | SUPPORTED_TARGET_BOARD=(CY8CPROTO_062_4343W NEW_TARGET_NAME) |
| 45 | |
| 46 | The next step is add the target name to build task in `.vscode/task.json` file. |
| 47 | Extend the **options** variable in **mbedTarget** input setting. |
| 48 | |
| 49 | Example: |
| 50 | |
| 51 | { |
| 52 | "type": "pickString", |
| 53 | "id": "mbedTarget", |
| 54 | "description": "What mbed target do you want to use?", |
| 55 | "options": ["CY8CPROTO_062_4343W", "NEW_TARGET_NAME"], |
| 56 | "default": "CY8CPROTO_062_4343W" |
| 57 | } |
| 58 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 59 | ## Flashing |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 60 | |
| 61 | Mbed OS example application flashing process uses the |
| 62 | [Open On-Chip Debugger](http://openocd.org/). The first step is to create the |
| 63 | target configuration file inside `config/mbed/scripts` directory. The file name |
| 64 | should be the same as target and the extension should be **.tcl**. The target |
| 65 | CPU and programming interface definitions are essential parts of the |
| 66 | configuration file. |
| 67 | |
| 68 | The next steps are the same as for building process. Adding the name of the |
| 69 | target to `scripts/examples/mbed_example.sh` and `.vscode/task.json` files |
| 70 | allows the use of available flashing processes. |
| 71 | |
| 72 | Additional flashing option is based on VSCode launch task. Adding the new target |
| 73 | to it required `.vscode/launch.json` modification. Extend the **options** |
| 74 | variable in **mbedTarget** input setting. |
| 75 | |
| 76 | Example: |
| 77 | |
| 78 | { |
| 79 | "type": "pickString", |
| 80 | "id": "mbedTarget", |
| 81 | "description": "What mbed target do you want to use?", |
| 82 | "options": ["CY8CPROTO_062_4343W", "NEW_TARGET_NAME"], |
| 83 | "default": "CY8CPROTO_062_4343W" |
| 84 | } |
| 85 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 86 | ## Debugging |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 87 | |
| 88 | Debugging process of Mbed OS applications is also based on VSCode launch task. |
| 89 | Adding the new target to it required `.vscode/launch.json` modification. Extend |
| 90 | the **options** variable in **mbedTarget** input setting. |
| 91 | |
| 92 | Example: |
| 93 | |
| 94 | { |
| 95 | "type": "pickString", |
| 96 | "id": "mbedTarget", |
| 97 | "description": "What mbed target do you want to use?", |
| 98 | "options": ["CY8CPROTO_062_4343W", "NEW_TARGET_NAME"], |
| 99 | "default": "CY8CPROTO_062_4343W" |
| 100 | } |
| 101 | |
Gaute Svanes Lunde | e7347ea | 2023-01-09 19:43:07 +0100 | [diff] [blame] | 102 | ## CI |
Artur Tynecki | 06f9a38 | 2021-10-29 16:10:56 +0200 | [diff] [blame] | 103 | |
| 104 | The Matter project continue integration process is based on Github Actions tool. |
| 105 | It uses workflow configuration files to execute actions on CI server. |
| 106 | |
| 107 | To add the new target to the validation process of building Mbed OS applications |
| 108 | you need to modify the `.github/workflows/examples-mbed.yaml` file. Extend the |
| 109 | job's environment variable **APP_TARGET** with the target name. |
| 110 | |
| 111 | Example: |
| 112 | |
| 113 | APP_TARGET: [CY8CPROTO_062_4343W, NEW_TARGET_NAME] |