Skip to content

Commit

Permalink
add esp home kit sdk as framework (#1122)
Browse files Browse the repository at this point in the history
* add esp home kit sdk as framework

* add to appendIdfAndToolsToPath

* fix lint

* fix init report obj

* add examples to project wizard

* fix duplicate install in docs
  • Loading branch information
brianignacio5 authored Feb 19, 2024
1 parent 6e9aed5 commit 9c9b1ab
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Click <kbd>F1</kbd> to show Visual studio code actions, then type **ESP-IDF** to
| Install ESP-MDF | | |
| Install ESP-Matter | | |
| Install ESP-Rainmaker | | |
| Install ESP-HomeKit-SDK | | |
| Launch IDF Monitor for CoreDump / GDB-Stub Mode | | |
| Launch QEMU Server | | |
| Launch QEMU Debug Session | | |
Expand Down Expand Up @@ -176,7 +177,9 @@ Click <kbd>F1</kbd> to show Visual studio code actions, then type **ESP-IDF** to

5. The **Install ESP-MDF** will clone ESP-MDF inside the selected directory and set `idf.espMdfPath` (`idf.espMdfPathWin` in Windows) configuration setting.

6. The **Show Examples Projects** command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter or ESP-MDF directory if related configuration settings are correctly defined.
6. The **Install ESP-HomeKit-SDK** will clone ESP-HomeKit-SDK inside the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting.

7. The **Show Examples Projects** command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter, ESP-HomeKit-SDK or ESP-MDF directory if related configuration settings are correctly defined.

# Commands for tasks.json and launch.json

Expand Down
3 changes: 3 additions & 0 deletions docs/HARDWARE_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[ESP32-S2](https://www.espressif.com/en/products/socs/esp32-s2)
[ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3)
[ESP32-H2](https://www.espressif.com/en/products/socs/esp32-h2)
[ESP32-P4](https://www.espressif.com/en/products/socs/esp32-p4)

The chips supported in the extension are directly dependent on the ESP-IDF and OpenOCD version you are using:

Expand All @@ -27,4 +28,6 @@ In addition to ESP-IDF chips, there are several boards configurations files impl

- [Espressif Rainmaker](https://github.com/espressif/esp-rainmaker) can be clone with the **ESP-IDF: Install ESP-Rainmaker** to a selected and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting.

- [ESP-HomeKit-SDK](https://github.com/espressif/esp-homekit-sdk) can be clone with the **Install ESP-HomeKit-SDK** command to the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting.

> **NOTE:** Consider that if you are using other Espressif frameworks for your projects, not all ESP-IDF versions are compatible with an specific framework. For example, ESP-ADF might not work with the current ESP-IDF master branch. It is recommended that you configure the extension to use the ESP-IDF within the framework (most frameworks include compatible ESP-IDF as subdirectory) in the setup wizard or JSON Configuration as shown in [SETUP](./SETUP.md) documentation or [Install](./tutorial/install.md) tutorial.
3 changes: 2 additions & 1 deletion docs/SETTINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ These settings allow to support additional frameworks together with ESP-IDF:
The **ESP-IDF: Install ESP-ADF** command will clone ESP-ADF and set `idf.espAdfPath` (`idf.espAdfPathWin` in Windows).
The **ESP-IDF: Install ESP-MDF** command will clone ESP-MDF and set `idf.espMdfPath` (`idf.espMdfPathWin` in Windows).
The **ESP-IDF: Install ESP-Matter** command will clone ESP-Matter and set `idf.espMatterPath`. The **ESP-IDF: Set ESP-MATTER Device Path (ESP_MATTER_DEVICE_PATH)** is used to define the device path for ESP-Matter. ESP-Matter is not supported in Windows.
The **ESP-IDF: Install Install ESP-Rainmaker** command will clone ESP-Rainmaker and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting.
The **ESP-IDF: Install ESP-Rainmaker** command will clone ESP-Rainmaker and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting.
The **ESP-IDF: Install ESP-HomeKit-SDK** command will clone ESP-HomeKit-SDK inside the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting.

The **ESP-IDF: Show Examples Projects** command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter or ESP-MDF directory if related configuration settings are set, or to create projects from examples found in the Component Registry.

Expand Down
4 changes: 3 additions & 1 deletion docs/tutorial/additional_frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Besides ESP-IDF, you can install other frameworks to extend the extension functi

4. [Espressif Rainmaker](https://github.com/espressif/esp-rainmaker) can be clone with the **ESP-IDF: Install ESP-Rainmaker** to a selected and set `idf.espRainmakerPath` (`idf.espRainmakerPathWin` in Windows) configuration setting.

> **NOTE:** You can also just set each configuration setting with the framework directory path if you already have them. For example, on Visual Studio Code menu `View` -> `Command Palette..`. -> type `Preferences: Open Settings (UI)` and search for ESP-ADF to manually set this path.
5. [ESP-HomeKit-SDK](https://github.com/espressif/esp-homekit-sdk) can be clone with the **Install ESP-HomeKit-SDK** command to the selected directory and set `idf.espHomeKitSdkPath` (`idf.espHomeKitSdkPathWin` in Windows) configuration setting.

> **NOTE:** You can also just set each configuration setting with the framework directory path if you already have them. For example, on Visual Studio Code menu `View` -> `Command Palette..`. -> type `Preferences: Open Settings (UI)` and search for ESP-ADF (or other framework) to manually set this path.
> **NOTE:** Please review [ESP-IDF Settings](../SETTINGS.md) to see how to modify these configuration settings.
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/new_project_wizard.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# New Project Wizard

This feature allows you to create a new project using the ESP-IDF, ESP-ADF and ESP-MDF frameworks and configure the extension settings and the project name.
This feature allows you to create a new project using the ESP-IDF, ESP-ADF, ESP-MDF and other supported frameworks and configure the extension settings and the project name.

1. Click menu View -> Command Palette... and search for the **ESP-IDF: New Project**.

Expand All @@ -12,7 +12,7 @@ This feature allows you to create a new project using the ESP-IDF, ESP-ADF and E

> **NOTE:** If using the custom board option, please take a look at [Configuring of OpenOCD for Specific Target](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/jtag-debugging/tips-and-quirks.html#configuration-of-openocd-for-specific-target) for more information about these openOCD configuration files and the [debugging tutorial](./debugging.md) for values examples.
3. After that click the `Choose Template` button and choose a template from Extension templates and, if configured; ESP-IDF, ESP-ADF and ESP-MDF frameworks. If you want to create a blank project, choose ESP-IDF `sample_project` or the extension `template-app`.
3. After that click the `Choose Template` button and choose a template from Extension templates and, if configured; ESP-IDF, ESP-ADF and other supported frameworks. If you want to create a blank project, choose ESP-IDF `sample_project` or the extension `template-app`.

<p>
<img src="../../media/tutorials/new_project/new_project_templates.png" alt="New project templates" height="500">
Expand Down
2 changes: 2 additions & 0 deletions i18n/en/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"espIdf.getEspMdf.title": "Install ESP-MDF",
"espIdf.getEspMatter.title": "Install ESP-Matter",
"espIdf.getEspRainmaker.title": "Install ESP-Rainmaker",
"espIdf.getEspHomeKitSdk.title": "Install ESP-HomeKit-SDK",
"espIdf.installEspMatterPyReqs.title": "Install ESP-Matter Python Packages",
"espIdf.installPyReqs.title": "Install ESP-IDF Extension Python Packages",
"espIdf.openDocUrl.title": "Open ESP-IDF Documentation...",
Expand Down Expand Up @@ -82,6 +83,7 @@
"param.espMdfPath": "Path to locate ESP-MDF framework (MDF_PATH)",
"param.espMatterPath": "Path to locate ESP-Matter framework (ESP_MATTER_PATH)",
"param.espRainmakerPath": "Path to locate ESP-Rainmaker framework (RMAKER_PATH)",
"param.espHomeKitSdkPath": "Path to locate ESP-HomeKit-SDK framework (HOMEKIT_PATH)",
"param.toolsPath": "Path to locate ESP-IDF Tools (IDF_TOOLS_PATH)",
"param.exportPaths": "Paths to be appended to PATH",
"param.exportVars": "Variables to be added to system environment variables",
Expand Down
2 changes: 2 additions & 0 deletions i18n/es/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"espIdf.getEspMdf.title": "ESP-IDF: Instalar ESP-MDF",
"espIdf.getEspMatter.title": "ESP-IDF: Instalar ESP-Matter",
"espIdf.getEspRainmaker.title": "Instalar ESP-Rainmaker",
"espIdf.getEspHomeKitSdk.title": "Instalar ESP-HomeKit-SDK",
"espIdf.installEspMatterPyReqs.title": "ESP-IDF: Instalar paquetes Python para ESP-Matter",
"espIdf.installPyReqs.title": "ESP-IDF: Instalar paquetes Python para extensión ESP-IDF",
"espIdf.openDocUrl.title": "ESP-IDF: Abrir documentación ESP-IDF...",
Expand Down Expand Up @@ -86,6 +87,7 @@
"param.espMdfPath": "Ruta del entorno de trabajo ESP-MDF (MDF_PATH)",
"param.espMatterPath": "Ruta del entorno del trabajo ESP-Matter (ESP_MATTER_PATH)",
"param.espRainmakerPath": "Ruta del entorno del trabajo ESP-Rainmaker (RMAKER_PATH)",
"param.espHomeKitSdkPath": "Ruta del entorno del trabajo ESP-HomeKit-SDK (HOMEKIT_PATH)",
"param.cmakeCompilerArgs": "Argumentos para la tarea de compilación CMake",
"param.ninjaArgs": "Argumentos para la tarea de construcción Ninja",
"param.useIDFKConfigStyle": "Habilitar/Deshabilitar validación de estilo ESP-IDF para archivos Kconfig",
Expand Down
2 changes: 2 additions & 0 deletions i18n/ru/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"espIdf.getEspMdf.title": "Установить ESP-MDF",
"espIdf.getEspMatter.title": "Установить ESP-Matter",
"espIdf.getEspRainmaker.title": "Установить ESP-Rainmaker",
"espIdf.getEspHomeKitSdk.title": "Установить ESP-HomeKit-SDK",
"espIdf.installEspMatterPyReqs.title": "Установите пакеты Python ESP-Matter",
"espIdf.installPyReqs.title": "Установите пакеты Python расширения ESP-IDF",
"espIdf.openDocUrl.title": "Открыть документацию ...",
Expand Down Expand Up @@ -82,6 +83,7 @@
"param.espMdfPath": "Путь фреймворка ESP-MDF (MDF_PATH)",
"param.espMatterPath": "Путь фреймворка ESP-Matter (ESP_MATTER_PATH)",
"param.espRainmakerPath": "Путь фреймворка ESP-Rainmaker (RMAKER_PATH)",
"param.espHomeKitSdkPath": "Путь фреймворка ESP-HomeKit-SDK (HOMEKIT_PATH)",
"param.toolsPath": "Путь инструментов ESP-IDF (IDF_TOOLS_PATH)",
"param.exportPaths": "Пути, добавляемые к PATH",
"param.exportVars": "Переменные, которые нужно добавить к системным переменным окружения",
Expand Down
2 changes: 2 additions & 0 deletions i18n/zh-CN/package.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"espIdf.getEspMdf.title": "ESP-IDF: 安装 ESP-MDF",
"espIdf.getEspMatter.title": "ESP-IDF: 安装 ESP-Matter",
"espIdf.getEspRainmaker.title": "安装 ESP-Rainmaker",
"espIdf.getEspHomeKitSdk.title": "安装 ESP-HomeKit-SDK",
"espIdf.installEspMatterPyReqs.title": "ESP-IDF: 安装 ESP-Matter Python 包",
"espIdf.installPyReqs.title": "ESP-IDF: 安装 ESP-IDF 扩展 Python 包",
"espIdf.openDocUrl.title": "ESP-IDF: 打开 ESP-IDF 文档...",
Expand Down Expand Up @@ -86,6 +87,7 @@
"param.espMdfPath": "MDF_PATH 的路径",
"param.espMatterPath": "ESP_MATTER_PATH 的路径",
"param.espRainmakerPath": "RMAKER_PATH 的路径",
"param.espHomeKitSdkPath": "HOMEKIT_PATH 的路径",
"param.useIDFKConfigStyle": "启用/禁用 ESP-IDF Kconfig 文件的样式验证",
"param.showOnboardingOnInit": "在扩展激活时显示 ESP-IDF 配置窗口",
"param.cmakeCompilerArgs": "CMake 编译任务的参数",
Expand Down
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@
"description": "%param.espMatterPath%",
"scope": "resource"
},
"idf.espHomeKitSdkPath": {
"type": "string",
"default": "${env:HOMEKIT_PATH}",
"description": "%param.espHomeKitSdkPath%",
"scope": "resource"
},
"idf.toolsPath": {
"type": "string",
"default": "${env:IDF_TOOLS_PATH}",
Expand Down Expand Up @@ -449,6 +455,12 @@
"description": "%param.espRainmakerPath%",
"scope": "resource"
},
"idf.espHomeKitSdkPathWin": {
"type": "string",
"default": "${env:HOMEKIT_PATH}",
"description": "%param.espHomeKitSdkPath%",
"scope": "resource"
},
"idf.port": {
"type": "string",
"default": "/dev/ttyUSB1",
Expand Down Expand Up @@ -1203,6 +1215,11 @@
"title": "%espIdf.getEspRainmaker.title%",
"category": "ESP-IDF"
},
{
"command": "espIdf.getEspHomeKitSdk",
"title": "%espIdf.getEspHomeKitSdk.title%",
"category": "ESP-IDF"
},
{
"command": "espIdf.installEspMatterPyReqs",
"title": "%espIdf.installEspMatterPyReqs.title%",
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"espIdf.searchInEspIdfDocs.title": "Search in Documentation...",
"espIdf.getEspAdf.title": "Install ESP-ADF",
"espIdf.getEspMdf.title": "Install ESP-MDF",
"espIdf.getEspHomeKitSdk.title": "Install ESP-HomeKit-SDK",
"espIdf.getEspMatter.title": "Install ESP-Matter",
"espIdf.getEspRainmaker.title": "Install ESP-Rainmaker",
"espIdf.installEspMatterPyReqs.title": "Install ESP-Matter Python Packages",
Expand Down Expand Up @@ -82,6 +83,7 @@
"param.espMdfPath": "Path to locate ESP-MDF framework (MDF_PATH)",
"param.espMatterPath": "Path to locate ESP-Matter framework (ESP_MATTER_PATH)",
"param.espRainmakerPath": "Path to locate ESP-Rainmaker framework (RMAKER_PATH)",
"param.espHomeKitSdkPath": "Path to locate ESP-HomeKit-SDK framework (HOMEKIT_PATH)",
"param.toolsPath": "Path to locate ESP-IDF Tools (IDF_TOOLS_PATH)",
"param.exportPaths": "Paths to be appended to PATH",
"param.exportVars": "Variables to be added to system environment variables",
Expand Down
5 changes: 5 additions & 0 deletions schema.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"espIdf.getEspMdf.title",
"espIdf.getEspMatter.title",
"espIdf.getEspRainmaker.title",
"espIdf.getEspHomeKitSdk.title",
"espIdf.installEspMatterPyReqs.title",
"espIdf.installPyReqs.title",
"espIdf.openDocUrl.title",
Expand All @@ -131,6 +132,7 @@
"espIdf.launchQemu.title",
"espIdf.qemuDebug.title",
"espIdf.flashUart.title",
"espIdf.saveDefSdkconfig.title",
"espIdf.createDevContainer.title",
"espIdf.partition.table.refresh.title",
"espIdf.flashBinaryToPartition.title",
Expand All @@ -157,6 +159,7 @@
"param.espMdfPath",
"param.espMatterPath",
"param.espRainmakerPath",
"param.espHomeKitSdkPath",
"param.toolsPath",
"param.exportPaths",
"param.exportVars",
Expand All @@ -175,6 +178,8 @@
"param.monitorNoReset",
"param.monitorEnableTimestamps",
"param.monitorCustomTimestampFormat",
"param.customTerminalExecutable.title",
"param.customTerminalExecutableArgs.title",
"view.components.name",
"configuration.title",
"espIdf.apptrace.archive.refresh.title",
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export namespace ESP {
"idf.espAdfPath",
"idf.espMdfPath",
"idf.espRainmakerPath",
"idf.espHomeKitSdkPath",
"idf.gitPath",
"idf.pythonBinPath",
"idf.port",
Expand Down
39 changes: 39 additions & 0 deletions src/espHomekit/espHomekitDownload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Project: ESP-IDF VSCode Extension
* File Created: Monday, 29th January 2024 5:23:22 pm
* Copyright 2024 Espressif Systems (Shanghai) CO LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Uri } from "vscode";
import { AbstractCloning } from "../common/abstractCloning";
import { readParameter } from "../idfConfiguration";

export class EspHomekitCloning extends AbstractCloning {
constructor(gitBinPath: string = "git") {
super(
"https://github.com/espressif/esp-homekit-sdk.git",
"ESP-HomeKit-SDK",
"master",
gitBinPath,
"https://gitee.com/EspressifSystems/esp-homekit-sdk"
);
}
}

export async function getEspHomeKitSdk(workspace: Uri) {
const gitPath = (await readParameter("idf.gitPath", workspace)) || "git";
const homeKitInstaller = new EspHomekitCloning(gitPath);
await homeKitInstaller.getRepository("idf.espHomeKitSdkPath", workspace);
}
28 changes: 26 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ import {
import { getFileList, getTestComponents } from "./espIdf/unitTest/utils";
import { saveDefSdkconfig } from "./espIdf/menuconfig/saveDefConfig";
import { createSBOM, installEspSBOM } from "./espBom";
import { getEspHomeKitSdk } from "./espHomekit/espHomekitDownload";

// Global variables shared by commands
let workspaceRoot: vscode.Uri;
Expand Down Expand Up @@ -745,6 +746,10 @@ export async function activate(context: vscode.ExtensionContext) {

registerIDFCommand("espIdf.getEspMdf", async () => getEspMdf(workspaceRoot));

registerIDFCommand("espIdf.getEspHomeKitSdk", async () =>
getEspHomeKitSdk(workspaceRoot)
);

registerIDFCommand("espIdf.getEspMatter", async () => {
if (process.platform === "win32") {
return vscode.window.showInformationMessage(
Expand Down Expand Up @@ -3400,9 +3405,18 @@ async function getFrameworksPickItems() {
"idf.espMdfPath",
workspaceRoot
) as string;
const matterPathDir = idfConf.readParameter("idf.espMatterPath") as string;
const matterPathDir = idfConf.readParameter(
"idf.espMatterPath",
workspaceRoot
) as string;
const rainmakerPathDir = idfConf.readParameter(
"idf.espRainmakerPath"
"idf.espRainmakerPath",
workspaceRoot
) as string;

const espHomeKitPathDir = idfConf.readParameter(
"idf.espHomeKitSdkPath",
workspaceRoot
) as string;

const pickItems = [];
Expand Down Expand Up @@ -3449,6 +3463,16 @@ async function getFrameworksPickItems() {
target: rainmakerPathDir,
});
}
const doesEspHomeKitSdkPathExists = await utils.dirExistPromise(
espHomeKitPathDir
);
if (doesEspHomeKitSdkPathExists) {
pickItems.push({
description: "ESP-HomeKit-SDK",
label: `Use current ESP-HomeKit-SDK (${espHomeKitPathDir})`,
target: espHomeKitPathDir,
});
}
} catch (error) {
const errMsg = error.message ? error.message : "Error getting frameworks";
Logger.errorNotify(errMsg, error);
Expand Down
Loading

0 comments on commit 9c9b1ab

Please sign in to comment.