Merge branch 'experiments/posix_fs' into feature/spiffs
This commit is contained in:
commit
6484c57737
5 changed files with 71 additions and 6 deletions
11
examples/posix_fs/Makefile
Normal file
11
examples/posix_fs/Makefile
Normal file
|
@ -0,0 +1,11 @@
|
|||
PROGRAM=posix_fs_example
|
||||
PROGRAM_EXTRA_SRC_FILES=./fs-test/fs_test.c
|
||||
|
||||
EXTRA_COMPONENTS = extras/spiffs
|
||||
FLASH_SIZE = 32
|
||||
|
||||
# spiffs configuration
|
||||
SPIFFS_BASE_ADDR = 0x200000
|
||||
SPIFFS_SIZE = 0x100000
|
||||
|
||||
include ../../common.mk
|
1
examples/posix_fs/fs-test
Submodule
1
examples/posix_fs/fs-test
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 218c5235584429f407d619e5e35f90732ad505f3
|
41
examples/posix_fs/posix_fs_example.c
Normal file
41
examples/posix_fs/posix_fs_example.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "espressif/esp_common.h"
|
||||
#include "esp/uart.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "esp8266.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "esp_spiffs.h"
|
||||
#include "spiffs.h"
|
||||
|
||||
#include "fs-test/fs_test.h"
|
||||
|
||||
|
||||
void test_task(void *pvParameters)
|
||||
{
|
||||
esp_spiffs_mount();
|
||||
esp_spiffs_unmount(); // FS must be unmounted before formating
|
||||
if (SPIFFS_format(&fs) == SPIFFS_OK) {
|
||||
printf("Format complete\n");
|
||||
} else {
|
||||
printf("Format failed\n");
|
||||
}
|
||||
esp_spiffs_mount();
|
||||
|
||||
while (1) {
|
||||
vTaskDelay(5000 / portTICK_RATE_MS);
|
||||
|
||||
if (fs_test_run(1000)) {
|
||||
printf("PASS\n");
|
||||
} else {
|
||||
printf("FAIL\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void user_init(void)
|
||||
{
|
||||
uart_set_baud(0, 115200);
|
||||
|
||||
xTaskCreate(test_task, (signed char *)"test_task", 1024, NULL, 2, NULL);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue