diff options
author | Maureen Helm <maureen.helm@nxp.com> | 2020-06-09 18:10:40 -0500 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-06-12 10:25:04 +1000 |
commit | 4837b1caa2b7a149769a8e3302350acc4f4bd4d9 (patch) | |
tree | 9137d9360b9a48584744352431966d9f27e1386b | |
parent | 6aff27ac3c2115734e5b0181956de0c04cfbb651 (diff) |
zephyr: Convert DT_FLASH_AREA usages to new dts macros.
Converts DT_FLASH_AREA usages in the zephyr port to new device tree macros
introduced in zephyr 2.3.
Tested with littlefs on the reel_board.
-rw-r--r-- | ports/zephyr/main.c | 8 | ||||
-rw-r--r-- | ports/zephyr/zephyr_storage.c | 4 |
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); |