File tree Expand file tree Collapse file tree 5 files changed +51
-10
lines changed Expand file tree Collapse file tree 5 files changed +51
-10
lines changed Original file line number Diff line number Diff line change 7
7
new :
8
8
@echo " Creating a new ESP-IDF Template app"
9
9
@git clone https://github.com/espressif/esp-idf-template.git newapp
10
+ @rm -rf newapp/.git
10
11
@echo " New app can be found in newapp"
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Test the Virtual File System
3
+ *
4
+ * Perform a test against the Virtual File System.
5
+ *
6
+ * For additional details and documentation see:
7
+ * * Free book on ESP32 - https://leanpub.com/kolban-ESP32
8
+ *
9
+ *
10
+ * Neil Kolban <kolban1@kolban.com>
11
+ *
12
+ */
1
13
#include "freertos/FreeRTOS.h"
2
14
#include "esp_wifi.h"
3
15
#include "esp_system.h"
8
20
#include "driver/gpio.h"
9
21
#include "vfsTest.h"
10
22
#include "stdio.h"
23
+ #include "fcntl.h"
11
24
12
25
char tag [] = "vfs-skeleton" ;
13
26
esp_err_t event_handler (void * ctx , system_event_t * event )
@@ -35,10 +48,18 @@ int app_main(void)
35
48
ESP_ERROR_CHECK ( esp_wifi_set_config (WIFI_IF_STA , & sta_config ) );
36
49
//ESP_ERROR_CHECK( esp_wifi_start() );
37
50
//ESP_ERROR_CHECK( esp_wifi_connect() );
51
+
52
+ // Perform the tests on the VFS
38
53
registerTestVFS ("/data" );
39
54
ESP_LOGI (tag , "vfs registered" );
40
- FILE * f = fopen ("/data/x" , "w" );
41
- fprintf (f , "Hello!" );
55
+
56
+ FILE * file = fopen ("/data/x" , "w" );
57
+ if (file == NULL ) {
58
+ ESP_LOGE (tag , "failed to open file" );
59
+ return 0 ;
60
+ }
61
+
62
+ fprintf (file , "Hello!" );
42
63
return 0 ;
43
64
}
44
65
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Test the Virtual File System
3
+ *
4
+ * Perform a test against the Virtual File System.
5
+ *
6
+ * For additional details and documentation see:
7
+ * * Free book on ESP32 - https://leanpub.com/kolban-ESP32
8
+ *
9
+ *
10
+ * Neil Kolban <kolban1@kolban.com>
11
+ *
12
+ */
1
13
#include "vfsTest.h"
2
14
#include "esp_vfs.h"
3
15
#include "esp_log.h"
@@ -99,7 +111,7 @@ static int vfs_rename(const char *oldPath, const char *newPath) {
99
111
100
112
101
113
/**
102
- * Resgister the VFS at the specified mount point.
114
+ * Register the VFS at the specified mount point.
103
115
* The callback functions are registered to handle the
104
116
* different functions that may be requested against the
105
117
* VFS.
@@ -108,6 +120,8 @@ void registerTestVFS(char *mountPoint) {
108
120
esp_vfs_t vfs ;
109
121
esp_err_t err ;
110
122
123
+ vfs .fd_offset = 0 ;
124
+ vfs .flags = ESP_VFS_FLAG_DEFAULT ;
111
125
vfs .write = vfs_write ;
112
126
vfs .lseek = vfs_lseek ;
113
127
vfs .read = vfs_read ;
@@ -118,7 +132,6 @@ void registerTestVFS(char *mountPoint) {
118
132
vfs .link = vfs_link ;
119
133
vfs .rename = vfs_rename ;
120
134
121
-
122
135
err = esp_vfs_register (mountPoint , & vfs , NULL );
123
136
if (err != ESP_OK ) {
124
137
ESP_LOGE (tag , "esp_vfs_register: err=%d" , err );
Original file line number Diff line number Diff line change 1
- /*
2
- * vfsTest.h
1
+ /**
2
+ * Test the Virtual File System
3
+ *
4
+ * Perform a test against the Virtual File System.
5
+ *
6
+ * For additional details and documentation see:
7
+ * * Free book on ESP32 - https://leanpub.com/kolban-ESP32
8
+ *
9
+ *
10
+ * Neil Kolban <kolban1@kolban.com>
3
11
*
4
- * Created on: Nov 5, 2016
5
- * Author: kolban
6
12
*/
7
13
8
14
#ifndef MAIN_VFSTEST_H_
Original file line number Diff line number Diff line change @@ -88,9 +88,9 @@ CONFIG_NEWLIB_STDOUT_ADDCR=y
88
88
# CONFIG_ULP_COPROC_ENABLED is not set
89
89
CONFIG_ULP_COPROC_RESERVE_MEM=0
90
90
# CONFIG_ESP32_PANIC_PRINT_HALT is not set
91
- CONFIG_ESP32_PANIC_PRINT_REBOOT=y
91
+ # CONFIG_ESP32_PANIC_PRINT_REBOOT is not set
92
92
# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set
93
- # CONFIG_ESP32_PANIC_GDBSTUB is not set
93
+ CONFIG_ESP32_PANIC_GDBSTUB=y
94
94
CONFIG_ESP32_DEBUG_OCDAWARE=y
95
95
CONFIG_INT_WDT=y
96
96
CONFIG_INT_WDT_TIMEOUT_MS=300
You can’t perform that action at this time.
0 commit comments