-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/esp_usb_ota' into 'master'
msc ota: Init version Closes AEG-715 See merge request ae_group/esp-iot-solution!831
- Loading branch information
Showing
27 changed files
with
1,681 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.