summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaureen Helm <maureen.helm@nxp.com>2019-10-15 20:00:09 -0500
committerMaureen Helm <maureen.helm@nxp.com>2020-03-11 07:46:41 -0500
commit78c7e4a8595013b7c8f5f47823b7db12837ecaa5 (patch)
treede3ff43c4f8fadc6878f0a587e5b233096f81f79
parent5feb54afbb4429c94300b1d2168be82480912e82 (diff)
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.
-rw-r--r--ports/zephyr/main.c8
-rw-r--r--ports/zephyr/prj_mimxrt1050_evk.conf6
2 files changed, 14 insertions, 0 deletions
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c
index a3f0d5b9d..e0e50196b 100644
--- a/ports/zephyr/main.c
+++ b/ports/zephyr/main.c
@@ -34,6 +34,10 @@
#include <net/net_context.h>
#endif
+#ifdef CONFIG_USB
+#include <usb/usb_device.h>
+#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 23066977f..051ab7e60 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"