From d49077c13b1a8ea219bb71e120b38bb196b786bf Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Tue, 5 Nov 2019 14:52:14 +0800 Subject: [PATCH] spiffs: fix build issue on clean project From issue: I did some poking around in components/spiffs/project_include.cmake and it looks like what is failing is it isn't getting an offset from parttool.py. I think what the problem is that the parttool.py cannot determine the offset of the storage partition as I can't run menuconfig to set the custom partitions. I have tested that this problem is solvable by manually setting the custom partitions in sdkconfig and that is a workaround but there should be at least a better error message in the configuration when it cannot find the partition as this would also happen if the partition name was misspelled. Closes https://github.com/espressif/esp-idf/issues/4236 --- components/spiffs/project_include.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/spiffs/project_include.cmake b/components/spiffs/project_include.cmake index 31f63b511..c8d1ad33b 100644 --- a/components/spiffs/project_include.cmake +++ b/components/spiffs/project_include.cmake @@ -15,6 +15,16 @@ function(spiffs_create_partition_image partition base_dir) partition_table_get_partition_info(size "--partition-name ${partition}" "size") partition_table_get_partition_info(offset "--partition-name ${partition}" "offset") + if(NOT "${size}") + message(WARNING "spiffsgen: Unable to resolve size of partition '${partition}'. " + "Check config if using correct partition table.") + endif() + + if(NOT "${offset}") + message(WARNING "spiffsgen: Unable to resolve offset of partition '${partition}'. " + "Check config if using correct partition table.") + endif() + set(image_file ${CMAKE_BINARY_DIR}/${partition}.bin) if(CONFIG_SPIFFS_USE_MAGIC) @@ -42,8 +52,8 @@ function(spiffs_create_partition_image partition base_dir) ${image_file}) if(arg_FLASH_IN_PROJECT) - esptool_py_flash_project_args(${partition} ${offset} ${image_file} FLASH_IN_PROJECT) + esptool_py_flash_project_args("${partition}" "${offset}" "${image_file}" FLASH_IN_PROJECT) else() - esptool_py_flash_project_args(${partition} ${offset} ${image_file}) + esptool_py_flash_project_args("${partition}" "${offset}" "${image_file}") endif() endfunction() \ No newline at end of file