summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/zephyr/main.c8
-rw-r--r--ports/zephyr/zephyr_storage.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c
index e304dfd25..104954f59 100644
--- a/ports/zephyr/main.c
+++ b/ports/zephyr/main.c
@@ -38,6 +38,10 @@
#include <usb/usb_device.h>
#endif
+#ifdef CONFIG_FLASH_MAP
+#include <storage/flash_map.h>
+#endif
+
#include "py/mperrno.h"
#include "py/compile.h"
#include "py/runtime.h"
@@ -100,8 +104,8 @@ STATIC void vfs_init(void) {
mp_obj_t args[] = { mp_obj_new_str(CONFIG_DISK_SDHC_VOLUME_NAME, strlen(CONFIG_DISK_SDHC_VOLUME_NAME)) };
bdev = zephyr_disk_access_type.make_new(&zephyr_disk_access_type, ARRAY_SIZE(args), 0, args);
mount_point_str = "/sd";
- #elif defined(CONFIG_FLASH_MAP) && defined(DT_FLASH_AREA_STORAGE_ID)
- mp_obj_t args[] = { MP_OBJ_NEW_SMALL_INT(DT_FLASH_AREA_STORAGE_ID), MP_OBJ_NEW_SMALL_INT(4096) };
+ #elif defined(CONFIG_FLASH_MAP) && FLASH_AREA_LABEL_EXISTS(storage)
+ mp_obj_t args[] = { MP_OBJ_NEW_SMALL_INT(FLASH_AREA_ID(storage)), MP_OBJ_NEW_SMALL_INT(4096) };
bdev = zephyr_flash_area_type.make_new(&zephyr_flash_area_type, ARRAY_SIZE(args), 0, args);
mount_point_str = "/flash";
#endif
diff --git a/ports/zephyr/zephyr_storage.c b/ports/zephyr/zephyr_storage.c
index c533cb8fd..83f19a8fe 100644
--- a/ports/zephyr/zephyr_storage.c
+++ b/ports/zephyr/zephyr_storage.c
@@ -245,8 +245,8 @@ STATIC const mp_rom_map_elem_t zephyr_flash_area_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&zephyr_flash_area_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&zephyr_flash_area_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&zephyr_flash_area_ioctl_obj) },
- #ifdef DT_FLASH_AREA_STORAGE_ID
- { MP_ROM_QSTR(MP_QSTR_STORAGE), MP_ROM_INT(DT_FLASH_AREA_STORAGE_ID) },
+ #if FLASH_AREA_LABEL_EXISTS(storage)
+ { MP_ROM_QSTR(MP_QSTR_STORAGE), MP_ROM_INT(FLASH_AREA_ID(storage)) },
#endif
};
STATIC MP_DEFINE_CONST_DICT(zephyr_flash_area_locals_dict, zephyr_flash_area_locals_dict_table);