8000 esp8266 and nrf: raise NotImplementedError · rbarraud/circuitpython@5f98953 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f98953

Browse files
committed
esp8266 and nrf: raise NotImplementedError
1 parent 1e9a271 commit 5f98953

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

ports/atmel-samd/common-hal/storage/__init__.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
#include "flash_api.h"
3030
#include "py/mperrno.h"
3131
#include "py/runtime.h"
32+
#include "shared-bindings/microcontroller/__init__.h"
3233
#include "shared-bindings/storage/__init__.h"
34+
#include "supervisor/filesystem.h"
3335
#include "usb.h"
3436

3537
extern volatile bool mp_msc_enabled;
@@ -47,3 +49,9 @@ void common_hal_storage_remount(const char* mount_path, bool readonly) {
4749

4850
flash_set_usb_writable(readonly);
4951
}
52+
53+
void common_hal_storage_erase_filesystem(void) {
54+
filesystem_init(false, true); // Force a re-format.
55+
common_hal_mcu_reset();
56+
// We won't actually get here, since we're resetting.
57+
}

ports/esp8266/common-hal/storage/__init__.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@
2626

2727
#include <string.h>
2828

29+
#include "lib/oofatfs/ff.h"
30+
#include "lib/oofatfs/diskio.h"
31+
#include "py/mperrno.h"
2932
#include "py/runtime.h"
3033
#include "shared-bindings/storage/__init__.h"
3134

3235
void common_hal_storage_remount(const char* mount_path, bool readonly) {
3336
mp_raise_NotImplementedError("");
3437
}
38+
39+
void common_hal_storage_erase_filesystem() {
40+
mp_raise_NotImplementedError("Use esptool to erase flash and re-upload Python instead");
41+
}

ports/nrf/common-hal/storage/__init__.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff 10000 line numberDiff line change
@@ -37,3 +37,7 @@ void common_hal_storage_remount(const char* mount_path, bool readonly) {
3737
mp_raise_OSError(MP_EINVAL);
3838
}
3939
}
40+
41+
void common_hal_storage_erase_filesystem() {
42+
mp_raise_NotImplementedError("");
43+
}

shared-bindings/storage/__init__.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,17 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount);
133133

134134
//| .. function:: erase_filesystem()
135135
//|
136-
//| Erase and re-create the ``CIRCUITPY`` filesystem. Then call
137-
//| `microcontroller.reset()` to restart CircuitPython and have the
136+
//| Erase and re-create the ``CIRCUITPY`` filesystem.
137+
//|
138+
//| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51),
139+
//| then call `microcontroller.reset()` to restart CircuitPython and have the
138140
//| host computer remount CIRCUITPY.
139141
//|
140142
//| This function can be called from the REPL when ``CIRCUITPY``
141143
//| has become corrupted.
142144
//|
143145
//| .. warning:: All the data on ``CIRCUITPY`` will be lost, and
144-
//| CircuitPython will restart.
146+
//| CircuitPython will restart on certain boards.
145147

146148
mp_obj_t storage_erase_filesystem(void) {
147149
common_hal_storage_erase_filesystem();

shared-module/storage/__init__.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,3 @@ void common_hal_storage_umount_path(const char* mount_path) {
127127
mp_obj_t common_hal_storage_getmount(const char *mount_path) {
128128
return storage_object_from_path(mount_path);
129129
}
130-
131-
void common_hal_storage_erase_filesystem(void) {
132-
filesystem_init(false, true); // Force a re-format.
133-
common_hal_mcu_reset();
134-
// We won't actually get here, since we're resetting.
135-
}

supervisor/filesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include <stdbool.h>
3131

32-
void filesystem_init(bool create_allowed, bool create_force);
32+
void filesystem_init(bool create_allowed, bool force_create);
3333
void filesystem_flush(void);
3434
void filesystem_writable_by_python(bool writable);
3535
bool filesystem_present(void);

0 commit comments

Comments
 (0)
0