Skip to content

Commit

Permalink
Merge branch 'feature/esp_usb_ota' into 'master'
Browse files Browse the repository at this point in the history
msc ota: Init version

Closes AEG-715

See merge request ae_group/esp-iot-solution!831
  • Loading branch information
leeebo committed Nov 28, 2023
2 parents 3601485 + 9aa7004 commit 8db53aa
Show file tree
Hide file tree
Showing 27 changed files with 1,681 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/upload_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
components/openai;
components/sensors/humiture/aht20;
components/sensors/radar/at581x;
components/usb/esp_msc_ota;
components/usb/esp_tinyuf2;
components/usb/iot_usbh;
components/usb/iot_usbh_cdc;
Expand Down
8 changes: 8 additions & 0 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,14 @@ build_components_openai_test_apps:
variables:
EXAMPLE_DIR: components/openai/test_apps

build_components_usb_esp_msc_ota_test_apps:
extends:
- .build_examples_template
- .rules:build:components_usb_esp_msc_ota_test_apps
variables:
IMAGE: espressif/idf:release-v5.1
EXAMPLE_DIR: components/usb/esp_msc_ota/test_apps

build_components_usb_usb_stream_test_apps:
extends:
- .build_examples_template
Expand Down
15 changes: 15 additions & 0 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
.patterns-components_tools_cmake_utilities_test_component2: &patterns-components_tools_cmake_utilities_test_component2
- "tools/cmake_utilities/test_apps/components/TEST-component2/**/*"

.patterns-components_usb_esp_msc_ota: &patterns-components_usb_esp_msc_ota
- "components/usb/esp_msc_ota/**/*"
- "components/tools/cmake_utilities/package_manager.cmake"

.patterns-components_usb_iot_usbh: &patterns-components_usb_iot_usbh
- "components/usb/iot_usbh/**/*"
- "components/tools/cmake_utilities/package_manager.cmake"
Expand Down Expand Up @@ -1320,6 +1324,17 @@
- <<: *if-dev-push
changes: *patterns-components_storage_eeprom_at24c02

.rules:build:components_usb_esp_msc_ota_test_apps:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-label-target_test
- <<: *if-trigger-job
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-components_usb_esp_msc_ota

.rules:build:components_usb_iot_usbh_test:
rules:
- <<: *if-protected
Expand Down
22 changes: 22 additions & 0 deletions .gitlab/ci/target_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ components_test_at581x:
TEST_FOLDER: components/sensors/radar
TEST_ENV: ${ENV_TAG}

components_test_esp_msc_ota:
extends:
- .pytest_template
- .rules:build:components_usb_esp_msc_ota_test_apps
needs:
- job: "build_components_usb_esp_msc_ota_test_apps"
artifacts: true
optional: false
parallel:
matrix:
- IDF_TARGET: esp32s3
IDF_VERSION: "5.1"
ENV_TAG: "msc-ota"
tags:
- ${IDF_TARGET}
- ${ENV_TAG}
image: $DOCKER_TARGET_TEST_v5_1_ENV_IMAGE
variables:
TEST_TARGET: ${IDF_TARGET}
TEST_FOLDER: components/usb/esp_msc_ota
TEST_ENV: ${ENV_TAG}

