|
|
5 месяцев назад | |
|---|---|---|
| .. | ||
| .settings | 6 месяцев назад | |
| board | 8 месяцев назад | |
| figures | 1 год назад | |
| packages | 1 год назад | |
| rzn | 6 месяцев назад | |
| rzn_cfg | 6 месяцев назад | |
| rzn_gen | 6 месяцев назад | |
| script | 6 месяцев назад | |
| src | 1 год назад | |
| .api_xml | 1 год назад | |
| .config | 6 месяцев назад | |
| .cproject | 6 месяцев назад | |
| .gitignore | 1 год назад | |
| .project | 1 год назад | |
| .secure_azone | 1 год назад | |
| .secure_rzone | 6 месяцев назад | |
| .secure_xml | 6 месяцев назад | |
| Kconfig | 6 месяцев назад | |
| README.md | 5 месяцев назад | |
| README_zh.md | 5 месяцев назад | |
| SConscript | 6 месяцев назад | |
| SConstruct | 1 год назад | |
| buildinfo.ipcf | 6 месяцев назад | |
| buildinfo.json | 6 месяцев назад | |
| configuration.xml | 6 месяцев назад | |
| envsetup.sh | 1 год назад | |
| mklinks.bat | 1 год назад | |
| mklinks.sh | 1 год назад | |
| ozone_scons.jdebug | 1 год назад | |
| project.ewd | 6 месяцев назад | |
| project.ewp | 6 месяцев назад | |
| project.ewt | 6 месяцев назад | |
| project.eww | 1 год назад | |
| rtconfig.h | 6 месяцев назад | |
| rtconfig.py | 1 год назад | |
| rzn_cfg.txt | 6 месяцев назад | |
| template.ewd | 6 месяцев назад | |
| template.ewp | 6 месяцев назад | |
| template.eww | 1 год назад | |
English | 中文
This example demonstrates how to implement a USB flash drive using the USB-PMSC (USB Peripheral Mass Storage Class). USB-PMSC is a USB device class that enables USB-based storage device functionality.
EtherKit provides a USB-Device peripheral, located on the development board as shown below:
configuration.xml file using FSP and add the usb_pmcs stack:g_rm_block_media0:g_basic0_usb and set the interrupt callback function to usb_apl_callback:USB_HS and enable it:Locate the file at the specified path in the project: .\rzn\SConscript and replace its content with the following:
Import('RTT_ROOT')
Import('rtconfig')
from building import *
from gcc import *
cwd = GetCurrentDir()
src = []
group = []
CPPPATH = []
if rtconfig.PLATFORM in ['iccarm'] + GetGCCLikePLATFORM():
if rtconfig.PLATFORM == 'iccarm' or GetOption('target') != 'mdk5':
src += Glob('./fsp/src/bsp/mcu/all/*.c')
src += Glob('./fsp/src/bsp/mcu/all/cr/*.c')
src += Glob('./fsp/src/bsp/mcu/r*/*.c')
src += Glob('./fsp/src/bsp/cmsis/Device/RENESAS/Source/*.c')
src += Glob('./fsp/src/bsp/cmsis/Device/RENESAS/Source/cr/*.c')
src += Glob('./fsp/src/r_*/*.c')
src += Glob('./fsp/src/r_usb_basic/src/driver/*.c')
src += Glob('./fsp/src/r_usb_basic/src/hw/*.c')
src += Glob('./fsp/src/r_usb_pmsc/src/*.c')
CPPPATH = [ cwd + '/arm/CMSIS_5/CMSIS/Core_R/Include',
cwd + '/fsp/inc',
cwd + '/fsp/src/inc',
cwd + '/fsp/inc/api',
cwd + '/fsp/inc/instances',
cwd + '/fsp/src/r_usb_basic/src/driver/inc',
cwd + '/fsp/src/r_usb_basic/src/hw/inc',
cwd + '/fsp/src/r_usb_pmsc/src/inc',]
group = DefineGroup('rzn', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
If you are using Studio for development, right-click the project and select Sync SCons Configuration to Project. For IAR development, right-click within the current project to open the environment, and run the command:scons --target=iar to regenerate the configuration.
The USB example currently uses the FreeRTOS interface driver, so we also need to enable the FreeRTOS compatibility layer package:
mklinks.bat to create the link between the rt-thread and libraries folders. Then, use Env to generate the IAR project. Finally, double-click project.eww to open the IAR project and compile it.Once the compilation is complete, connect the Jlink interface of the development board to the PC and download the firmware to the board.
After generating the FSP configuration, compile and download the firmware to the development board. The example will automatically start. In the file manager, you will see an additional USB device: