From 3d1187822d1de139e6ec89c65e7d121ff1f66bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Mon, 1 Mar 2021 11:06:35 +0000 Subject: [PATCH] Improve partition tables generation (#1839) ***NO_CI*** --- .../ESP32_WROOM_32/CMakeLists.txt | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/CMakeLists.txt b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/CMakeLists.txt index 3db915192c..a6a1a92faf 100644 --- a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/CMakeLists.txt +++ b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/CMakeLists.txt @@ -223,36 +223,39 @@ set(GEN_ESP32_BIN_PATH ${EXECUTABLE_OUTPUT_PATH} ) set(NANOCLR_BIN_FILE ${GEN_ESP32_BIN_PATH}/${NANOCLR_PROJECT_NAME}.bin) set(ESPTOOL_PY_FILE ${ESP32_IDF_PATH}/components/esptool_py/esptool/esptool.py ) set(ESPTOOL_PY_FLAGS "--chip" "esp32" "elf2image" "--flash_mode" "dio" "--flash_freq" "40m" "--flash_size" "4MB" ) -message("ESPTOOL_PY_FLAGS:${ESPTOOL_PY_FLAGS}" ) -set(GEN_ESP32PART_PY_FILE ${ESP32_IDF_PATH}/components/partition_table/gen_esp32part.py ) +# message("ESPTOOL_PY_FLAGS:${ESPTOOL_PY_FLAGS}" ) add_custom_command( TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD COMMAND ${ESPTOOL_PY_FILE} ${ESPTOOL_PY_FLAGS} -o ${NANOCLR_BIN_FILE} ${EXECUTABLE_OUTPUT_PATH}/${NANOCLR_PROJECT_NAME}.elf COMMENT "Generate nanoCLR BIN file for deployment" ) -# # Create partition table +# Create partition tables +set(ESP32_PARTITION_TABLE_UTILITY ${ESP32_IDF_PATH}/components/partition_table/gen_esp32part.py ) + add_custom_command( TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD - COMMAND ${GEN_ESP32PART_PY_FILE} --verify ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_16mb.csv - ${GEN_ESP32_BIN_PATH}/partitions_16mb.bin - COMMAND ${GEN_ESP32PART_PY_FILE} --verify ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_8mb.csv - ${GEN_ESP32_BIN_PATH}/partitions_8mb.bin - COMMAND ${GEN_ESP32PART_PY_FILE} --verify ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_4mb.csv - ${GEN_ESP32_BIN_PATH}/partitions_4mb.bin - COMMAND ${GEN_ESP32PART_PY_FILE} --verify ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_2mb.csv - ${GEN_ESP32_BIN_PATH}/partitions_2mb.bin - COMMENT "Generate Esp32 Partition tables for 2MB, 4MB, 8MB and 16MB flash" ) - -# list partition table + COMMAND ${ESP32_PARTITION_TABLE_UTILITY} + --flash-size 16MB + ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_16mb.csv + ${GEN_ESP32_BIN_PATH}/partitions_16mb.bin + COMMENT "Generate ESP32 partition table for 16MB flash" ) + add_custom_command( TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD - COMMAND ${GEN_ESP32PART_PY_FILE} ${GEN_ESP32_BIN_PATH}/partitions_4mb.bin - COMMENT "List flash 4Mb Esp32 Partition tables" -) + COMMAND ${ESP32_PARTITION_TABLE_UTILITY} + --flash-size 8MB + ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_8mb.csv + ${GEN_ESP32_BIN_PATH}/partitions_8mb.bin + COMMENT "Generate ESP32 partition table for 8MB flash" ) -#message("CMAKE_CXX_FLAGS:${CMAKE_CXX_FLAGS}" ) -#message("CMAKE_EXE_LINKER_FLAGS:${CMAKE_EXE_LINKER_FLAGS}" ) -#message("CMAKE_EXE_LINKER_FLAGS_DEBUG:${CMAKE_EXE_LINKER_FLAGS_DEBUG}" ) -#message("CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT:${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}" ) -#message("CMAKE_CXX_LINK_EXECUTABLE:${CMAKE_CXX_LINK_EXECUTABLE}" ) -#message("CMAKE_C_LINK_EXECUTABLE:${CMAKE_C_LINK_EXECUTABLE}" ) -#message("FLAGS:${FLAGS}" ) -#message("TARGET_ESP32_IDF_INCLUDES:${TARGET_ESP32_IDF_INCLUDES}" ) +add_custom_command( TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD + COMMAND ${ESP32_PARTITION_TABLE_UTILITY} + --flash-size 4MB + ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_4mb.csv + ${GEN_ESP32_BIN_PATH}/partitions_4mb.bin + COMMENT "Generate Esp32 partition table for 4MB flash" ) + +add_custom_command( TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD + COMMAND ${ESP32_PARTITION_TABLE_UTILITY} + --flash-size 2MB + ${CMAKE_SOURCE_DIR}/targets/FreeRTOS_ESP32/ESP32_WROOM_32/IDF/partitions_nanoclr_2mb.csv + ${GEN_ESP32_BIN_PATH}/partitions_2mb.bin + COMMENT "Generate Esp32 partition table for 2MB flash" )