Skip to content

Commit af574a8

Browse files
committed
alif/alif_flash: Distinguish between total flash size and FS size.
Signed-off-by: Damien George <[email protected]>
1 parent ca3d50a commit af574a8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ports/alif/alif_flash.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ typedef struct _alif_flash_obj_t {
3737
uint32_t flash_size;
3838
} alif_flash_obj_t;
3939

40-
static alif_flash_obj_t alif_flash_obj = {
40+
static const alif_flash_obj_t alif_flash_fs_obj = {
4141
.base = { &alif_flash_type },
4242
.flash_base_addr = MICROPY_HW_FLASH_STORAGE_BASE_ADDR,
43-
.flash_size = MICROPY_HW_FLASH_STORAGE_BYTES,
43+
.flash_size = MICROPY_HW_FLASH_STORAGE_FS_BYTES,
4444
};
4545

4646
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
5454
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
5555

5656
if (args[ARG_start].u_int == -1 && args[ARG_len].u_int == -1) {
57-
// Default singleton object that accesses entire flash
58-
return MP_OBJ_FROM_PTR(&alif_flash_obj);
57+
// Default singleton object that accesses writable-filesystem flash
58+
return MP_OBJ_FROM_PTR(&alif_flash_fs_obj);
5959
}
6060

6161
alif_flash_obj_t *self = mp_obj_malloc(alif_flash_obj_t, &alif_flash_type);

ports/alif/msc_disk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif
3838

3939
#define BLOCK_SIZE (MICROPY_HW_FLASH_BLOCK_SIZE_BYTES)
40-
#define BLOCK_COUNT (MICROPY_HW_FLASH_STORAGE_BYTES / BLOCK_SIZE)
40+
#define BLOCK_COUNT (MICROPY_HW_FLASH_STORAGE_FS_BYTES / BLOCK_SIZE)
4141
#define FLASH_BASE_ADDR (MICROPY_HW_FLASH_STORAGE_BASE_ADDR)
4242

4343
static bool ejected = false;

0 commit comments

Comments
 (0)