arch/sim: Copy include/nuttx/config.h to the local folder
so the source code compiled by host environment can include config.h directly and then avoid pass Kconfig option through Makefile manually Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Ic9fe6f846082cef2d0808dc717df8ae6ed929edf
This commit is contained in:
parent
3488a98bd7
commit
5e01fe050a
1
arch/sim/src/.gitignore
vendored
1
arch/sim/src/.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
/nuttx-names.dat
|
||||
/nuttx.ld
|
||||
/config.h
|
||||
/hostfs.h
|
||||
/chip
|
||||
/board
|
||||
|
@ -75,7 +75,6 @@ ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
HOSTCFLAGS += -Wno-deprecated-declarations
|
||||
endif
|
||||
|
||||
HOSTCFLAGS += -DCONFIG_USEC_PER_TICK=$(CONFIG_USEC_PER_TICK)
|
||||
HOSTSRCS = up_hostirq.c up_hostmemory.c up_hosttime.c up_simuart.c
|
||||
STDLIBS += -lpthread
|
||||
ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
@ -97,7 +96,6 @@ endif
|
||||
ifeq ($(CONFIG_SMP),y)
|
||||
CSRCS += up_smpsignal.c up_cpuidlestack.c
|
||||
REQUIREDOBJS += up_smpsignal$(OBJEXT)
|
||||
HOSTCFLAGS += -DCONFIG_SMP=1 -DCONFIG_SMP_NCPUS=$(CONFIG_SMP_NCPUS)
|
||||
HOSTSRCS += up_simsmp.c
|
||||
endif
|
||||
|
||||
@ -118,22 +116,16 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SIM_X11FB),y)
|
||||
ifeq ($(CONFIG_SIM_X11NOSHM),y)
|
||||
HOSTCFLAGS += -DCONFIG_SIM_X11NOSHM=1
|
||||
endif
|
||||
HOSTSRCS += up_x11framebuffer.c
|
||||
STDLIBS += -lX11 -lXext
|
||||
ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
|
||||
CSRCS += up_touchscreen.c
|
||||
REQUIREDOBJS += up_touchscreen$(OBJEXT)
|
||||
HOSTCFLAGS += -DCONFIG_SIM_TOUCHSCREEN=1
|
||||
HOSTSRCS += up_x11eventloop.c
|
||||
else ifeq ($(CONFIG_SIM_AJOYSTICK),y)
|
||||
CSRCS += up_ajoystick.c
|
||||
HOSTCFLAGS += -DCONFIG_SIM_AJOYSTICK=1
|
||||
HOSTSRCS += up_x11eventloop.c
|
||||
else ifeq ($(CONFIG_SIM_BUTTONS),y)
|
||||
HOSTCFLAGS += -DCONFIG_SIM_BUTTONS=1
|
||||
HOSTSRCS += up_x11eventloop.c
|
||||
endif
|
||||
endif
|
||||
@ -165,23 +157,14 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_SIM_NETDEV_TAP),y)
|
||||
CSRCS += up_netdriver.c
|
||||
HOSTCFLAGS += -DNETDEV_BUFSIZE=$(CONFIG_NET_ETH_PKTSIZE)
|
||||
ifneq ($(CONFIG_WINDOWS_CYGWIN),y)
|
||||
HOSTSRCS += up_tapdev.c
|
||||
ifeq ($(CONFIG_SIM_NET_BRIDGE),y)
|
||||
HOSTCFLAGS += -DCONFIG_SIM_NET_BRIDGE
|
||||
HOSTCFLAGS += -DCONFIG_SIM_NET_BRIDGE_DEVICE=\"$(CONFIG_SIM_NET_BRIDGE_DEVICE)\"
|
||||
endif
|
||||
ifeq ($(CONFIG_SIM_NET_HOST_ROUTE),y)
|
||||
HOSTCFLAGS += -DCONFIG_SIM_NET_HOST_ROUTE
|
||||
endif
|
||||
else # CONFIG_WINDOWS_CYGWIN != y
|
||||
HOSTSRCS += up_wpcap.c
|
||||
STDLIBS = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
|
||||
endif # CONFIG_WINDOWS_CYGWIN != y
|
||||
else ifeq ($(CONFIG_SIM_NETDEV_VPNKIT),y)
|
||||
CSRCS += up_netdriver.c
|
||||
HOSTCFLAGS += -DCONFIG_SIM_NETDEV_VPNKIT_PATH=\"$(CONFIG_SIM_NETDEV_VPNKIT_PATH)\"
|
||||
HOSTSRCS += up_vpnkit.c
|
||||
VPATH += :sim/vpnkit
|
||||
HOSTSRCS += protocol.c negotiate.c
|
||||
@ -192,10 +175,6 @@ ifeq ($(CONFIG_SIM_HCISOCKET),y)
|
||||
CSRCS += up_hcisocket.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C_RESET),y)
|
||||
HOSTCFLAGS += -DCONFIG_I2C_RESET=1
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SIM_I2CBUS_LINUX),y)
|
||||
HOSTSRCS += up_i2cbuslinux.c
|
||||
endif
|
||||
@ -212,13 +191,12 @@ endif
|
||||
ifeq ($(CONFIG_FS_HOSTFS),y)
|
||||
ifneq ($(CONFIG_FS_HOSTFS_RPMSG),y)
|
||||
HOSTSRCS += up_hostfs.c
|
||||
HOSTCFLAGS += -DCONFIG_NAME_MAX=$(CONFIG_NAME_MAX)
|
||||
|
||||
up_hostfs.c: hostfs.h
|
||||
|
||||
hostfs.h: $(TOPDIR)/include/nuttx/fs/hostfs.h
|
||||
@echo "CP: $<"
|
||||
$(Q) cp $< $@
|
||||
|
||||
up_hostfs.c: hostfs.h
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -325,7 +303,11 @@ makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds) $(HOSTSRCS:.c=.ddh)
|
||||
$(call CATFILE, Make.dep, $^)
|
||||
$(call DELFILE, $^)
|
||||
|
||||
.depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config
|
||||
config.h: $(TOPDIR)/include/nuttx/config.h
|
||||
@echo "CP: $<"
|
||||
$(Q) cp $< $@
|
||||
|
||||
.depend: Makefile config.h $(SRCS) $(TOPDIR)$(DELIM).config
|
||||
$(Q) if [ -e board/Makefile ]; then \
|
||||
$(MAKE) -C board depend ; \
|
||||
fi
|
||||
@ -352,6 +334,7 @@ distclean:: clean
|
||||
fi
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELFILE, config.h)
|
||||
$(call DELFILE, hostfs.h)
|
||||
|
||||
-include Make.dep
|
||||
|
@ -40,10 +40,7 @@
|
||||
#include <nuttx/net/bluetooth.h>
|
||||
#include <nuttx/wireless/bluetooth/bt_driver.h>
|
||||
#include <nuttx/wireless/bluetooth/bt_uart.h>
|
||||
|
||||
#if defined(CONFIG_UART_BTH4)
|
||||
#include <nuttx/serial/uart_bth4.h>
|
||||
#endif
|
||||
#include <nuttx/serial/uart_bth4.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "up_hcisocket_host.h"
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define __SIM__ 1
|
||||
#include "hostfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -25,6 +25,10 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __SIM__
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -25,9 +25,11 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
# include <nuttx/config.h>
|
||||
#else
|
||||
#ifdef __SIM__
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <sys/types.h>
|
||||
# include <stdbool.h>
|
||||
# include <netinet/in.h>
|
||||
@ -89,6 +91,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
struct tcb_s;
|
||||
struct foc_dev_s;
|
||||
struct spi_dev_s;
|
||||
struct qspi_dev_s;
|
||||
struct ioexpander_dev_s;
|
||||
@ -353,8 +356,7 @@ void up_stack_color(void *stackbase, size_t nbytes);
|
||||
/* up_foc.c *****************************************************************/
|
||||
|
||||
#ifdef CONFIG_MOTOR_FOC
|
||||
struct foc_dev_s;
|
||||
FAR struct foc_dev_s *sim_foc_initialize(int inst);
|
||||
struct foc_dev_s *sim_foc_initialize(int inst);
|
||||
void sim_foc_update(void);
|
||||
#endif
|
||||
|
||||
|
@ -53,10 +53,7 @@
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
|
||||
#ifdef CONFIG_NET_PKT
|
||||
# include <nuttx/net/pkt.h>
|
||||
#endif
|
||||
#include <nuttx/net/pkt.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@ -154,7 +156,7 @@ int simuart_getc(int fd)
|
||||
* Name: simuart_getcflag
|
||||
****************************************************************************/
|
||||
|
||||
int simuart_getcflag(int fd, tcflag_t *cflag)
|
||||
int simuart_getcflag(int fd, unsigned int *cflag)
|
||||
{
|
||||
struct termios t;
|
||||
int ret;
|
||||
@ -176,7 +178,7 @@ int simuart_getcflag(int fd, tcflag_t *cflag)
|
||||
* Name: simuart_setcflag
|
||||
****************************************************************************/
|
||||
|
||||
int simuart_setcflag(int fd, tcflag_t cflag)
|
||||
int simuart_setcflag(int fd, unsigned int cflag)
|
||||
{
|
||||
struct termios t;
|
||||
int ret;
|
||||
|
@ -56,11 +56,7 @@
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef CONFIG_SIM_NET_HOST_ROUTE
|
||||
# include <net/route.h>
|
||||
#endif
|
||||
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/if_tun.h>
|
||||
|
@ -23,10 +23,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
# include <stdatomic.h>
|
||||
#endif
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include <syslog.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -174,7 +176,8 @@ static void init_pcap(struct in_addr addr)
|
||||
error_exit("No interface found with IP address");
|
||||
}
|
||||
|
||||
pcap = pcap_open_live(interfaces->name, NETDEV_BUFSIZE, 0, -1, error);
|
||||
pcap = pcap_open_live(interfaces->name,
|
||||
CONFIG_NET_ETH_PKTSIZE, 0, -1, error);
|
||||
if (pcap == NULL)
|
||||
{
|
||||
error_exit(error);
|
||||
|
@ -29,11 +29,10 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
|
||||
#ifndef CONFIG_SIM_X11NOSHM
|
||||
# include <sys/shm.h>
|
||||
# include <X11/extensions/XShm.h>
|
||||
#endif
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
|
@ -198,6 +198,6 @@ ifeq ($(CONFIG_SIM_SANITIZE),y)
|
||||
endif
|
||||
|
||||
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(EXTRAFLAGS) -pipe
|
||||
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(EXTRAFLAGS) -D__SIM__ -pipe
|
||||
|
||||
LDLINKFLAGS += -nostartfiles -nodefaultlibs
|
||||
|
@ -32,6 +32,7 @@
|
||||
# include <dirent.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# include <config.h>
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user