Skip to content

Commit 6987526

Browse files
committed
Merge branch 'feature/storage_esp_partition_linux_file' into 'master'
ESP Partition/Linux: Extended control of file emulating flash memory Closes IDF-4701 See merge request espressif/esp-idf!22110
2 parents f16e7db + abc4d67 commit 6987526

File tree

10 files changed

+825
-137
lines changed

10 files changed

+825
-137
lines changed

components/esp_partition/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ idf_component_register(SRCS "${srcs}"
2121
REQUIRES ${reqs}
2222
PRIV_REQUIRES ${priv_reqs})
2323

24+
if(${target} STREQUAL "linux")
25+
# link bsd library for strlcpy
26+
find_library(LIB_BSD bsd)
27+
if(LIB_BSD)
28+
target_link_libraries(${COMPONENT_LIB} PRIVATE ${LIB_BSD})
29+
elseif(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
30+
message(WARNING "Missing LIBBSD library. Install libbsd-dev package and/or check linker directories.")
31+
endif()
32+
endif()
33+
2434
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
2535
# These flags are GCC specific
2636
set_property(SOURCE ${cache_srcs} APPEND_STRING PROPERTY COMPILE_FLAGS

components/esp_partition/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
menu "ESP_PARTITION"
1+
menu "Partition API Configuration"
22

33
config ESP_PARTITION_ENABLE_STATS
4-
bool "Enable esp_partition statistics gathering"
5-
default n
4+
bool "Host test statistics enabled"
65
depends on IDF_TARGET_LINUX
6+
default n
77
help
8-
This option enables statistics gathering and flash wear simulation. Linux only.
8+
This option enables gathering host test statistics and SPI flash wear levelling simulation.
99

1010
endmenu

components/esp_partition/host_test/partition_api_test/CMakeLists.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,38 @@ set(COMPONENTS main)
77
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
88

99
project(partition_api_test)
10+
11+
#extra step to build 8M partition table on top of (default) 4M partition table built by partition-table dependency
12+
set(flashsize_opt --flash-size 8MB)
13+
set(partition_csv "partition_table_8M.csv")
14+
set(partition_bin "partition-table_8M.bin")
15+
16+
idf_build_get_property(build_dir BUILD_DIR)
17+
idf_build_get_property(python PYTHON)
18+
19+
set(gen_partition_table "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../partition_table/gen_esp32part.py" "-q"
20+
"${flashsize_opt}" "--")
21+
22+
set(partition_table_display
23+
COMMAND ${CMAKE_COMMAND} -E echo "Partition table binary generated. Contents:"
24+
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
25+
COMMAND ${gen_partition_table} "${build_dir}/partition_table/${partition_bin}"
26+
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
27+
)
28+
29+
add_custom_command(OUTPUT "${build_dir}/partition_table/${partition_bin}"
30+
COMMAND ${gen_partition_table}
31+
"${CMAKE_CURRENT_SOURCE_DIR}/${partition_csv}"
32+
"${build_dir}/partition_table/${partition_bin}"
33+
${partition_table_display}
34+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${partition_csv}
35+
VERBATIM)
36+
37+
add_custom_target(partition_table_bin_8M DEPENDS "${build_dir}/partition_table/${partition_bin}"
38+
)
39+
add_custom_target(partition-table-8M
40+
DEPENDS partition_table_bin_8M
41+
${partition_table_display}
42+
VERBATIM)
43+
44+
add_dependencies(partition_api_test.elf partition-table partition-table-8M)

0 commit comments

Comments
 (0)