Skip to content

Commit 71171cf

Browse files
committed
feat(esp_mmap_assets): add import path support
1 parent 6f25eba commit 71171cf

File tree

12 files changed

+31
-64
lines changed

12 files changed

+31
-64
lines changed

components/display/tools/esp_mmap_assets/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog
22

3+
## v1.3.1~1 (2025-05-30)
4+
5+
* Add IMPORT_INC_PATH support.
6+
37
## v1.3.1 (2025-03-17)
48

59
* Allow appending files to the end of the app_bin.

components/display/tools/esp_mmap_assets/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ set(options
5454
set(one_value_args
5555
MMAP_FILE_SUPPORT_FORMAT,
5656
MMAP_SPLIT_HEIGHT,
57-
MMAP_RAW_FILE_FORMAT)
57+
MMAP_RAW_FILE_FORMAT
58+
IMPORT_INC_PATH)
5859
```
5960

6061
### Option Explanations
@@ -63,6 +64,7 @@ set(one_value_args
6364

6465
- **`FLASH_IN_PROJECT`**: Users can opt to have the image automatically flashed together with the app binaries, partition tables, etc. on `idf.py flash`
6566
- **`FLASH_APPEND_APP`**: Enables appending binary data (`bin`) to the application binary (`app_bin`).
67+
- **`IMPORT_INC_PATH`**: Target path for generated include files. Defaults to referencing component location.
6668
- **`MMAP_FILE_SUPPORT_FORMAT`**: Specifies supported file formats (e.g., `.png`, `.jpg`, `.ttf`).
6769
- **`MMAP_SPLIT_HEIGHT`**: Defines height for image splitting to reduce memory usage. Depends on:
6870
- `MMAP_SUPPORT_SJPG`

components/display/tools/esp_mmap_assets/config_template.json.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"project_dir": "@PROJECT_DIR@",
3-
"main_path": "@CMAKE_CURRENT_LIST_DIR@",
3+
"include_path": "@import_include_path@",
44
"assets_path": "@base_dir_full_path@",
55
"image_file": "@image_file@",
66
"lvgl_ver": "@lvgl_ver@",

components/display/tools/esp_mmap_assets/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1.3.1
1+
version: 1.3.1~1
22
targets:
33
- esp32
44
- esp32c2

components/display/tools/esp_mmap_assets/project_include.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ function(spiffs_create_partition_assets partition base_dir)
1818
set(one_value_args MMAP_FILE_SUPPORT_FORMAT
1919
MMAP_SPLIT_HEIGHT
2020
MMAP_RAW_FILE_FORMAT
21-
MMAP_RAW_COLOR_FORMAT)
21+
MMAP_RAW_COLOR_FORMAT
22+
IMPORT_INC_PATH)
2223

2324
# Define multi-value arguments
2425
set(multi DEPENDS)
@@ -164,6 +165,13 @@ function(spiffs_create_partition_assets partition base_dir)
164165
set(arg_MMAP_SPLIT_HEIGHT 0) # Default value
165166
endif()
166167

168+
# Handle IMPORT_INC_PATH parameter
169+
if(DEFINED arg_IMPORT_INC_PATH)
170+
set(import_include_path ${arg_IMPORT_INC_PATH})
171+
else()
172+
set(import_include_path ${CMAKE_CURRENT_LIST_DIR})
173+
endif()
174+
167175
string(TOLOWER "${arg_MMAP_SUPPORT_SJPG}" support_sjpg)
168176
string(TOLOWER "${arg_MMAP_SUPPORT_SPNG}" support_spng)
169177
string(TOLOWER "${arg_MMAP_SUPPORT_QOI}" support_qoi)

components/display/tools/esp_mmap_assets/spiffs_assets_gen.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class AssetCopyConfig:
4141
@dataclass
4242
class PackModelsConfig:
4343
target_path: str
44-
main_path: str
44+
include_path: str
4545
image_file: str
4646
assets_path: str
4747
name_length: int
@@ -394,7 +394,7 @@ def pack_assets(config: PackModelsConfig):
394394
"""
395395

396396
target_path = config.target_path
397-
assets_c_path = config.main_path
397+
assets_include_path = config.include_path
398398
out_file = config.image_file
399399
assets_path = config.assets_path
400400
max_name_len = config.name_length
@@ -460,11 +460,11 @@ def pack_assets(config: PackModelsConfig):
460460
with open(out_file, 'wb') as output_bin:
461461
output_bin.write(final_data)
462462

463-
os.makedirs(assets_c_path, exist_ok=True)
463+
os.makedirs(assets_include_path, exist_ok=True)
464464
current_year = datetime.now().year
465465

466466
asset_name = os.path.basename(assets_path)
467-
file_path = os.path.join(assets_c_path, f'mmap_generate_{asset_name}.h')
467+
file_path = os.path.join(assets_include_path, f'mmap_generate_{asset_name}.h')
468468
with open(file_path, 'w') as output_header:
469469
output_header.write('/*\n')
470470
output_header.write(' * SPDX-FileCopyrightText: 2022-{} Espressif Systems (Shanghai) CO LTD\n'.format(current_year))
@@ -535,7 +535,7 @@ def process_assets_build(config_data):
535535
assets_path = config_data['assets_path']
536536
image_file = config_data['image_file']
537537
target_path = os.path.dirname(image_file)
538-
main_path = config_data['main_path']
538+
include_path = config_data['include_path']
539539
name_length = config_data['name_length']
540540
split_height = config_data['split_height']
541541
support_format = [fmt.strip() for fmt in config_data['support_format'].split(',')]
@@ -554,7 +554,7 @@ def process_assets_build(config_data):
554554

555555
pack_config = PackModelsConfig(
556556
target_path=target_path,
557-
main_path=main_path,
557+
include_path=include_path,
558558
image_file=image_file,
559559
assets_path=assets_path,
560560
name_length=name_length

components/display/tools/esp_mmap_assets/test_apps/main/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
set(IMPORT_PATH "${CMAKE_SOURCE_DIR}")
12

23
idf_component_register(
34
SRC_DIRS "."
4-
INCLUDE_DIRS "."
5+
INCLUDE_DIRS "." "${IMPORT_PATH}"
56
)
67

78
set(DIR_SRC "${PROJECT_DIR}/spiffs_assets")
@@ -26,4 +27,5 @@ spiffs_create_partition_assets(
2627
FLASH_IN_PROJECT
2728
FLASH_APPEND_APP
2829
MMAP_FILE_SUPPORT_FORMAT ".jpg,.png,.ttf"
30+
IMPORT_INC_PATH "${IMPORT_PATH}"
2931
)

components/display/tools/esp_mmap_assets/test_apps/main/mmap_generate_assert_append.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

components/display/tools/esp_mmap_assets/test_apps/main/mmap_generate_assert_independ.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

components/sensors/radar/at581x/idf_component.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
version: 1.0.0
2-
targets:
3-
targets:
4-
- esp32
5-
- esp32c2
6-
- esp32c3
7-
- esp32c6
8-
- esp32h2
9-
- esp32s2
10-
- esp32s3
112
description: I2C driver for AT581x radar sensor
123
issues: https://github.com/espressif/esp-iot-solution/issues
134
repository: git://github.com/espressif/esp-iot-solution.git

0 commit comments

Comments
 (0)