current tick 当前系统的节拍;

  1. finsh>> list_device()
  2.  
  3. device type
  4. ------- ----------------
  5. uart3 Character Device
  6. uart2 Character Device
  7. uart1 Character Device

显示系统中设备状态:


  1. 字段 描述

  1. device 设备的名称;
  2.  
  3. type 设备的类型;

type输出下列数据类型:

  1. char * const device_type_str[]{
  2. "Character Device",
  3. "Block Device",
  4. "Network Interface",
  5. "MTD Device",
  6. "CAN Device",
  7. "RTC",
  8. "Sound Device",
  9. "Graphic Device",
  10. "I2C Bus",
  11. "USB Slave Device",
  12. "USB Host Bus",
  13. "SPI Bus",
  14. "SPI Device",
  15. "SDIO Bus",
  16. "PM Pseudo Device",
  17. "Unknown",
  18. };

RT-Thread的各个组件会向finsh输出一些命令。 如当打开DFS组件时,还会增加如下命令,各个命令详细介绍参见文件系统一章。

  1. mkfs -- make a file system
  2. df -- get disk free
  3. ls -- list directory contents
  4. rm -- remove files or directories
  5. cat -- print file
  6. copy -- copy source file to destination file
  7. mkdir -- create a directory

finsh(msh) 内置命令

msh模式下,内置命令风格与bash类似,按下tab键后可以列出当前支持的所有命令。

  1. RT-Thread shell commands:
  2. list_timer - list timer in system
  3. list_device - list device in system
  4. version - show RT-Thread version information
  5. list_thread - list thread
  6. list_sem - list semaphore in system
  7. list_event - list event in system
  8. list_mutex - list mutex in system
  9. list_mailbox - list mail box in system
  10. list_msgqueue - list message queue in system
  11. ls - List information about the FILEs.
  12. cp - Copy SOURCE to DEST.
  13. mv - Rename SOURCE to DEST.
  14. cat - Concatenate FILE(s)
  15. rm - Remove (unlink) the FILE(s).
  16. cd - Change the shell working directory.
  17. pwd - Print the name of the current working directory.
  18. mkdir - Create the DIRECTORY.
  19. ps - List threads in the system.
  20. time - Execute command with time.
  21. free - Show the memory usage in the system.
  22. exit - return to RT-Thread shell mode.
  23. help - RT-Thread shell help.

执行方式与传统shell相同,因此不详细赘述,以cat为例简单介绍。如果打开DFS,并正确挂载了文件系统,则可以执行ls查看列出的当前目录。

  1. finsh>ls
  2. Directory /:
  3. .. <DIR>
  4. a.txt 1119

当前目录下存在名为a.txt的文件,则可执行如下命令打印a.txt的内容。

  1. finsh>> cat a.txt