File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 21
21
22
22
// Maximum number of elements in buffer
23
23
#define BUFFER_MAX_LEN 10
24
-
24
+ # define FORCE_REFORMAT true
25
25
// This will take the system's default block device
26
26
BlockDevice *bd = BlockDevice::get_default_instance();
27
27
@@ -82,10 +82,9 @@ int main() {
82
82
fflush (stdout);
83
83
int err = fs.mount (bd);
84
84
printf (" %s\n " , (err ? " Fail :(" : " OK" ));
85
- if (err) {
85
+ if (err || FORCE_REFORMAT ) {
86
86
// Reformat if we can't mount the filesystem
87
- // this should only happen on the first boot
88
- printf (" No filesystem found, formatting... " );
87
+ printf (" formatting... " );
89
88
fflush (stdout);
90
89
err = fs.reformat (bd);
91
90
printf (" %s\n " , (err ? " Fail :(" : " OK" ));
Original file line number Diff line number Diff line change 1
1
--- Mbed OS filesystem example ---
2
2
Mounting the filesystem... OK
3
- Opening "\/fs\/numbers.txt"... OK
4
3
Incrementing numbers \(10\/10\)... OK
5
4
Closing "\/fs\/numbers.txt"... OK
6
5
Opening the root directory... OK
You can’t perform that action at this time.
0 commit comments