diff --git a/.github/workflows/build-applications.yml b/.github/workflows/build-applications.yml index 0a3b011c..a10b4bd7 100644 --- a/.github/workflows/build-applications.yml +++ b/.github/workflows/build-applications.yml @@ -61,7 +61,7 @@ jobs: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | . ${IDF_PATH}/export.sh - pip install idf-component-manager==1.* ruamel.yaml idf-build-apps==2.4.3 --upgrade + pip install --upgrade idf-component-manager==1.* ruamel.yaml idf-build-apps==2.4.3 pypng lz4 echo "Files changed: ${ALL_CHANGED_FILES}" idf-build-apps find --modified-files "${ALL_CHANGED_FILES}" diff --git a/examples/display/CMakeLists.txt b/examples/display/CMakeLists.txt index db3ca766..d6f2f9be 100644 --- a/examples/display/CMakeLists.txt +++ b/examples/display/CMakeLists.txt @@ -4,6 +4,5 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(COMPONENTS main) # "Trim" the build. Include the minimal set of components; main and anything it depends on. include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(display) diff --git a/examples/display/main/CMakeLists.txt b/examples/display/main/CMakeLists.txt index 838a18b1..12a3f1ce 100644 --- a/examples/display/main/CMakeLists.txt +++ b/examples/display/main/CMakeLists.txt @@ -1,6 +1,15 @@ idf_component_register(SRCS "display_main.c" "lvgl_demo_ui.c" INCLUDE_DIRS ".") -lvgl_port_create_c_image("images/esp_logo.png" "images/gen/" "ARGB8888" "NONE") -lvgl_port_create_c_image("images/esp_text.png" "images/gen/" "ARGB8888" "NONE") -lvgl_port_add_images(${COMPONENT_LIB} "images/gen/") +spiffs_create_partition_assets( + storage + "./images" + FLASH_IN_PROJECT + MMAP_FILE_SUPPORT_FORMAT ".png" + MMAP_SUPPORT_RAW + MMAP_RAW_COLOR_FORMAT "ARGB8888" +) + +idf_component_get_property(lib espressif__esp_lv_fs COMPONENT_LIB) +target_compile_options(${lib} PRIVATE -Wno-incompatible-pointer-types -Wno-implicit-function-declaration) + diff --git a/examples/display/main/display_main.c b/examples/display/main/display_main.c index a7115d6b..43da8e18 100644 --- a/examples/display/main/display_main.c +++ b/examples/display/main/display_main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: CC0-1.0 */ @@ -9,11 +9,48 @@ #include "lvgl.h" #include "esp_log.h" +#include "esp_lv_fs.h" +#include "mmap_generate_images.h" + extern void example_lvgl_demo_ui(lv_obj_t *scr); +static const char *TAG = "display"; + +esp_err_t example_mount_fs(void) +{ + esp_err_t ret; + esp_lv_fs_handle_t fs_drive_handle; + mmap_assets_handle_t mmap_drive_handle; + + const mmap_assets_config_t asset_cfg = { + .partition_label = "storage", + .max_files = MMAP_IMAGES_FILES, + .checksum = MMAP_IMAGES_CHECKSUM, + .flags = {.mmap_enable = true} + }; + ret = mmap_assets_new(&asset_cfg, &mmap_drive_handle); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to initialize %s", "storage"); + return ret; + } + + fs_cfg_t filesystem_cfg; + filesystem_cfg.fs_letter = 'A'; + filesystem_cfg.fs_assets = mmap_drive_handle; + filesystem_cfg.fs_nums = MMAP_IMAGES_FILES; + + ret = esp_lv_fs_desc_init(&filesystem_cfg, &fs_drive_handle); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to initialize FS for %s", "storage"); + return ret; + } + return ESP_OK; +} + void app_main(void) { bsp_display_start(); + example_mount_fs(); ESP_LOGI("example", "Display LVGL animation"); bsp_display_lock(0); diff --git a/examples/display/main/idf_component.yml b/examples/display/main/idf_component.yml index 772f667d..cbac1eef 100644 --- a/examples/display/main/idf_component.yml +++ b/examples/display/main/idf_component.yml @@ -4,3 +4,5 @@ dependencies: esp_wrover_kit: version: "*" override_path: "../../../bsp/esp_wrover_kit" + esp_mmap_assets: "1.*" + esp_lv_fs: "0.1.*" diff --git a/examples/display/main/lvgl_demo_ui.c b/examples/display/main/lvgl_demo_ui.c index 9eb6da10..ff55e5d2 100644 --- a/examples/display/main/lvgl_demo_ui.c +++ b/examples/display/main/lvgl_demo_ui.c @@ -54,7 +54,7 @@ static void anim_timer_cb(lv_timer_t *timer) // Create new image and make it transparent img_text = lv_img_create(scr); - lv_img_set_src(img_text, &esp_text); + lv_img_set_src(img_text, "A:esp_text.bin"); lv_obj_set_style_img_opa(img_text, 0, 0); } @@ -78,7 +78,7 @@ void example_lvgl_demo_ui(lv_obj_t *scr) { // Create image img_logo = lv_img_create(scr); - lv_img_set_src(img_logo, &esp_logo); + lv_img_set_src(img_logo, "A:esp_logo.bin"); lv_obj_center(img_logo); // Create arcs diff --git a/examples/display/main/mmap_generate_images.h b/examples/display/main/mmap_generate_images.h new file mode 100644 index 00000000..c3be86aa --- /dev/null +++ b/examples/display/main/mmap_generate_images.h @@ -0,0 +1,22 @@ +/* + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief This file was generated by esp_mmap_assets, don't modify it + */ + +#pragma once + +#include "esp_mmap_assets.h" + +#define MMAP_IMAGES_FILES 2 +#define MMAP_IMAGES_CHECKSUM 0xC382 + +enum MMAP_IMAGES_LISTS { + MMAP_IMAGES_ESP_LOGO_BIN = 0, /*!< esp_logo.bin */ + MMAP_IMAGES_ESP_TEXT_BIN = 1, /*!< esp_text.bin */ +}; diff --git a/examples/display/partitions.csv b/examples/display/partitions.csv new file mode 100644 index 00000000..7749fe18 --- /dev/null +++ b/examples/display/partitions.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild +nvs, data, nvs, 0x9000, 0x6000, +phy_init, data, phy, 0xf000, 0x1000, +factory, app, factory, 0x10000, 1M, +storage, data, spiffs, 0x110000,0x2f0000, diff --git a/examples/display/sdkconfig.bsp.esp-box b/examples/display/sdkconfig.bsp.esp-box index 3ff98e29..0ec06315 100644 --- a/examples/display/sdkconfig.bsp.esp-box +++ b/examples/display/sdkconfig.bsp.esp-box @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp-box-3 b/examples/display/sdkconfig.bsp.esp-box-3 index 3ff98e29..0ec06315 100644 --- a/examples/display/sdkconfig.bsp.esp-box-3 +++ b/examples/display/sdkconfig.bsp.esp-box-3 @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp-box-lite b/examples/display/sdkconfig.bsp.esp-box-lite index 3ff98e29..0ec06315 100644 --- a/examples/display/sdkconfig.bsp.esp-box-lite +++ b/examples/display/sdkconfig.bsp.esp-box-lite @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp32_c3_lcdkit b/examples/display/sdkconfig.bsp.esp32_c3_lcdkit index 0250a4ac..af8e30a6 100644 --- a/examples/display/sdkconfig.bsp.esp32_c3_lcdkit +++ b/examples/display/sdkconfig.bsp.esp32_c3_lcdkit @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp32_p4_function_ev_board b/examples/display/sdkconfig.bsp.esp32_p4_function_ev_board index e3d4fd25..5a5af007 100644 --- a/examples/display/sdkconfig.bsp.esp32_p4_function_ev_board +++ b/examples/display/sdkconfig.bsp.esp32_p4_function_ev_board @@ -12,6 +12,7 @@ CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_HEX=y CONFIG_SPIRAM_SPEED_200M=y CONFIG_IDF_EXPERIMENTAL_FEATURES=y +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_MEM_SIZE_KILOBYTES=48 diff --git a/examples/display/sdkconfig.bsp.esp32_s2_kaluga_kit b/examples/display/sdkconfig.bsp.esp32_s2_kaluga_kit index 9eb3f87f..cbac4114 100644 --- a/examples/display/sdkconfig.bsp.esp32_s2_kaluga_kit +++ b/examples/display/sdkconfig.bsp.esp32_s2_kaluga_kit @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp32_s3_eye b/examples/display/sdkconfig.bsp.esp32_s3_eye index 8d117a9c..3807cee4 100644 --- a/examples/display/sdkconfig.bsp.esp32_s3_eye +++ b/examples/display/sdkconfig.bsp.esp32_s3_eye @@ -8,6 +8,7 @@ CONFIG_LV_SPRINTF_CUSTOM=y CONFIG_BSP_DISPLAY_LVGL_TICK=5 CONFIG_BSP_DISPLAY_LVGL_MAX_SLEEP=500 # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 index 3ff98e29..0ec06315 100644 --- a/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp32_s3_lcd_ev_board b/examples/display/sdkconfig.bsp.esp32_s3_lcd_ev_board index a045251f..3ad9064b 100644 --- a/examples/display/sdkconfig.bsp.esp32_s3_lcd_ev_board +++ b/examples/display/sdkconfig.bsp.esp32_s3_lcd_ev_board @@ -17,6 +17,7 @@ CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp32_s3_usb_otg b/examples/display/sdkconfig.bsp.esp32_s3_usb_otg index 3ff98e29..0ec06315 100644 --- a/examples/display/sdkconfig.bsp.esp32_s3_usb_otg +++ b/examples/display/sdkconfig.bsp.esp32_s3_usb_otg @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.esp_wrover_kit b/examples/display/sdkconfig.bsp.esp_wrover_kit index 54b8794f..29b110ea 100644 --- a/examples/display/sdkconfig.bsp.esp_wrover_kit +++ b/examples/display/sdkconfig.bsp.esp_wrover_kit @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.m5dial b/examples/display/sdkconfig.bsp.m5dial index 08ebacc7..10dc57f6 100644 --- a/examples/display/sdkconfig.bsp.m5dial +++ b/examples/display/sdkconfig.bsp.m5dial @@ -4,6 +4,7 @@ CONFIG_IDF_TARGET="esp32s3" CONFIG_ESPTOOLPY_FLASHMODE_QIO=y CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.m5stack_core_2 b/examples/display/sdkconfig.bsp.m5stack_core_2 index 2394a8df..321a3a0d 100644 --- a/examples/display/sdkconfig.bsp.m5stack_core_2 +++ b/examples/display/sdkconfig.bsp.m5stack_core_2 @@ -4,6 +4,7 @@ CONFIG_IDF_TARGET="esp32" CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.bsp.m5stack_core_s3 b/examples/display/sdkconfig.bsp.m5stack_core_s3 index be1840e4..b4a53dca 100644 --- a/examples/display/sdkconfig.bsp.m5stack_core_s3 +++ b/examples/display/sdkconfig.bsp.m5stack_core_s3 @@ -5,6 +5,7 @@ CONFIG_IDF_TARGET="esp32s3" CONFIG_ESPTOOLPY_FLASHMODE_QIO=y CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display/sdkconfig.defaults b/examples/display/sdkconfig.defaults index 54b8794f..29b110ea 100644 --- a/examples/display/sdkconfig.defaults +++ b/examples/display/sdkconfig.defaults @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_PARTITION_TABLE_CUSTOM=y ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y