Skip to content

Commit e016f9d

Browse files
committed
Merge branch 'feat/mmap_directly' into 'master'
feat: Add flag of COPY_PREBUILT_BIN Closes AEG-2813 See merge request ae_group/esp-iot-solution!1390
2 parents 936713b + bf8eed5 commit e016f9d

File tree

16 files changed

+280
-170
lines changed

16 files changed

+280
-170
lines changed

.gitlab/ci/rules.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,8 @@
22182218
changes: *patterns-build_system
22192219
- <<: *if-dev-push
22202220
changes: *patterns-components_display_tools_esp_lv_decoder
2221+
- <<: *if-dev-push
2222+
changes: *patterns-components_display_tools_esp_mmap_assets
22212223

22222224
.rules:build:components_display_tools_esp_lv_fs_test_apps:
22232225
rules:

components/display/tools/esp_lv_decoder/test_apps/lvgl9/main/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,3 @@ spiffs_create_partition_assets(pjpg ../spiffs_assets FLASH_IN_PROJECT
3232
MMAP_SUPPORT_PJPG
3333
IMPORT_INC_PATH "${CMAKE_CURRENT_SOURCE_DIR}"
3434
)
35-
36-
# Ensure headers are generated before compiling this component
37-
idf_build_get_property(build_components BUILD_COMPONENTS)
38-
foreach(COMPONENT ${build_components})
39-
if(COMPONENT MATCHES "^esp_mmap_assets$" OR COMPONENT MATCHES "^espressif__esp_mmap_assets$")
40-
add_dependencies(${COMPONENT_LIB}
41-
assets_qoi_bin
42-
assets_spng_bin
43-
assets_sjpg_bin
44-
assets_pjpg_bin)
45-
endif()
46-
endforeach()

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.2 (2025-0930)
4+
* Add function png to pjpg
5+
* Add flag COPY_PREBUILT_BIN
6+
37
## v1.3.1~2 (2025-08-13)
48

59
* Support all target.

