forked from espressif/esp-idf
storage: fix and re-enable -Wformat warnings
This commit is contained in:
@@ -14,5 +14,3 @@ idf_component_register(SRCS ${srcs}
|
|||||||
REQUIRES wear_levelling sdmmc
|
REQUIRES wear_levelling sdmmc
|
||||||
PRIV_REQUIRES vfs
|
PRIV_REQUIRES vfs
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -577,9 +577,9 @@ static off_t vfs_fat_lseek(void* ctx, int fd, off_t offset, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if FF_FS_EXFAT
|
#if FF_FS_EXFAT
|
||||||
ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%lld", __func__, new_pos, f_size(file));
|
ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%" PRIu64, __func__, new_pos, f_size(file));
|
||||||
#else
|
#else
|
||||||
ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%d", __func__, new_pos, f_size(file));
|
ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%" PRIu32, __func__, new_pos, f_size(file));
|
||||||
#endif
|
#endif
|
||||||
FRESULT res = f_lseek(file, new_pos);
|
FRESULT res = f_lseek(file, new_pos);
|
||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
|
@@ -21,5 +21,3 @@ idf_component_register(SRCS ${srcs}
|
|||||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||||
set_source_files_properties(spiffs/src/spiffs_nucleus.c PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation)
|
set_source_files_properties(spiffs/src/spiffs_nucleus.c PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -148,7 +148,7 @@ static esp_err_t esp_spiffs_init(const esp_vfs_spiffs_conf_t* conf)
|
|||||||
uint32_t flash_page_size = g_rom_flashchip.page_size;
|
uint32_t flash_page_size = g_rom_flashchip.page_size;
|
||||||
uint32_t log_page_size = CONFIG_SPIFFS_PAGE_SIZE;
|
uint32_t log_page_size = CONFIG_SPIFFS_PAGE_SIZE;
|
||||||
if (log_page_size % flash_page_size != 0) {
|
if (log_page_size % flash_page_size != 0) {
|
||||||
ESP_LOGE(TAG, "SPIFFS_PAGE_SIZE is not multiple of flash chip page size (%d)",
|
ESP_LOGE(TAG, "SPIFFS_PAGE_SIZE is not multiple of flash chip page size (%" PRIu32 ")",
|
||||||
flash_page_size);
|
flash_page_size);
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
@@ -268,11 +268,11 @@ static esp_err_t esp_spiffs_init(const esp_vfs_spiffs_conf_t* conf)
|
|||||||
efs->cache, efs->cache_sz, spiffs_api_check);
|
efs->cache, efs->cache_sz, spiffs_api_check);
|
||||||
|
|
||||||
if (conf->format_if_mount_failed && res != SPIFFS_OK) {
|
if (conf->format_if_mount_failed && res != SPIFFS_OK) {
|
||||||
ESP_LOGW(TAG, "mount failed, %i. formatting...", SPIFFS_errno(efs->fs));
|
ESP_LOGW(TAG, "mount failed, %" PRId32 ". formatting...", SPIFFS_errno(efs->fs));
|
||||||
SPIFFS_clearerr(efs->fs);
|
SPIFFS_clearerr(efs->fs);
|
||||||
res = SPIFFS_format(efs->fs);
|
res = SPIFFS_format(efs->fs);
|
||||||
if (res != SPIFFS_OK) {
|
if (res != SPIFFS_OK) {
|
||||||
ESP_LOGE(TAG, "format failed, %i", SPIFFS_errno(efs->fs));
|
ESP_LOGE(TAG, "format failed, %" PRId32, SPIFFS_errno(efs->fs));
|
||||||
SPIFFS_clearerr(efs->fs);
|
SPIFFS_clearerr(efs->fs);
|
||||||
esp_spiffs_free(&efs);
|
esp_spiffs_free(&efs);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@@ -281,7 +281,7 @@ static esp_err_t esp_spiffs_init(const esp_vfs_spiffs_conf_t* conf)
|
|||||||
efs->cache, efs->cache_sz, spiffs_api_check);
|
efs->cache, efs->cache_sz, spiffs_api_check);
|
||||||
}
|
}
|
||||||
if (res != SPIFFS_OK) {
|
if (res != SPIFFS_OK) {
|
||||||
ESP_LOGE(TAG, "mount failed, %i", SPIFFS_errno(efs->fs));
|
ESP_LOGE(TAG, "mount failed, %" PRId32, SPIFFS_errno(efs->fs));
|
||||||
SPIFFS_clearerr(efs->fs);
|
SPIFFS_clearerr(efs->fs);
|
||||||
esp_spiffs_free(&efs);
|
esp_spiffs_free(&efs);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@@ -354,7 +354,7 @@ esp_err_t esp_spiffs_format(const char* partition_label)
|
|||||||
|
|
||||||
s32_t res = SPIFFS_format(_efs[index]->fs);
|
s32_t res = SPIFFS_format(_efs[index]->fs);
|
||||||
if (res != SPIFFS_OK) {
|
if (res != SPIFFS_OK) {
|
||||||
ESP_LOGE(TAG, "format failed, %i", SPIFFS_errno(_efs[index]->fs));
|
ESP_LOGE(TAG, "format failed, %" PRId32, SPIFFS_errno(_efs[index]->fs));
|
||||||
SPIFFS_clearerr(_efs[index]->fs);
|
SPIFFS_clearerr(_efs[index]->fs);
|
||||||
/* If the partition was previously mounted, but format failed, don't
|
/* If the partition was previously mounted, but format failed, don't
|
||||||
* try to mount the partition back (it will probably fail). On the
|
* try to mount the partition back (it will probably fail). On the
|
||||||
@@ -371,7 +371,7 @@ esp_err_t esp_spiffs_format(const char* partition_label)
|
|||||||
_efs[index]->fds, _efs[index]->fds_sz, _efs[index]->cache,
|
_efs[index]->fds, _efs[index]->fds_sz, _efs[index]->cache,
|
||||||
_efs[index]->cache_sz, spiffs_api_check);
|
_efs[index]->cache_sz, spiffs_api_check);
|
||||||
if (res != SPIFFS_OK) {
|
if (res != SPIFFS_OK) {
|
||||||
ESP_LOGE(TAG, "mount failed, %i", SPIFFS_errno(_efs[index]->fs));
|
ESP_LOGE(TAG, "mount failed, %" PRId32, SPIFFS_errno(_efs[index]->fs));
|
||||||
SPIFFS_clearerr(_efs[index]->fs);
|
SPIFFS_clearerr(_efs[index]->fs);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ s32_t spiffs_api_read(spiffs *fs, uint32_t addr, uint32_t size, uint8_t *dst)
|
|||||||
esp_err_t err = esp_partition_read(((esp_spiffs_t *)(fs->user_data))->partition,
|
esp_err_t err = esp_partition_read(((esp_spiffs_t *)(fs->user_data))->partition,
|
||||||
addr, dst, size);
|
addr, dst, size);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
ESP_LOGE(TAG, "failed to read addr %08x, size %08x, err %d", addr, size, err);
|
ESP_LOGE(TAG, "failed to read addr 0x%08" PRIx32 ", size 0x%08" PRIx32 ", err %d", addr, size, err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -38,7 +38,7 @@ s32_t spiffs_api_write(spiffs *fs, uint32_t addr, uint32_t size, uint8_t *src)
|
|||||||
esp_err_t err = esp_partition_write(((esp_spiffs_t *)(fs->user_data))->partition,
|
esp_err_t err = esp_partition_write(((esp_spiffs_t *)(fs->user_data))->partition,
|
||||||
addr, src, size);
|
addr, src, size);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
ESP_LOGE(TAG, "failed to write addr %08x, size %08x, err %d", addr, size, err);
|
ESP_LOGE(TAG, "failed to write addr 0x%08" PRIx32 ", size 0x%08" PRIx32 ", err %d", addr, size, err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -49,7 +49,7 @@ s32_t spiffs_api_erase(spiffs *fs, uint32_t addr, uint32_t size)
|
|||||||
esp_err_t err = esp_partition_erase_range(((esp_spiffs_t *)(fs->user_data))->partition,
|
esp_err_t err = esp_partition_erase_range(((esp_spiffs_t *)(fs->user_data))->partition,
|
||||||
addr, size);
|
addr, size);
|
||||||
if (err) {
|
if (err) {
|
||||||
ESP_LOGE(TAG, "failed to erase addr %08x, size %08x, err %d", addr, size, err);
|
ESP_LOGE(TAG, "failed to erase addr 0x%08" PRIx32 ", size 0x%08" PRIx32 ", err %d", addr, size, err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -75,10 +75,10 @@ void spiffs_api_check(spiffs *fs, spiffs_check_type type,
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (report != SPIFFS_CHECK_PROGRESS) {
|
if (report != SPIFFS_CHECK_PROGRESS) {
|
||||||
ESP_LOGE(TAG, "CHECK: type:%s, report:%s, %x:%x", spiffs_check_type_str[type],
|
ESP_LOGE(TAG, "CHECK: type:%s, report:%s, %" PRIx32 ":%" PRIx32, spiffs_check_type_str[type],
|
||||||
spiffs_check_report_str[report], arg1, arg2);
|
spiffs_check_report_str[report], arg1, arg2);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGV(TAG, "CHECK PROGRESS: report:%s, %x:%x",
|
ESP_LOGV(TAG, "CHECK PROGRESS: report:%s, %" PRIx32 ":%" PRIx32,
|
||||||
spiffs_check_report_str[report], arg1, arg2);
|
spiffs_check_report_str[report], arg1, arg2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,5 +23,3 @@ endif()
|
|||||||
# Some newlib syscalls are implemented in vfs.c, make sure these are always
|
# Some newlib syscalls are implemented in vfs.c, make sure these are always
|
||||||
# seen by the linker
|
# seen by the linker
|
||||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u vfs_include_syscalls_impl")
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u vfs_include_syscalls_impl")
|
||||||
|
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES cmock test_utils vfs fatfs spiffs)
|
PRIV_REQUIRES cmock test_utils vfs fatfs spiffs)
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -1047,7 +1047,7 @@ int esp_vfs_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds
|
|||||||
* 1 tick before triggering a timeout. Thus, we need to pass 2 ticks as a timeout
|
* 1 tick before triggering a timeout. Thus, we need to pass 2 ticks as a timeout
|
||||||
* to `xSemaphoreTake`. */
|
* to `xSemaphoreTake`. */
|
||||||
ticks_to_wait = ((timeout_ms + portTICK_PERIOD_MS - 1) / portTICK_PERIOD_MS) + 1;
|
ticks_to_wait = ((timeout_ms + portTICK_PERIOD_MS - 1) / portTICK_PERIOD_MS) + 1;
|
||||||
ESP_LOGD(TAG, "timeout is %dms", timeout_ms);
|
ESP_LOGD(TAG, "timeout is %" PRIu32 "ms", timeout_ms);
|
||||||
}
|
}
|
||||||
ESP_LOGD(TAG, "waiting without calling socket_select");
|
ESP_LOGD(TAG, "waiting without calling socket_select");
|
||||||
xSemaphoreTake(sel_sem.sem, ticks_to_wait);
|
xSemaphoreTake(sel_sem.sem, ticks_to_wait);
|
||||||
|
@@ -195,7 +195,7 @@ static int vfs_semihost_mkdir(void* ctx, const char* path, mode_t mode)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGV(TAG, "%s: '%s 0x%x'", __func__, path, mode);
|
ESP_LOGV(TAG, "%s: '%s 0x%x'", __func__, path, (unsigned) mode);
|
||||||
return semihosting_mkdir(path, mode);
|
return semihosting_mkdir(path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
idf_component_register(SRCS "ext_flash_fatfs_example_main.c")
|
idf_component_register(SRCS "ext_flash_fatfs_example_main.c")
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -83,7 +83,7 @@ void app_main(void)
|
|||||||
// Print FAT FS size information
|
// Print FAT FS size information
|
||||||
uint64_t bytes_total, bytes_free;
|
uint64_t bytes_total, bytes_free;
|
||||||
esp_vfs_fat_info(base_path, &bytes_total, &bytes_free);
|
esp_vfs_fat_info(base_path, &bytes_total, &bytes_free);
|
||||||
ESP_LOGI(TAG, "FAT FS: %lld kB total, %lld kB free", bytes_total / 1024, bytes_free / 1024);
|
ESP_LOGI(TAG, "FAT FS: %" PRIu64 " kB total, %" PRIu64 " kB free", bytes_total / 1024, bytes_free / 1024);
|
||||||
|
|
||||||
// Create a file in FAT FS
|
// Create a file in FAT FS
|
||||||
ESP_LOGI(TAG, "Opening file");
|
ESP_LOGI(TAG, "Opening file");
|
||||||
@@ -157,20 +157,20 @@ static esp_flash_t* example_init_ext_flash(void)
|
|||||||
// Print out the ID and size
|
// Print out the ID and size
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
ESP_ERROR_CHECK(esp_flash_read_id(ext_flash, &id));
|
ESP_ERROR_CHECK(esp_flash_read_id(ext_flash, &id));
|
||||||
ESP_LOGI(TAG, "Initialized external Flash, size=%d KB, ID=0x%x", ext_flash->size / 1024, id);
|
ESP_LOGI(TAG, "Initialized external Flash, size=%" PRIu32 " KB, ID=0x%" PRIx32, ext_flash->size / 1024, id);
|
||||||
|
|
||||||
return ext_flash;
|
return ext_flash;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const esp_partition_t* example_add_partition(esp_flash_t* ext_flash, const char* partition_label)
|
static const esp_partition_t* example_add_partition(esp_flash_t* ext_flash, const char* partition_label)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "Adding external Flash as a partition, label=\"%s\", size=%d KB", partition_label, ext_flash->size / 1024);
|
ESP_LOGI(TAG, "Adding external Flash as a partition, label=\"%s\", size=%" PRIu32 " KB", partition_label, ext_flash->size / 1024);
|
||||||
const esp_partition_t* fat_partition;
|
const esp_partition_t* fat_partition;
|
||||||
const size_t offset = 0;
|
const size_t offset = 0;
|
||||||
ESP_ERROR_CHECK(esp_partition_register_external(ext_flash, offset, ext_flash->size, partition_label, ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, &fat_partition));
|
ESP_ERROR_CHECK(esp_partition_register_external(ext_flash, offset, ext_flash->size, partition_label, ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, &fat_partition));
|
||||||
|
|
||||||
// Erase space of partition on the external flash chip
|
// Erase space of partition on the external flash chip
|
||||||
ESP_LOGI(TAG, "Erasing partition range, offset=%d size=%d KB", offset, ext_flash->size / 1024);
|
ESP_LOGI(TAG, "Erasing partition range, offset=%u size=%" PRIu32 " KB", offset, ext_flash->size / 1024);
|
||||||
ESP_ERROR_CHECK(esp_partition_erase_range(fat_partition, offset, ext_flash->size));
|
ESP_ERROR_CHECK(esp_partition_erase_range(fat_partition, offset, ext_flash->size));
|
||||||
return fat_partition;
|
return fat_partition;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ static void example_list_data_partitions(void)
|
|||||||
|
|
||||||
for (; it != NULL; it = esp_partition_next(it)) {
|
for (; it != NULL; it = esp_partition_next(it)) {
|
||||||
const esp_partition_t *part = esp_partition_get(it);
|
const esp_partition_t *part = esp_partition_get(it);
|
||||||
ESP_LOGI(TAG, "- partition '%s', subtype %d, offset 0x%x, size %d kB",
|
ESP_LOGI(TAG, "- partition '%s', subtype %d, offset 0x%" PRIx32 ", size %" PRIu32 " kB",
|
||||||
part->label, part->subtype, part->address, part->size / 1024);
|
part->label, part->subtype, part->address, part->size / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,3 +1,2 @@
|
|||||||
idf_component_register(SRCS "nvs_blob_example_main.c"
|
idf_component_register(SRCS "nvs_blob_example_main.c"
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
@@ -127,7 +128,7 @@ esp_err_t print_what_saved(void)
|
|||||||
int32_t restart_counter = 0; // value will default to 0, if not set yet in NVS
|
int32_t restart_counter = 0; // value will default to 0, if not set yet in NVS
|
||||||
err = nvs_get_i32(my_handle, "restart_conter", &restart_counter);
|
err = nvs_get_i32(my_handle, "restart_conter", &restart_counter);
|
||||||
if (err != ESP_OK && err != ESP_ERR_NVS_NOT_FOUND) return err;
|
if (err != ESP_OK && err != ESP_ERR_NVS_NOT_FOUND) return err;
|
||||||
printf("Restart counter = %d\n", restart_counter);
|
printf("Restart counter = %" PRIu32 "\n", restart_counter);
|
||||||
|
|
||||||
// Read run time blob
|
// Read run time blob
|
||||||
size_t required_size = 0; // value will default to 0, if not set yet in NVS
|
size_t required_size = 0; // value will default to 0, if not set yet in NVS
|
||||||
@@ -145,7 +146,7 @@ esp_err_t print_what_saved(void)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < required_size / sizeof(uint32_t); i++) {
|
for (int i = 0; i < required_size / sizeof(uint32_t); i++) {
|
||||||
printf("%d: %d\n", i + 1, run_time[i]);
|
printf("%d: %" PRIu32 "\n", i + 1, run_time[i]);
|
||||||
}
|
}
|
||||||
free(run_time);
|
free(run_time);
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,2 @@
|
|||||||
idf_component_register(SRCS "nvs_value_example_main.c"
|
idf_component_register(SRCS "nvs_value_example_main.c"
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
@@ -45,7 +46,7 @@ void app_main(void)
|
|||||||
switch (err) {
|
switch (err) {
|
||||||
case ESP_OK:
|
case ESP_OK:
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
printf("Restart counter = %d\n", restart_counter);
|
printf("Restart counter = %" PRIu32 "\n", restart_counter);
|
||||||
break;
|
break;
|
||||||
case ESP_ERR_NVS_NOT_FOUND:
|
case ESP_ERR_NVS_NOT_FOUND:
|
||||||
printf("The value is not initialized yet!\n");
|
printf("The value is not initialized yet!\n");
|
||||||
|
@@ -1,3 +1,2 @@
|
|||||||
idf_component_register(SRCS "nvs_value_example_main.cpp"
|
idf_component_register(SRCS "nvs_value_example_main.cpp"
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
CONDITIONS OF ANY KIND, either express or implied.
|
CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "nvs.h"
|
#include "nvs.h"
|
||||||
#include "nvs_handle.hpp"
|
#include "nvs_handle.hpp"
|
||||||
@@ -47,7 +48,7 @@ extern "C" void app_main(void)
|
|||||||
switch (err) {
|
switch (err) {
|
||||||
case ESP_OK:
|
case ESP_OK:
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
printf("Restart counter = %d\n", restart_counter);
|
printf("Restart counter = %" PRIu32 "\n", restart_counter);
|
||||||
break;
|
break;
|
||||||
case ESP_ERR_NVS_NOT_FOUND:
|
case ESP_ERR_NVS_NOT_FOUND:
|
||||||
printf("The value is not initialized yet!\n");
|
printf("The value is not initialized yet!\n");
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
idf_component_register(SRCS "main.c"
|
idf_component_register(SRCS "main.c"
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
EMBED_TXTFILES ../partitions_example.csv)
|
EMBED_TXTFILES ../partitions_example.csv)
|
||||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
|
||||||
|
@@ -51,7 +51,7 @@ static void find_partition(esp_partition_type_t type, esp_partition_subtype_t su
|
|||||||
const esp_partition_t * part = esp_partition_find_first(type, subtype, name);
|
const esp_partition_t * part = esp_partition_find_first(type, subtype, name);
|
||||||
|
|
||||||
if (part != NULL) {
|
if (part != NULL) {
|
||||||
ESP_LOGI(TAG, "\tfound partition '%s' at offset 0x%x with size 0x%x", part->label, part->address, part->size);
|
ESP_LOGI(TAG, "\tfound partition '%s' at offset 0x%" PRIx32 " with size 0x%" PRIx32, part->label, part->address, part->size);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "\tpartition not found!");
|
ESP_LOGE(TAG, "\tpartition not found!");
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ void app_main(void)
|
|||||||
// label is found. Verify if its the same instance as the one found before.
|
// label is found. Verify if its the same instance as the one found before.
|
||||||
for (; it != NULL; it = esp_partition_next(it)) {
|
for (; it != NULL; it = esp_partition_next(it)) {
|
||||||
const esp_partition_t *part = esp_partition_get(it);
|
const esp_partition_t *part = esp_partition_get(it);
|
||||||
ESP_LOGI(TAG, "\tfound partition '%s' at offset 0x%x with size 0x%x", part->label, part->address, part->size);
|
ESP_LOGI(TAG, "\tfound partition '%s' at offset 0x%" PRIx32 " with size 0x%" PRIx32, part->label, part->address, part->size);
|
||||||
}
|
}
|
||||||
// Release the partition iterator to release memory allocated for it
|
// Release the partition iterator to release memory allocated for it
|
||||||
esp_partition_iterator_release(it);
|
esp_partition_iterator_release(it);
|
||||||
@@ -115,7 +115,7 @@ void app_main(void)
|
|||||||
// label is found. Verify if its the same instance as the one found before.
|
// label is found. Verify if its the same instance as the one found before.
|
||||||
for (; it != NULL; it = esp_partition_next(it)) {
|
for (; it != NULL; it = esp_partition_next(it)) {
|
||||||
const esp_partition_t *part = esp_partition_get(it);
|
const esp_partition_t *part = esp_partition_get(it);
|
||||||
ESP_LOGI(TAG, "\tfound partition '%s' at offset 0x%x with size 0x%x", part->label, part->address, part->size);
|
ESP_LOGI(TAG, "\tfound partition '%s' at offset 0x%" PRIx32 " with size 0x%" PRIx32, part->label, part->address, part->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release the partition iterator to release memory allocated for it
|
// Release the partition iterator to release memory allocated for it
|
||||||
|
Reference in New Issue
Block a user