diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig index 5e313e5529c..4396776fbb0 100644 --- a/arch/sim/Kconfig +++ b/arch/sim/Kconfig @@ -153,6 +153,10 @@ config SIM_NET_BRIDGE_DEVICE endif +config SIM_RPTUN_MASTER + bool "Remote Processer Tunneling Role" + depends on RPTUN + config SIM_LCDDRIVER bool "Build a simulated LCD driver" default y diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index 00aea45a544..b7f5196a57c 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -93,9 +93,11 @@ endif endif ifeq ($(CONFIG_DEV_CONSOLE),y) +ifneq ($(CONFIG_SYSLOG_RPMSG),y) CSRCS += up_devconsole.c up_uartwait.c HOSTSRCS += up_simuart.c endif +endif ifeq ($(CONFIG_ONESHOT),y) CSRCS += up_oneshot.c @@ -159,7 +161,14 @@ endif # HOSTOS != Cygwin endif # CONFIG_NET_ETHERNET endif # CONFIG_SIM_NETDEV +ifeq ($(CONFIG_RPTUN),y) + CSRCS += up_rptun.c + HOSTSRCS += up_shmem.c + STDLIBS += -lrt +endif + ifeq ($(CONFIG_FS_HOSTFS),y) +ifneq ($(CONFIG_FS_HOSTFS_RPMSG),y) HOSTSRCS += up_hostfs.c up_hostfs.c: hostfs.h @@ -168,6 +177,7 @@ hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h @echo "CP: $<" $(Q) cp $< $@ endif +endif COBJS = $(CSRCS:.c=$(OBJEXT)) @@ -207,8 +217,10 @@ LINKOBJS = up_head$(OBJEXT) REQUIREDOBJS = $(LINKOBJS) ifeq ($(CONFIG_DEV_CONSOLE),y) +ifneq ($(CONFIG_SYSLOG_RPMSG),y) REQUIREDOBJS += up_uartwait$(OBJEXT) endif +endif ifeq ($(CONFIG_SIM_X11FB),y) ifeq ($(CONFIG_SIM_TOUCHSCREEN),y) diff --git a/arch/sim/src/sim/up_head.c b/arch/sim/src/sim/up_head.c index 02afe4596b8..c9cf7a2aa04 100644 --- a/arch/sim/src/sim/up_head.c +++ b/arch/sim/src/sim/up_head.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "up_internal.h" @@ -60,6 +61,10 @@ static jmp_buf g_simabort; static int g_exitcode = EXIT_SUCCESS; +#ifdef CONFIG_SYSLOG_RPMSG +static char g_logbuffer[4096]; +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -74,6 +79,10 @@ static int g_exitcode = EXIT_SUCCESS; int main(int argc, char **argv, char **envp) { +#ifdef CONFIG_SYSLOG_RPMSG + syslog_rpmsg_init_early("server", g_logbuffer, sizeof(g_logbuffer)); +#endif + #ifdef CONFIG_SMP /* In the SMP case, configure the main thread as CPU 0 */ diff --git a/arch/sim/src/sim/up_idle.c b/arch/sim/src/sim/up_idle.c index f31357416db..b55cf30b329 100644 --- a/arch/sim/src/sim/up_idle.c +++ b/arch/sim/src/sim/up_idle.c @@ -72,12 +72,9 @@ static int g_x11refresh = 0; * Public Function Prototypes ****************************************************************************/ -#if defined(CONFIG_SIM_WALLTIME) || defined(CONFIG_SIM_X11FB) -extern int up_hostusleep(unsigned int usec); #ifdef CONFIG_SIM_X11FB extern void up_x11update(void); #endif -#endif /**************************************************************************** * Public Functions @@ -151,6 +148,10 @@ void up_idle(void) netdriver_loop(); #endif +#ifdef CONFIG_RPTUN + up_rptun_loop(); +#endif + #ifdef CONFIG_PM /* Fake some power management stuff for testing purposes */ diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h index acc3f8cd82f..5bc1d31c348 100644 --- a/arch/sim/src/sim/up_internal.h +++ b/arch/sim/src/sim/up_internal.h @@ -91,7 +91,7 @@ # undef USE_DEVCONSOLE # undef CONFIG_RAMLOG_CONSOLE #else -# if defined(CONFIG_RAMLOG_CONSOLE) +# if defined(CONFIG_RAMLOG_CONSOLE) || defined(CONFIG_SYSLOG_RPMSG) # undef USE_DEVCONSOLE # else # define USE_DEVCONSOLE 1 @@ -236,6 +236,10 @@ volatile spinlock_t g_cpu_paused[CONFIG_SMP_NCPUS] SP_SECTION; int up_setjmp(xcpt_reg_t *jb); void up_longjmp(xcpt_reg_t *jb, int val) noreturn_function; +/* up_hostusleep.c ********************************************************/ + +int up_hostusleep(unsigned int usec); + /* up_simsmp.c ************************************************************/ #ifdef CONFIG_SMP @@ -388,6 +392,20 @@ int netdriver_setmacaddr(unsigned char *macaddr); void netdriver_loop(void); #endif +#ifdef CONFIG_RPTUN + +/* up_shmem.c *************************************************************/ + +void *shmem_open(const char *name, size_t size, int master); +void shmem_close(void *mem); + +/* up_rptun.c *************************************************************/ + +int up_rptun_init(void); +void up_rptun_loop(void); + +#endif + #ifdef CONFIG_SIM_SPIFLASH struct spi_dev_s; struct spi_dev_s *up_spiflashinitialize(FAR const char *name); diff --git a/arch/sim/src/sim/up_rptun.c b/arch/sim/src/sim/up_rptun.c new file mode 100644 index 00000000000..5bfd47a6daf --- /dev/null +++ b/arch/sim/src/sim/up_rptun.c @@ -0,0 +1,274 @@ +/**************************************************************************** + * arch/sim/src/sim/up_rptun.c + * + * Copyright (C) 2019 Xiaomi Inc. All rights reserved. + * Author: Chao An + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "up_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_SIM_RPTUN_MASTER +#define CONFIG_SIM_RPTUN_MASTER 0 +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct sim_rptun_shmem_s +{ + volatile uintptr_t base; +#if CONFIG_SIM_RPTUN_MASTER + volatile unsigned int seqrx; + volatile unsigned int seqtx; +#else + volatile unsigned int seqtx; + volatile unsigned int seqrx; +#endif + struct rptun_rsc_s rsc; + char buf[0x10000]; +}; + +struct sim_rptun_dev_s +{ + struct rptun_dev_s rptun; + rptun_callback_t callback; + void *arg; + unsigned int seqrx; + struct sim_rptun_shmem_s *shmem; +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static const char *sim_rptun_get_cpuname(struct rptun_dev_s *dev) +{ + return CONFIG_SIM_RPTUN_MASTER ? "proxy" : "server"; +} + +static const char *sim_rptun_get_firmware(struct rptun_dev_s *dev) +{ + return NULL; +} + +static const struct rptun_addrenv_s *sim_rptun_get_addrenv(struct rptun_dev_s *dev) +{ + return NULL; +} + +static struct rptun_rsc_s *sim_rptun_get_resource(struct rptun_dev_s *dev) +{ + struct sim_rptun_dev_s *priv = (struct sim_rptun_dev_s *)dev; + struct sim_rptun_shmem_s *shmem = priv->shmem; + + return &shmem->rsc; +} + +static bool sim_rptun_is_autostart(struct rptun_dev_s *dev) +{ + return true; +} + +static bool sim_rptun_is_master(struct rptun_dev_s *dev) +{ + return CONFIG_SIM_RPTUN_MASTER; +} + +static int sim_rptun_start(struct rptun_dev_s *dev) +{ + return 0; +} + +static int sim_rptun_stop(struct rptun_dev_s *dev) +{ + return 0; +} + +static int sim_rptun_notify(struct rptun_dev_s *dev, uint32_t vqid) +{ + struct sim_rptun_dev_s *priv = (struct sim_rptun_dev_s *)dev; + struct sim_rptun_shmem_s *shmem = priv->shmem; + + shmem->seqtx++; + return 0; +} + +static int sim_rptun_register_callback(struct rptun_dev_s *dev, + rptun_callback_t callback, void *arg) +{ + struct sim_rptun_dev_s *priv = (struct sim_rptun_dev_s *)dev; + + priv->callback = callback; + priv->arg = arg; + return 0; +} + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct rptun_ops_s g_sim_rptun_ops = +{ + .get_cpuname = sim_rptun_get_cpuname, + .get_firmware = sim_rptun_get_firmware, + .get_addrenv = sim_rptun_get_addrenv, + .get_resource = sim_rptun_get_resource, + .is_autostart = sim_rptun_is_autostart, + .is_master = sim_rptun_is_master, + .start = sim_rptun_start, + .stop = sim_rptun_stop, + .notify = sim_rptun_notify, + .register_callback = sim_rptun_register_callback, +}; + +static struct sim_rptun_dev_s g_dev = +{ + .rptun.ops = &g_sim_rptun_ops +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void up_rptun_loop(void) +{ + struct sim_rptun_shmem_s *shmem = g_dev.shmem; + + if (shmem != NULL && g_dev.seqrx != shmem->seqrx) + { + g_dev.seqrx = shmem->seqrx; + if (g_dev.callback != NULL) + { + g_dev.callback(g_dev.arg, RPTUN_NOTIFY_ALL); + } + } +} + +int up_rptun_init(void) +{ + int ret; + + g_dev.shmem = shmem_open("rptun-shmem", + sizeof(*g_dev.shmem), + CONFIG_SIM_RPTUN_MASTER); + if (g_dev.shmem == NULL) + { + return -ENOMEM; + } + + if (CONFIG_SIM_RPTUN_MASTER) + { + struct rptun_rsc_s *rsc = &g_dev.shmem->rsc; + + rsc->rsc_tbl_hdr.ver = 1; + rsc->rsc_tbl_hdr.num = 1; + rsc->offset[0] = offsetof(struct rptun_rsc_s, rpmsg_vdev); + rsc->rpmsg_vdev.type = RSC_VDEV; + rsc->rpmsg_vdev.id = VIRTIO_ID_RPMSG; + rsc->rpmsg_vdev.dfeatures = 1 << VIRTIO_RPMSG_F_NS + | 1 << VIRTIO_RPMSG_F_BIND + | 1 << VIRTIO_RPMSG_F_BUFSZ; + rsc->rpmsg_vdev.num_of_vrings = 2; + rsc->rpmsg_vring0.align = 8; + rsc->rpmsg_vring0.num = 8; + rsc->rpmsg_vring1.align = 8; + rsc->rpmsg_vring1.num = 8; + rsc->buf_size = 0x800; + + g_dev.shmem->base = (uintptr_t)g_dev.shmem; + } + else + { + static struct simple_addrenv_s s_addrenv[2]; + + /* Wait untils master is ready */ + + while (g_dev.shmem->base == 0) + { + up_hostusleep(1000); + } + + s_addrenv[0].va = (uintptr_t)g_dev.shmem; + s_addrenv[0].pa = g_dev.shmem->base; + s_addrenv[0].size = sizeof(*g_dev.shmem); + + simple_addrenv_initialize(s_addrenv); + } + + ret = rptun_initialize(&g_dev.rptun); + if (ret < 0) + { + shmem_close(g_dev.shmem); + return ret; + } + +#ifdef CONFIG_SYSLOG_RPMSG + syslog_rpmsg_init(); +#endif + +#ifdef CONFIG_SYSLOG_RPMSG_SERVER + syslog_rpmsg_server_init(); +#endif + +#ifdef CONFIG_FS_HOSTFS_RPMSG + hostfs_rpmsg_init("server"); +#endif + +#ifdef CONFIG_FS_HOSTFS_RPMSG_SERVER + hostfs_rpmsg_server_init(); +#endif + + return 0; +} + +void rpmsg_serialinit(void) +{ +#if CONFIG_SIM_RPTUN_MASTER + uart_rpmsg_init("proxy", "proxy", 4096, false); +#else + uart_rpmsg_init("server", "proxy", 4096, true); +#endif +} diff --git a/arch/sim/src/sim/up_shmem.c b/arch/sim/src/sim/up_shmem.c new file mode 100644 index 00000000000..f86d8168b36 --- /dev/null +++ b/arch/sim/src/sim/up_shmem.c @@ -0,0 +1,110 @@ +/**************************************************************************** + * arch/sim/src/sim/up_shmem.c + * + * Copyright (C) 2019 Xiaomi Inc. All rights reserved. + * Author: Chao An + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#define _GNU_SOURCE 1 + +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void *shmem_open(const char *name, size_t size, int master) +{ + void *mem; + int oflag; + int ret; + int fd; + + oflag = O_RDWR; + if (master) + { + oflag |= O_CREAT | O_TRUNC; + } + + while (1) + { + fd = shm_open(name, oflag, S_IRUSR | S_IWUSR); + if (fd >= 0) + { + if (!master) + { + /* Avoid the second slave instance open successfully */ + + shm_unlink(name); + } + break; + } + + if (master || errno != ENOENT) + { + return NULL; + } + + /* Master isn't ready, sleep and try again */ + + usleep(1000); + } + + ret = ftruncate(fd, size); + if (ret < 0) + { + close(fd); + return NULL; + } + + mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + close(fd); /* Don't need keep fd any more once the memory get mapped */ + if (mem == MAP_FAILED) + { + return NULL; + } + + return mem; +} + +void shmem_close(void *mem) +{ + munmap(mem, 0); +} diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt index c74203417c4..fad07c2682f 100644 --- a/boards/sim/sim/sim/README.txt +++ b/boards/sim/sim/sim/README.txt @@ -885,6 +885,194 @@ pktradio described below EXCEPT that is uses the generic packet radio loopback network device. +rpproxy +rpserver + + This is an example implementation for OpenAMP based on the share memory. + + rpproxy: Remote slave(client) proxy process. + rpproxy created a proxy between client and server to allow + the client to access the hardware resources on different + process. + + rpserver: Remote master(host) server process. + rpserver contains all the real hardware configuration, such as: + 1.Universal Asynchronous Receiver/Transmitter (UART). + 2.Specific File System. + 3.Network protocol stack and real network card device. + 4.... + + Rpmsg driver used in this example include: + + 1.Rpmsg Syslog + Source: + include/nuttx/syslog/syslog_rpmsg.h + drivers/syslog/syslog_rpmsg_server.c + drivers/syslog/syslog_rpmsg.c + Describe: + 1>Redirect log to master core + Linux kernel, NuttX, Freertos ... + 2>Work as early as possible + Two phase initialization + 3>Never lost the log + Hang during boot or runtime + Full system crash(panic, watchdog ...) + + 2.Rpmsg TTY(UART) + Source: + include/nuttx/serial/uart_rpmsg.h + drivers/serial/uart_rpmsg.c + Describe: + 1>Like pseudo terminal but between two CPU + 2>No different from real tty(open/read/write/close) + 3>Full duplex communication + 4>Support multiple channels as need + 1)Connect RTOS shell + 2)Make integrated GPS like external(NMEA) + 3)Make integrated modem like external(ATCMD) + + 3.Rpmsg HostFS + Source: + include/nuttx/fs/hostfs_rpmsg.h + fs/hostfs/hostfs_rpmsg_server.c + fs/hostfs/hostfs_rpmsg.c + Describe: + 1.Like NFS but between two CPU + 2.Fully access Host(Linux/NuttX) File system + 1)Save the tuning parameter during manufacture + 2)Load the tuning parameter file in production + 3)Save audio dump to file for tuning/debugging + 4)Dynamic loading module from host + + 4.Rpmsg Net + Source: + $(CONFIG_APPS_DIR)/system/usrsock_rpmsg/usrsock_rpmsg.h + $(CONFIG_APPS_DIR)/system/usrsock_rpmsg/usrsock_rpmsg_server.c + $(CONFIG_APPS_DIR)/system/usrsock_rpmsg/usrsock_rpmsg_client.c + include/nuttx/net/rpmsg.h + include/nuttx/net/rpmsgdrv.h + drivers/net/rpmsgdrv.c + Describe: + 1)Rpmsg UsrSock client + 2)Rpmsg UsrSock server + 3)Rpmsg Net driver + 4)Rpmsg MAC/PHY adapter + + To use this example: + + 1.Build images + 1>Build rpserver and backup the image: + ./tools/configure.sh sim:rpserver + make + cp nuttx ~/rpserver + + 2>Distclean the build environment: + make distclean + + 3>Build rpproxy: + ./tools/configure.sh sim:rpproxy + make + cp nuttx ~/rpproxy + + 2.Test the Rpmsg driver + 1>Rpmsg Syslog: + Start rpserver: + + $ sudo ~/rpserver + [ 0.000000] server: SIM: Initializing + + NuttShell (NSH) + server> + + Start rpproxy: + + $ sudo ~/rpproxy + + Check the syslog from rpproxy in rpserver terminal: + + server> [ 0.000000] proxy: SIM: Initializing + + 2>Rpmsg TTY(UART): + Use cu switch the current CONSOLE to the proxy: + + server> ps + PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND + 0 0 0 FIFO Kthread N-- Ready 00000000 000000 Idle Task + 1 1 224 FIFO Kthread --- Waiting Signal 00000000 002032 hpwork + 2 1 100 FIFO Task --- Running 00000000 004080 init + 3 3 224 FIFO Kthread --- Waiting Signal 00000002 002000 rptun proxy 0x56634fa0 + server> cu /dev/ttyproxy + proxy> ps + PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND + 0 0 0 FIFO Kthread N-- Ready 00000000 000000 Idle Task + 1 1 224 FIFO Kthread --- Waiting Signal 00000000 002032 hpwork + 3 3 100 FIFO Task --- Running 00000000 004080 init + 4 4 224 FIFO Kthread --- Waiting Signal 00000002 002000 rptun server 0x5671e900 + + 3>Rpmsg HostFS: + Mount the remote file system via RPMSG Hostfs, cu to proxy first: + + server> cu + proxy> mount -t hostfs -o fs=/proc proc_server + proxy> ls + /: + dev/ + etc/ + proc/ + proc_server/ + tmp/ + + Check the uptime: + + proxy> cat proc/uptime + 833.21 + proxy> cat proc_server/uptime + 821.72 + + 4>Rpmsg UsrSock: + Start the usrsock server on rpserver: + + server> usrsock & + usrsock [12:80] + server> ps + PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND + 0 0 0 FIFO Kthread N-- Ready 00000000 000000 Idle Task + 1 1 224 FIFO Kthread --- Waiting Signal 00000000 002032 hpwork + 2 1 100 FIFO Task --- Running 00000000 004080 init + 3 3 224 FIFO Kthread --- Waiting Signal 00000002 002000 rptun proxy 0x56634fa0 + 12 3 80 FIFO Task --- Waiting Semaphore 00000000 002032 usrsock + + cu to proxy and start the rpmsg ursock client: + + server> cu + proxy> usrsock server & + usrsock [5:80] + proxy> ps + PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND + 0 0 0 FIFO Kthread N-- Ready 00000000 000000 Idle Task + 1 1 224 FIFO Kthread --- Waiting Signal 00000000 002032 hpwork + 3 3 100 FIFO Task --- Running 00000000 004080 init + 4 4 224 FIFO Kthread --- Waiting Signal 00000002 002000 rptun server 0x5671e900 + 5 4 80 FIFO Task --- Waiting Semaphore 00000000 002016 usrsock server + + send ICMP ping to network server via rpmsg usrsock: + + proxy> ping 127.0.0.1 + PING 127.0.0.1 56 bytes of data + 56 bytes from 127.0.0.1: icmp_seq=0 time=20 ms + 56 bytes from 127.0.0.1: icmp_seq=1 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=2 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=3 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=4 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=5 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=6 time=20 ms + 56 bytes from 127.0.0.1: icmp_seq=7 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=8 time=10 ms + 56 bytes from 127.0.0.1: icmp_seq=9 time=10 ms + 10 packets transmitted, 10 received, 0% packet loss, time 10100 ms + + Please read NETWORK-LINUX.txt if you want to try the real address. + sixlowpan This configuration was intended only for unit-level testing of the diff --git a/boards/sim/sim/sim/configs/rpproxy/defconfig b/boards/sim/sim/sim/configs/rpproxy/defconfig new file mode 100644 index 00000000000..16efed69b5a --- /dev/null +++ b/boards/sim/sim/sim/configs/rpproxy/defconfig @@ -0,0 +1,62 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NET_ETHERNET is not set +# CONFIG_SIM_NETDEV is not set +CONFIG_ARCH="sim" +CONFIG_ARCH_BOARD="sim" +CONFIG_ARCH_BOARD_SIM=y +CONFIG_ARCH_CHIP="sim" +CONFIG_ARCH_SIM=y +CONFIG_BOARDCTL_POWEROFF=y +CONFIG_BUILTIN=y +CONFIG_DEV_SIMPLE_ADDRENV=y +CONFIG_FS_HOSTFS=y +CONFIG_FS_HOSTFS_RPMSG=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_LIB_HOSTNAME="proxy" +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSCLIENT_MAXRESPONSE=176 +CONFIG_NETDB_DNSCLIENT_RECV_TIMEOUT=3 +CONFIG_NETDB_DNSSERVER_IPv4ADDR=0x771d1d1d +CONFIG_NET_ICMP_NO_STACK=y +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_TCP_NO_STACK=y +CONFIG_NET_UDP_NO_STACK=y +CONFIG_NET_USRSOCK=y +CONFIG_NET_USRSOCK_OTHER=y +CONFIG_NET_USRSOCK_TCP=y +CONFIG_NET_USRSOCK_UDP=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_PROMPT_STRING="proxy> " +CONFIG_NSH_READLINE=y +CONFIG_OPENAMP=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_READLINE_TABCOMPLETION=y +CONFIG_RPMSG_UART=y +CONFIG_RPTUN=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIG_DEFAULT=y +CONFIG_SIM_M32=y +CONFIG_SIM_WALLTIME=y +CONFIG_SYSLOG_PREFIX=y +CONFIG_SYSLOG_PREFIX_STRING="proxy: " +CONFIG_SYSLOG_RPMSG=y +CONFIG_SYSLOG_TIMESTAMP=y +CONFIG_SYSTEM_CLE=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_USRSOCK_RPMSG=y +CONFIG_TTY_SIGINT=y +CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/boards/sim/sim/sim/configs/rpserver/defconfig b/boards/sim/sim/sim/configs/rpserver/defconfig new file mode 100644 index 00000000000..59e6aa20e43 --- /dev/null +++ b/boards/sim/sim/sim/configs/rpserver/defconfig @@ -0,0 +1,72 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ARCH="sim" +CONFIG_ARCH_BOARD="sim" +CONFIG_ARCH_BOARD_SIM=y +CONFIG_ARCH_CHIP="sim" +CONFIG_ARCH_SIM=y +CONFIG_BOARDCTL_POWEROFF=y +CONFIG_BUILTIN=y +CONFIG_DEV_SIMPLE_ADDRENV=y +CONFIG_FS_HOSTFS=y +CONFIG_FS_HOSTFS_RPMSG_SERVER=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_LIB_HOSTNAME="server" +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSCLIENT_MAXRESPONSE=176 +CONFIG_NETDB_DNSCLIENT_RECV_TIMEOUT=3 +CONFIG_NETDB_DNSSERVER_IPv4ADDR=0x771d1d1d +CONFIG_NETDEVICES=y +CONFIG_NETDEV_STATISTICS=y +CONFIG_NETINIT_DHCPC=y +CONFIG_NETINIT_THREAD=y +CONFIG_NETUTILS_DHCPC=y +CONFIG_NET_ARP_SEND=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_LOOPBACK=y +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_STATISTICS=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_BINDTODEVICE=y +CONFIG_NET_UDP_WRITE_BUFFERS=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_PROMPT_STRING="server> " +CONFIG_NSH_READLINE=y +CONFIG_OPENAMP=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_READLINE_TABCOMPLETION=y +CONFIG_RPMSG_UART=y +CONFIG_RPTUN=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIM_M32=y +CONFIG_SIM_NET_BRIDGE=y +CONFIG_SIM_RPTUN_MASTER=y +CONFIG_SIM_WALLTIME=y +CONFIG_SYSLOG_PREFIX=y +CONFIG_SYSLOG_PREFIX_STRING="server: " +CONFIG_SYSLOG_RPMSG_SERVER=y +CONFIG_SYSLOG_TIMESTAMP=y +CONFIG_SYSTEM_CLE=y +CONFIG_SYSTEM_CUTERM=y +CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE="/dev/ttyproxy" +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_USRSOCK_RPMSG=y +CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/boards/sim/sim/sim/src/sim_appinit.c b/boards/sim/sim/sim/src/sim_appinit.c index 94d1dc2e071..54933376179 100644 --- a/boards/sim/sim/sim/src/sim_appinit.c +++ b/boards/sim/sim/sim/src/sim_appinit.c @@ -41,6 +41,7 @@ #include #include "sim.h" +#include "up_internal.h" /**************************************************************************** * Public Functions @@ -78,6 +79,10 @@ int board_app_initialize(uintptr_t arg) sim_bringup(); #endif +#ifdef CONFIG_RPTUN + up_rptun_init(); +#endif + return 0; } #endif /* CONFIG_LIB_BOARDCTL */