From 78c7e4a8595013b7c8f5f47823b7db12837ecaa5 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Tue, 15 Oct 2019 20:00:09 -0500 Subject: [PATCH] zephyr: Enable usb mass storage class on mimxrt1050_evk. Enables the zephyr usb device stack and mass storage class on the mimxrt1050_evk board. The mass storage class is backed by the sdhc disk access driver, so it's now possible to browse and modify the contents of the SD card from a USB host (your PC). This is in preparation to support writing a main.py script to the SD card, and then executing it after the next reset. --- ports/zephyr/main.c | 8 ++++++++ ports/zephyr/prj_mimxrt1050_evk.conf | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c index a3f0d5b9d6..e0e50196b3 100644 --- a/ports/zephyr/main.c +++ b/ports/zephyr/main.c @@ -34,6 +34,10 @@ #include #endif +#ifdef CONFIG_USB +#include +#endif + #include "py/mperrno.h" #include "py/compile.h" #include "py/runtime.h" @@ -133,6 +137,10 @@ soft_reset: mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script) mp_obj_list_init(mp_sys_argv, 0); + #ifdef CONFIG_USB + usb_enable(NULL); + #endif + #if MICROPY_VFS vfs_init(); #endif diff --git a/ports/zephyr/prj_mimxrt1050_evk.conf b/ports/zephyr/prj_mimxrt1050_evk.conf index 23066977f3..051ab7e60b 100644 --- a/ports/zephyr/prj_mimxrt1050_evk.conf +++ b/ports/zephyr/prj_mimxrt1050_evk.conf @@ -1,3 +1,9 @@ # Required for zephyr.DiskAccess block devices CONFIG_DISK_ACCESS=y CONFIG_DISK_ACCESS_SDHC=y + +CONFIG_USB=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_PRODUCT="Zephyr MicroPython" +CONFIG_USB_MASS_STORAGE=y +CONFIG_MASS_STORAGE_DISK_NAME="SDHC"