components_test_usb_camera:
extends:
- .pytest_template
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The registered components in ESP-IoT-Solution are listed below:
| [knob](https://components.espressif.com/components/espressif/knob) | [![Component Registry](https://components.espressif.com/components/espressif/knob/badge.svg)](https://components.espressif.com/components/espressif/knob) |
| [led_indicator](https://components.espressif.com/components/espressif/led_indicator) | [![Component Registry](https://components.espressif.com/components/espressif/led_indicator/badge.svg)](https://components.espressif.com/components/espressif/led_indicator) |
| [lightbulb_driver](https://components.espressif.com/components/espressif/lightbulb_driver) | [![Component Registry](https://components.espressif.com/components/espressif/lightbulb_driver/badge.svg)](https://components.espressif.com/components/espressif/lightbulb_driver) |
| [esp_msc_ota](https://components.espressif.com/components/espressif/esp_msc_ota) | [![Component Registry](https://components.espressif.com/components/espressif/esp_msc_ota/badge.svg)](https://components.espressif.com/components/espressif/esp_msc_ota)
| [openai](https://components.espressif.com/components/espressif/openai) | [![Component Registry](https://components.espressif.com/components/espressif/openai/badge.svg)](https://components.espressif.com/components/espressif/openai)
| [pwm_audio](https://components.espressif.com/components/espressif/pwm_audio) | [![Component Registry](https://components.espressif.com/components/espressif/pwm_audio/badge.svg)](https://components.espressif.com/components/espressif/pwm_audio) |
| [usb_device_uvc](https://components.espressif.com/components/espressif/usb_device_uvc) | [![Component Registry](https://components.espressif.com/components/espressif/usb_device_uvc/badge.svg)](https://components.espressif.com/components/espressif/usb_device_uvc) |
Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ESP-IoT-Solution 中注册的组件如下:
| [knob](https://components.espressif.com/components/espressif/knob) | [![Component Registry](https://components.espressif.com/components/espressif/knob/badge.svg)](https://components.espressif.com/components/espressif/knob) |
| [led_indicator](https://components.espressif.com/components/espressif/led_indicator) | [![Component Registry](https://components.espressif.com/components/espressif/led_indicator/badge.svg)](https://components.espressif.com/components/espressif/led_indicator) |
| [lightbulb_driver](https://components.espressif.com/components/espressif/lightbulb_driver) | [![Component Registry](https://components.espressif.com/components/espressif/lightbulb_driver/badge.svg)](https://components.espressif.com/components/espressif/lightbulb_driver) |
| [esp_msc_ota](https://components.espressif.com/components/espressif/esp_msc_ota) | [![Component Registry](https://components.espressif.com/components/espressif/esp_msc_ota/badge.svg)](https://components.espressif.com/components/espressif/esp_msc_ota) |
| [openai](https://components.espressif.com/components/espressif/openai) | [![Component Registry](https://components.espressif.com/components/espressif/openai/badge.svg)](https://components.espressif.com/components/espressif/openai) |
| [pwm_audio](https://components.espressif.com/components/espressif/pwm_audio) | [![Component Registry](https://components.espressif.com/components/espressif/pwm_audio/badge.svg)](https://components.espressif.com/components/espressif/pwm_audio) |
| [usb_device_uvc](https://components.espressif.com/components/espressif/usb_device_uvc) | [![Component Registry](https://components.espressif.com/components/espressif/usb_device_uvc/badge.svg)](https://components.espressif.com/components/espressif/usb_device_uvc) |
Expand Down
4 changes: 4 additions & 0 deletions components/.build-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ components/sensors/radar/at581x/test_apps:
enable:
- if: INCLUDE_DEFAULT == 1

components/usb/esp_msc_ota/test_apps:
enable:
- if: SOC_USB_OTG_SUPPORTED == 1

components/display/lcd/esp_lcd_gc9b71/test_apps:
enable:
- if: INCLUDE_DEFAULT == 1
Expand Down
8 changes: 8 additions & 0 deletions components/usb/esp_msc_ota/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# changelog

## v0.1.0 - 2023-8-15

### Enhancements:

* Support MSC hot-plug
* Support MSC OTA process management
3 changes: 3 additions & 0 deletions components/usb/esp_msc_ota/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
idf_component_register(SRC_DIRS "."
INCLUDE_DIRS "." "include"
REQUIRES esp_event bootloader_support esp_app_format usb fatfs app_update vfs)
12 changes: 12 additions & 0 deletions components/usb/esp_msc_ota/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
menu "MSC OTA Config"

config BASE_PATH
string
default "/usb"
help
Base VFS path to be used to access file storage

config MSC_PRINT_DESC
bool "Print descriptor info"
default y
endmenu
44 changes: 44 additions & 0 deletions components/usb/esp_msc_ota/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[![Component Registry](https://components.espressif.com/components/espressif/esp_msc_ota/badge.svg)](https://components.espressif.com/components/espressif/esp_msc_ota)

## Introduction to ESP MSC OTA Component

``esp_msc_ota`` is a USB disk OTA program based on ESP32 USB OTG peripheral.

* Supports hot-plugging of USB disk.
* Supports USB disk OTA functionality.

### Adding the Component to the Project

Please use the component manager command `add-dependency` to add `esp_msc_ota` as a dependency to your project. During the `CMake` execution, this component will be automatically downloaded to the project directory.

```
idf.py add-dependency "espressif/esp_msc_ota=*"
```

## Usage Example

```C
esp_event_loop_create_default();
ESP_ERROR_CHECK(esp_event_handler_register(ESP_MSC_OTA_EVENT, ESP_EVENT_ANY_ID, &msc_ota_event_handler, NULL));
esp_msc_host_config_t msc_host_config = {
.base_path = "/usb",
.host_driver_config = DEFAULT_MSC_HOST_DRIVER_CONFIG(),
.vfs_fat_mount_config = DEFAULT_ESP_VFS_FAT_MOUNT_CONFIG(),
.host_config = DEFAULT_USB_HOST_CONFIG()
};
esp_msc_host_handle_t host_handle = NULL;
esp_msc_host_install(&msc_host_config, &host_handle);
esp_msc_ota_config_t config = {
.ota_bin_path = "/usb/ota_test.bin",
.wait_msc_connect = pdMS_TO_TICKS(5000),
};
esp_msc_ota(&config);
esp_msc_host_uninstall(host_handle);
```
## Notes
* For the default file system, filenames should not exceed 11 characters. If support for long-named files is needed, please enable any of the macros below:
* CONFIG_FATFS_LFN_HEAP
* CONFIG_FATFS_LFN_STACK
44 changes: 44 additions & 0 deletions components/usb/esp_msc_ota/README_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[![Component Registry](https://components.espressif.com/components/espressif/esp_msc_ota/badge.svg)](https://components.espressif.com/components/espressif/esp_msc_ota)

## ESP MSC OTA 组件介绍

``esp_msc_ota`` 是基于 ESP32 USB OTG 外设的 U 盘 OTA 程序。

* 支持 U 盘热插拔
* 支持 U 盘 OTA 功能。

### 添加组件到工程

请使用组件管理器指令 `add-dependency``esp_msc_ota` 添加到项目的依赖项, 在 `CMake` 执行期间该组件将被自动下载到工程目录。

```
idf.py add-dependency "espressif/esp_msc_ota=*"
```

## 使用示例

```C
esp_event_loop_create_default();
ESP_ERROR_CHECK(esp_event_handler_register(ESP_MSC_OTA_EVENT, ESP_EVENT_ANY_ID, &msc_ota_event_handler, NULL));
esp_msc_host_config_t msc_host_config = {
.base_path = "/usb",
.host_driver_config = DEFAULT_MSC_HOST_DRIVER_CONFIG(),
.vfs_fat_mount_config = DEFAULT_ESP_VFS_FAT_MOUNT_CONFIG(),
.host_config = DEFAULT_USB_HOST_CONFIG()
};
esp_msc_host_handle_t host_handle = NULL;
esp_msc_host_install(&msc_host_config, &host_handle);
esp_msc_ota_config_t config = {
.ota_bin_path = "/usb/ota_test.bin",
.wait_msc_connect = pdMS_TO_TICKS(5000),
};
esp_msc_ota(&config);
esp_msc_host_uninstall(host_handle);
```
## 注意事项
* 默认的文件系统,文件名不要超过 11 个字,如果需要支持长命名文件。请打开下方的任意宏
* CONFIG_FATFS_LFN_HEAP
* CONFIG_FATFS_LFN_STACK
Loading

0 comments on commit 8db53aa

Please sign in to comment.