Skip to content

Commit

Permalink
Merge branch 'feature/storage_esp_partition_linux_file' into 'master'
Browse files Browse the repository at this point in the history
ESP Partition/Linux: Extended control of file emulating flash memory

Closes IDF-4701

See merge request espressif/esp-idf!22110
  • Loading branch information
pacucha42 committed Mar 4, 2023
2 parents f16e7db + abc4d67 commit 6987526
Show file tree
Hide file tree
Showing 10 changed files with 825 additions and 137 deletions.
10 changes: 10 additions & 0 deletions components/esp_partition/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ idf_component_register(SRCS "${srcs}"
REQUIRES ${reqs}
PRIV_REQUIRES ${priv_reqs})

if(${target} STREQUAL "linux")
# link bsd library for strlcpy
find_library(LIB_BSD bsd)
if(LIB_BSD)
target_link_libraries(${COMPONENT_LIB} PRIVATE ${LIB_BSD})
elseif(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
message(WARNING "Missing LIBBSD library. Install libbsd-dev package and/or check linker directories.")
endif()
endif()

if(CMAKE_C_COMPILER_ID MATCHES "GNU")
# These flags are GCC specific
set_property(SOURCE ${cache_srcs} APPEND_STRING PROPERTY COMPILE_FLAGS
Expand Down
8 changes: 4 additions & 4 deletions components/esp_partition/Kconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
menu "ESP_PARTITION"
menu "Partition API Configuration"

config ESP_PARTITION_ENABLE_STATS
bool "Enable esp_partition statistics gathering"
default n
bool "Host test statistics enabled"
depends on IDF_TARGET_LINUX
default n
help
This option enables statistics gathering and flash wear simulation. Linux only.
This option enables gathering host test statistics and SPI flash wear levelling simulation.

endmenu
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,38 @@ set(COMPONENTS main)
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")

project(partition_api_test)

#extra step to build 8M partition table on top of (default) 4M partition table built by partition-table dependency
set(flashsize_opt --flash-size 8MB)
set(partition_csv "partition_table_8M.csv")
set(partition_bin "partition-table_8M.bin")

idf_build_get_property(build_dir BUILD_DIR)
idf_build_get_property(python PYTHON)

set(gen_partition_table "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../partition_table/gen_esp32part.py" "-q"
"${flashsize_opt}" "--")

set(partition_table_display
COMMAND ${CMAKE_COMMAND} -E echo "Partition table binary generated. Contents:"
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
COMMAND ${gen_partition_table} "${build_dir}/partition_table/${partition_bin}"
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
)

add_custom_command(OUTPUT "${build_dir}/partition_table/${partition_bin}"
COMMAND ${gen_partition_table}
"${CMAKE_CURRENT_SOURCE_DIR}/${partition_csv}"
"${build_dir}/partition_table/${partition_bin}"
${partition_table_display}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${partition_csv}
VERBATIM)

add_custom_target(partition_table_bin_8M DEPENDS "${build_dir}/partition_table/${partition_bin}"
)
add_custom_target(partition-table-8M
DEPENDS partition_table_bin_8M
${partition_table_display}
VERBATIM)

add_dependencies(partition_api_test.elf partition-table partition-table-8M)
Loading

0 comments on commit 6987526

Please sign in to comment.