components/display/tools/esp_mmap_assets/README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ set(one_value_args
5555
MMAP_FILE_SUPPORT_FORMAT,
5656
MMAP_SPLIT_HEIGHT,
5757
MMAP_RAW_FILE_FORMAT
58-
IMPORT_INC_PATH)
58+
IMPORT_INC_PATH
59+
COPY_PREBUILT_BIN)
5960
```
6061

6162
### Option Explanations
@@ -65,15 +66,18 @@ set(one_value_args
6566
- **`FLASH_IN_PROJECT`**: Users can opt to have the image automatically flashed together with the app binaries, partition tables, etc. on `idf.py flash`
6667
- **`FLASH_APPEND_APP`**: Enables appending binary data (`bin`) to the application binary (`app_bin`).
6768
- **`IMPORT_INC_PATH`**: Target path for generated include files. Defaults to referencing component location.
69+
- **`COPY_PREBUILT_BIN`**: Copies pre-generated binary files to target directory. This option allows you to use externally generated asset binaries instead of building them from source files.
6870
- **`MMAP_FILE_SUPPORT_FORMAT`**: Specifies supported file formats (e.g., `.png`, `.jpg`, `.ttf`).
6971
- **`MMAP_SPLIT_HEIGHT`**: Defines height for image splitting to reduce memory usage. Depends on:
7072
- `MMAP_SUPPORT_SJPG`
7173
- `MMAP_SUPPORT_SPNG`
7274
- `MMAP_SUPPORT_SQOI`
75+
- `MMAP_SUPPORT_PJPG`
7376

7477
##### General demo
7578

7679
```c
80+
//general usage
7781
spiffs_create_partition_assets(
7882
my_spiffs_partition
7983
my_folder
@@ -82,8 +86,30 @@ set(one_value_args
8286
)
8387
```
8488

89+
```c
90+
// Animation assets with custom include path
91+
spiffs_create_partition_assets(
92+
anim_boot
93+
"${ASSETS_DIR}/boot"
94+
FLASH_IN_PROJECT
95+
MMAP_FILE_SUPPORT_FORMAT ".aaf,.eaf"
96+
IMPORT_INC_PATH "${ASSETS_DIR}"
97+
)
98+
```
99+
100+
```c
101+
// Pre-built binary assets
102+
spiffs_create_partition_assets(
103+
anim_icon
104+
"${ASSETS_DIR}"
105+
FLASH_IN_PROJECT
106+
COPY_PREBUILT_BIN "${ASSETS_DIR}/prebuilt.bin"
107+
)
108+
```
109+
85110
#### Supported Image Formats
86111

112+
- **`MMAP_SUPPORT_PJPG`**: Enables support for **PJPG** format. Converts PNG to JPG format and uses JPG decoder for PNG files.
87113
- **`MMAP_SUPPORT_SJPG`**: Enables support for **SJPG** format.
88114
- **`MMAP_SUPPORT_SPNG`**: Enables support for **SPNG** format.
89115
- **`MMAP_SUPPORT_QOI`**: Enables support for **QOI** format.

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"support_raw_ff": "@arg_MMAP_RAW_FILE_FORMAT@",
2020
"support_raw_cf": "@arg_MMAP_RAW_COLOR_FORMAT@",
2121
"app_bin_path": "@app_bin_path@",
22-
"pjpg_processor": "@PJPG_PROCESSOR_PATH@"
23-
,"header_asset_name": "@partition@"
22+
"pjpg_processor": "@PJPG_PROCESSOR_PATH@",
23+
"header_asset_name": "@partition@",
24+
"source_bin_path": "@source_bin_path@"
2425
}

components/display/tools/esp_mmap_assets/esp_mmap_assets.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,25 @@ esp_err_t mmap_assets_new(const mmap_assets_config_t *config, mmap_assets_handle
166166

167167
map_asset->stored_files = stored_files;
168168

169-
item = (mmap_assets_item_t *)malloc(sizeof(mmap_assets_item_t) * config->max_files);
169+
item = (mmap_assets_item_t *)malloc(sizeof(mmap_assets_item_t) * stored_files);
170170
ESP_GOTO_ON_FALSE(item, ESP_ERR_NO_MEM, err, TAG, "no mem for asset item");
171171

172172
if (map_asset->flags.mmap_enable) {
173173
mmap_assets_table_t *table = (mmap_assets_table_t *)(root + ASSETS_TABLE_OFFSET);
174-
for (int i = 0; i < config->max_files; i++) {
174+
for (int i = 0; i < stored_files; i++) {
175175
(item + i)->table = (table + i);
176-
(item + i)->asset_mem = (void *)(root + ASSETS_TABLE_OFFSET + config->max_files * sizeof(mmap_assets_table_t) + table[i].asset_offset);
176+
(item + i)->asset_mem = (void *)(root + ASSETS_TABLE_OFFSET + stored_files * sizeof(mmap_assets_table_t) + table[i].asset_offset);
177177
}
178178
} else {
179-
mmap_assets_table_t *table = malloc(sizeof(mmap_assets_table_t) * config->max_files);
180-
for (int i = 0; i < config->max_files; i++) {
179+
mmap_assets_table_t *table = malloc(sizeof(mmap_assets_table_t) * stored_files);
180+
for (int i = 0; i < stored_files; i++) {
181181
esp_partition_read(partition, ASSETS_TABLE_OFFSET + i * sizeof(mmap_assets_table_t), (table + i), sizeof(mmap_assets_table_t));
182182
(item + i)->table = (table + i);
183-
(item + i)->asset_mem = (char *)(ASSETS_TABLE_OFFSET + config->max_files * sizeof(mmap_assets_table_t) + table[i].asset_offset);
183+
(item + i)->asset_mem = (char *)(ASSETS_TABLE_OFFSET + stored_files * sizeof(mmap_assets_table_t) + table[i].asset_offset);
184184
}
185185
}
186186

187-
for (int i = 0; i < config->max_files; i++) {
187+
for (int i = 0; i < stored_files; i++) {
188188
ESP_LOGD(TAG, "[%d], offset:[%" PRIu32 "], size:[%" PRIu32 "], name:%s, %p",
189189
i,
190190
(item + i)->table->asset_offset,
@@ -207,7 +207,7 @@ esp_err_t mmap_assets_new(const mmap_assets_config_t *config, mmap_assets_handle
207207

208208
map_asset->mmap_handle = mmap_handle;
209209
map_asset->item = item;
210-
map_asset->max_asset = config->max_files;
210+
map_asset->max_asset = stored_files;
211211
*ret_item = (mmap_assets_handle_t)map_asset;
212212

213213
ESP_LOGD(TAG, "new asset handle:@%p", map_asset);

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~2
1+
version: 1.3.2
22
dependencies:
33
cmake_utilities:
44
version: 0.*

0 commit comments

Comments
 (0)