FRDM MCXN947 - zephyr rtos/USB Mass StorageによるRAMディスク
- はじめに
FRDM MCXN947
(https://www.nxp.jp/design/design-center/development-boards-and-designs/FRDM-MCXN947)
および、zephyrのサンプルアプリケーションプログラム(samples/subsys/usb/mass)を使用して、USB Mass StorageによるRAMディスクの作成について、
確認した際の記録メモです。
- 確認に利用したzephrのサンプルアプリケーションのあるディレクトリ
samples/subsys/usb/mass
- ビルド時のパラメータ
west build -b frdm_mcxn947/mcxn947/cpu0 samples/subsys/usb/mass -p always
- 変更するconfigurationの差分
samples/subsys/usb/mass/prj.conf
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n
CONFIG_STDOUT_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
CONFIG_USBD_MSC_CLASS=y
CONFIG_USBD_MSC_LUNS_PER_INSTANCE=3
CONFIG_LOG=y
CONFIG_USBD_LOG_LEVEL_WRN=y
CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
CONFIG_SAMPLE_USBD_PID=0x0008
CONFIG_SAMPLE_USBD_PRODUCT="USBD MSC sample"
CONFIG_MAIN_STACK_SIZE=2048
+CONFIG_APP_MSC_STORAGE_RAM=y
+CONFIG_DISK_DRIVER_RAM=y
+CONFIG_FILE_SYSTEM=y
+CONFIG_FAT_FILESYSTEM_ELM=y
- 追加するdevice tree
samples/subsys/usb/mass/boards/frdm_mcxn947_mcxn947_cpu0.overlay
+ / {
+ ramdisk0: ramdisk0 {
+ compatible = "zephyr,ram-disk";
+ status = "okay";
+
+ disk-name = "RAM";
+ sector-size = <512>;
+ sector-count = <256>; /* 512 * 256 = 128KB */
+ };
+};
- 実行結果(シリアルターミナル出力)
*** Booting Zephyr OS build v4.2.0-5452-g169cf86969d7 ***
Mount /RAM:: 0
/RAM:: bsize = 512 ; frsize = 512 ; blocks = 222 ; bfree = 222
/RAM: opendir: 0
End of files
[00:00:00.051,000] <inf> main: The device is put in USB mass storage mode
[00:00:00.300,000] <inf> usbd_msc: Enable
[00:00:00.300,000] <inf> usbd_msc: Bulk-Only Mass Storage Reset
[00:00:25.344,000] <inf> usbd_msc: Disable
[00:00:25.344,000] <inf> usbd_msc: Invalid CBW
[00:00:25.344,000] <wrn> usbd_ep: Set halt 0x81 failed
[00:00:25.344,000] <wrn> usbd_ep: Set halt 0x01 failed
[00:00:25.465,000] <inf> usbd_msc: Enable
[00:00:25.465,000] <inf> usbd_msc: Bulk-Only Mass Storage Reset

