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.
This commit is contained in:
Maureen Helm 2019-10-15 20:00:09 -05:00
parent 5feb54afbb
commit 78c7e4a859
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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"