RTEMS Network Adapter Porting - network shell command introduction and enable
The network adapter driver part is not included in RTEMS for BBB board BSP. And TCP / IP protocol stack is not enabled by default.
So to transplant the entire network to bbb board, the first thing to do is to enable tcp / ip protocol stack. And then enable these network commands.
Step 1: Enable the tcp / ip protocol stack:
When compile RTEMS source code, the network stack is disable by default. So how to enable TCP/IP stack:
We can read the RTEMS source code configure file:
So to transplant the entire network to bbb board, the first thing to do is to enable tcp / ip protocol stack. And then enable these network commands.
Step 1: Enable the tcp / ip protocol stack:
When compile RTEMS source code, the network stack is disable by default. So how to enable TCP/IP stack:
We can read the RTEMS source code configure file:
- Optional Features:
- --disable-option-checking ignore unrecognized --enable/--with options
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-maintainer-mode
- enable make rules and dependencies not useful (and
- sometimes confusing) to the casual installer
- --enable-multiprocessing
- enable multiprocessing interface; the
- multiprocessing interface is a communication
- interface between different RTEMS instances and
- allows synchronization of objects via message
- passing
- --enable-posix enable posix interface
- --enable-networking enable TCP/IP stack
- --enable-cxx enable C++ support
- --enable-tests enable tests (default:samples)
- --enable-rtems-debug enable RTEMS_DEBUG
- --enable-rtemsbsp="bsp1 bsp2 .."
- BSPs to include in build
- --enable-multilib build many library versions (default=no)
- --enable-paravirt enable support for paravirtualization (default=no)
- --enable-drvmgr enable Driver Manager at Startup
- --enable-docs enable building documentation (default:disabled)
So when compiling the code, add the --enable networking --enable posix after the configure.
Step 2: Enable the network-related shell command:
RTEMS shell command contain network-related commands such as ping, ifconfig, netstats, etc.
So when you enter the system shell, enter help all, there will be enabled shell command, which can not find the ping , Ifconfig and so on. In the source code, you can search these network command source and implementation, as shown below:
So how to enable the network command is the key issue, the first thing to be clear is that the implementation of the command is related to the driver, but the command is independent of the Internet driver.
I download the shell of the document at the official website, which describes the network is like this:
This means that if you want to implement the network command to define these four variables, and to include the shellconfig.h header file, but did not specify which should be placed in the file.
The next section gives answers to these questions:
This means that if the user wants to configure the command, define the corresponding command.
See here is more clear, that is to say if you want to configure the ping command, it is necessary in the configuration file, defined as follows:
#define CONFIGURE_SHELL_COMMAND_PING
In other words, in the rki folder, include the following command in the include header file, rtems_config.h:
#define CONFIGURE_SHELL_COMMANDS_INIT
#define CONFIGURE_SHELL_COMMANDS_ALL
#define CONFIGURE_SHELL_MOUNT_RFS
#define CONFIGURE_SHELL_MOUNT_MSDOS
#define CONFIGURE_SHELL_MOUNT_NFS //c add
#define CONFIGURE_SHELL_COMMAND_IFCONFIG
#define CONFIGURE_SHELL_COMMAND_ROUTE
#define CONFIGURE_SHELL_COMMAND_PING
#define CONFIGURE_SHELL_COMMAND_NETSTATS
#include <rtems/shellconfig.h>
#define CONFIGURE_SHELL_COMMANDS_ALL
#define CONFIGURE_SHELL_MOUNT_RFS
#define CONFIGURE_SHELL_MOUNT_MSDOS
#define CONFIGURE_SHELL_MOUNT_NFS //c add
#define CONFIGURE_SHELL_COMMAND_IFCONFIG
#define CONFIGURE_SHELL_COMMAND_ROUTE
#define CONFIGURE_SHELL_COMMAND_PING
#define CONFIGURE_SHELL_COMMAND_NETSTATS
#include <rtems/shellconfig.h>
The following posted my own rtems_config.h file content:
- /*
- ** rtems_config.h
- **
- ** Author: Alan Cudmore
- **
- ** This contains the configuration settings for an RTEMS Application
- **
- */
- /*
- ** RTEMS Includes
- */
- #include <rtems.h>
- #include <bsp.h>
- #ifdef RKI_INCLUDE_MONITOR
- #include <rtems/monitor.h>
- #endif
- #ifdef RKI_INCLUDE_TARFS
- #include <rtems/untar.h>
- #endif
- #include <rtems/mkrootfs.h>
- /*
- ** RTEMS OS Configuration defintions
- */
- #define TASK_INTLEVEL 0
- #define CONFIGURE_INIT
- #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL))
- #define CONFIGURE_INIT_TASK_STACK_SIZE (32*1024)
- #define CONFIGURE_INIT_TASK_PRIORITY 120
- #define CONFIGURE_MAXIMUM_TASKS 128
- #define CONFIGURE_MAXIMUM_TIMERS 5
- #define CONFIGURE_MAXIMUM_SEMAPHORES 512
- #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 128
- /* POSIX Keys are needed for the Shell */
- #define CONFIGURE_MAXIMUM_POSIX_KEYS 32
- #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 64
- #define CONFIGURE_MAXIMUM_PARTITIONS 2
- #define CONFIGURE_EXECUTIVE_RAM_SIZE ( 1024 * 1024 )
- #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
- #define CONFIGURE_MAXIMUM_DRIVERS 10
- #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
- #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
- #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
- #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 200
- #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
- #define CONFIGURE_SWAPOUT_TASK_PRIORITY 10
- #define CONFIGURE_SHELL_COMMANDS_INIT
- #define CONFIGURE_SHELL_COMMANDS_ALL
- #define CONFIGURE_SHELL_MOUNT_RFS
- #define CONFIGURE_SHELL_MOUNT_MSDOS
- #define CONFIGURE_SHELL_MOUNT_NFS //c add
- #define CONFIGURE_SHELL_COMMAND_IFCONFIG
- #define CONFIGURE_SHELL_COMMAND_ROUTE
- #define CONFIGURE_SHELL_COMMAND_PING
- #define CONFIGURE_SHELL_COMMAND_NETSTATS
- #include <rtems/shellconfig.h>
- #define CONFIGURE_MICROSECONDS_PER_TICK 10000
- #define CONFIGURE_STACK_CHECKER_ENABLED
- #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
- /*
- ** Filesystems needed
- */
- /* IMFS and RFS will always be used */
- #define CONFIGURE_FILESYSTEM_IMFS
- #define CONFIGURE_FILESYSTEM_RFS
- #define CONFIGURE_FILESYSTEM_TFTPFS
- #define CONFIGURE_FILESYSTEM_MSDOS
- /*
- ** Init task prototype
- */
- rtems_task Init (rtems_task_argument argument);
- /*
- ** This include file must be AFTER the
- ** configuration data.
- */
- #include <rtems/confdefs.h>
The command working as follow:
评论
发表评论