mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
alif/alif_flash: Distinguish between total flash size and FS size.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -37,10 +37,10 @@ typedef struct _alif_flash_obj_t {
|
|||||||
uint32_t flash_size;
|
uint32_t flash_size;
|
||||||
} alif_flash_obj_t;
|
} alif_flash_obj_t;
|
||||||
|
|
||||||
static alif_flash_obj_t alif_flash_obj = {
|
static const alif_flash_obj_t alif_flash_fs_obj = {
|
||||||
.base = { &alif_flash_type },
|
.base = { &alif_flash_type },
|
||||||
.flash_base_addr = MICROPY_HW_FLASH_STORAGE_BASE_ADDR,
|
.flash_base_addr = MICROPY_HW_FLASH_STORAGE_BASE_ADDR,
|
||||||
.flash_size = MICROPY_HW_FLASH_STORAGE_BYTES,
|
.flash_size = MICROPY_HW_FLASH_STORAGE_FS_BYTES,
|
||||||
};
|
};
|
||||||
|
|
||||||
static mp_obj_t alif_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
static mp_obj_t alif_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||||
@@ -54,8 +54,8 @@ static mp_obj_t alif_flash_make_new(const mp_obj_type_t *type, size_t n_args, si
|
|||||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||||
|
|
||||||
if (args[ARG_start].u_int == -1 && args[ARG_len].u_int == -1) {
|
if (args[ARG_start].u_int == -1 && args[ARG_len].u_int == -1) {
|
||||||
// Default singleton object that accesses entire flash
|
// Default singleton object that accesses writable-filesystem flash
|
||||||
return MP_OBJ_FROM_PTR(&alif_flash_obj);
|
return MP_OBJ_FROM_PTR(&alif_flash_fs_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
alif_flash_obj_t *self = mp_obj_malloc(alif_flash_obj_t, &alif_flash_type);
|
alif_flash_obj_t *self = mp_obj_malloc(alif_flash_obj_t, &alif_flash_type);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BLOCK_SIZE (MICROPY_HW_FLASH_BLOCK_SIZE_BYTES)
|
#define BLOCK_SIZE (MICROPY_HW_FLASH_BLOCK_SIZE_BYTES)
|
||||||
#define BLOCK_COUNT (MICROPY_HW_FLASH_STORAGE_BYTES / BLOCK_SIZE)
|
#define BLOCK_COUNT (MICROPY_HW_FLASH_STORAGE_FS_BYTES / BLOCK_SIZE)
|
||||||
#define FLASH_BASE_ADDR (MICROPY_HW_FLASH_STORAGE_BASE_ADDR)
|
#define FLASH_BASE_ADDR (MICROPY_HW_FLASH_STORAGE_BASE_ADDR)
|
||||||
|
|
||||||
static bool ejected = false;
|
static bool ejected = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user