mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
The simulated UART driver currently opens the host path configured by CONFIG_SIM_UARTx_NAME directly. This requires the host-side serial endpoint to exist before NuttX opens the UART, so users and CI jobs need an external setup step such as socat to create a PTY pair. It also means the host endpoint path is effectively a build-time choice: changing the host device path requires changing configuration and rebuilding, which is inconvenient for tests that allocate a fresh PTY path on each run. Add CONFIG_SIM_UART_PTY for Linux sim builds. When enabled, non-console simulated UART ports allocate a host pseudoterminal from /dev/ptmx, put the host master side in raw mode, and print the host slave path when the NuttX UART is opened. The NuttX-side device name remains CONFIG_SIM_UARTx_NAME, for example /dev/ttySIM0, so applications continue to use the normal NuttX serial API. Keep the option disabled by default so existing configurations still open the configured host path directly. Console UART handling is also left on the existing host-open path. Also make host_uart_checkin() and host_uart_checkout() check the actual POLLIN/POLLOUT bits returned by poll(). This avoids treating error-only or unrelated poll events as readable or writable serial readiness. The main benefit is simpler and more deterministic simulator integration: a simulated UART can expose a real host-visible /dev/pts/N endpoint by itself, without pre-creating a matching host device and without rebuilding NuttX when the host PTY path changes. This is useful for host-side test scripts and external protocol tools while keeping application code on the standard NuttX UART interface. Companion apps-side test branch: https://github.com/LingaoM/nuttx-apps/tree/sim_uart_tester Testing: Host: Ubuntu 22.04 x86_64 Board/config: sim:nsh Apps test code: https://github.com/LingaoM/nuttx-apps/tree/sim_uart_tester Common test configuration: CONFIG_NSH_BUILTIN_APPS=y CONFIG_EXAMPLES_HELLO=y CONFIG_SIM_UART_NUMBER=1 CONFIG_SIM_UART0_NAME="/dev/ttySIM0" CONFIG_SIM_UART_PTY=y DMA-mode build and test: 1. Configure sim:nsh with the companion apps tree: ./tools/configure.sh -a ../nuttx-apps sim:nsh 2. Enable the common test configuration above and keep DMA enabled: CONFIG_SIM_UART_DMA=y CONFIG_SERIAL_TXDMA=y CONFIG_SERIAL_RXDMA=y 3. Build: make clean make -j16 4. Start NuttX: ./nuttx 5. In NSH, run the hello test app: nsh> hello /dev/ttySIM0 connected to pseudotty: /dev/pts/73 6. In another terminal, run the host-side tester from the companion apps branch with the printed PTY path: cd ../nuttx-apps ./examples/hello/test_sim_uart_pty.py /dev/pts/73 7. The host-side tester sends 32768 bytes from the host to NuttX and receives 49152 bytes from NuttX to the host. The payload includes non-text binary bytes. Both sides validate deterministic payload contents and checksums, then exchange an ACK. 8. Observed host-side output: HOST_OPEN: /dev/pts/73 HOST_TX: 32768 bytes checksum=0x1f9989f4 HOST_RX: 49152 bytes checksum=0x06a45c69 HOST_TX: ACK TEST PASSED 9. Observed NuttX output: sim_uart_pty_test: binary RX 32768 TX 49152 passed Non-DMA build and test: 1. Disable DMA for the same sim:nsh configuration: # CONFIG_SIM_UART_DMA is not set # CONFIG_SERIAL_TXDMA is not set # CONFIG_SERIAL_RXDMA is not set 2. Refresh the configuration and rebuild. On this host, the installed Python olddefconfig shim is broken, so I refreshed Kconfig directly with kconfig-conf and the same environment that the NuttX Makefile passes to Kconfig: APPSDIR=/mnt/ssd/code/code/nuttx-apps \ APPSBINDIR=/mnt/ssd/code/code/nuttx-apps \ BINDIR=/mnt/ssd/code/code/nuttx \ EXTERNALDIR=/mnt/ssd/code/code/nuttx/dummy \ kconfig-conf --olddefconfig Kconfig make clean make -j16 3. Repeated the same runtime steps as the DMA test: ./nuttx nsh> hello cd ../nuttx-apps ./examples/hello/test_sim_uart_pty.py /dev/pts/73 4. Observed the same successful binary transfer result: HOST_TX: 32768 bytes checksum=0x1f9989f4 HOST_RX: 49152 bytes checksum=0x06a45c69 HOST_TX: ACK TEST PASSED sim_uart_pty_test: binary RX 32768 TX 49152 passed After the non-DMA test, I restored the default DMA configuration, rebuilt, and reran the same binary PTY test successfully so the final local build state was back on CONFIG_SIM_UART_DMA=y. Assisted-by: Claude:Claude-Fable-5 Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
990 lines
26 KiB
Text
990 lines
26 KiB
Text
#
|
|
# For a description of the syntax of this configuration file,
|
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
|
#
|
|
|
|
if ARCH_SIM
|
|
comment "Simulation Configuration Options"
|
|
|
|
choice
|
|
prompt "Host CPU Type"
|
|
default HOST_X86_64
|
|
|
|
config HOST_X86_64
|
|
bool "x86_64"
|
|
select ARCH_64BIT if !SIM_M32
|
|
select ARCH_HAVE_STACKCHECK
|
|
select ARCH_HAVE_MATH_H
|
|
|
|
config HOST_X86
|
|
bool "x86"
|
|
select ARCH_HAVE_STACKCHECK
|
|
|
|
config HOST_ARM
|
|
bool "arm"
|
|
select ARCH_HAVE_STACKCHECK
|
|
|
|
config HOST_ARM64
|
|
bool "arm64"
|
|
select ARCH_64BIT if !SIM_M32
|
|
select ARCH_HAVE_STACKCHECK
|
|
|
|
endchoice # Host CPU Type
|
|
|
|
config ARCH_CHIP
|
|
string
|
|
default "sim"
|
|
|
|
choice
|
|
prompt "Toolchain Selection"
|
|
default SIM_TOOLCHAIN_CLANG if HOST_MACOS
|
|
default SIM_TOOLCHAIN_GCC
|
|
|
|
config SIM_TOOLCHAIN_GCC
|
|
bool "Generic GNU toolchain"
|
|
select ARCH_TOOLCHAIN_GCC
|
|
|
|
config SIM_TOOLCHAIN_CLANG
|
|
bool "LLVM Clang toolchain"
|
|
select ARCH_TOOLCHAIN_CLANG
|
|
|
|
endchoice
|
|
|
|
config SIM_M32
|
|
bool "Build 32-bit simulation on 64-bit machine"
|
|
default n
|
|
depends on HOST_X86_64
|
|
---help---
|
|
Simulation context switching is based on logic like setjmp and longjmp. This
|
|
context switching is only available for 32-bit targets. On 64-bit machines,
|
|
this context switching will fail.
|
|
|
|
The workaround on 64-bit machines for now is to build for a 32-bit target on the
|
|
64-bit machine. The workaround for this issue has been included in NuttX 6.15 and
|
|
beyond. For those versions, you must add SIM_M32=y to the .config file in
|
|
order to enable building a 32-bit image on a 64-bit platform.
|
|
|
|
config SIM_CYGWIN_DECORATED
|
|
bool "Decorated Cygwin names"
|
|
default n
|
|
depends on WINDOWS_CYGWIN
|
|
---help---
|
|
Older versions of Cygwin tools decorated C symbol names by adding an
|
|
underscore to the beginning of the symbol name. Newer versions of
|
|
Cygwin do not seem to do this.
|
|
|
|
How do you know if you need this option? You could look at the generated
|
|
symbol tables to see if there are underscore characters at the beginning
|
|
of the symbol names. Or, if you need this option, the simulation will not
|
|
run: It will crash early, probably in some function due to the failure to
|
|
allocate memory.
|
|
|
|
config SIM_ASAN
|
|
bool "Address Sanitizer"
|
|
default n
|
|
depends on !MM_KASAN && MM_UMM_CUSTOMIZE_MANAGER && FRAME_POINTER
|
|
---help---
|
|
AddressSanitizer (ASan) is a fast compiler-based tool for detecting memory
|
|
bugs in native code.
|
|
|
|
config SIM_UBSAN
|
|
bool "Undefined Behaviour Sanitizer"
|
|
default n
|
|
depends on !MM_UBSAN && FRAME_POINTER
|
|
---help---
|
|
Compile-time instrumentation is used to detect various undefined behaviours
|
|
at runtime.
|
|
|
|
config SIM_UBSAN_DUMMY
|
|
bool "Bypass Undefined Behaviour Sanitizer"
|
|
default n
|
|
depends on SIM_UBSAN
|
|
---help---
|
|
Keep SIM_UBSAN compile time but disable runtime actions.
|
|
|
|
config SIM_PROFILE
|
|
bool "Enable gprof"
|
|
depends on PROFILE_NONE
|
|
default n
|
|
---help---
|
|
Enable support gprof profiling tool.
|
|
|
|
choice
|
|
prompt "X64_64 ABI"
|
|
default SIM_X8664_SYSTEMV if HOST_LINUX
|
|
default SIM_X8664_MICROSOFT if HOST_WINDOWS
|
|
depends on HOST_X86_64 && !SIM_32
|
|
|
|
config SIM_X8664_SYSTEMV
|
|
bool "System V AMD64 ABI"
|
|
---help---
|
|
The calling convention of the System V AMD64 ABI is followed on Solaris,
|
|
Linux, FreeBSD, macOS, and other UNIX-like or POSIX-compliant operating
|
|
systems. The first six integer or pointer arguments are passed in registers
|
|
RDI, RSI, RDX, RCX, R8, and R9, while XMM0, XMM1, XMM2, XMM3, XMM4, XMM5,
|
|
XMM6 and XMM7 are used for floating point arguments. For system calls, R10
|
|
is used instead of RCX. As in the Microsoft x64 calling convention,
|
|
additional arguments are passed on the stack and the return value is stored
|
|
in RAX.
|
|
|
|
Registers RBP, RBX, and R12-R15 are callee-save registers; all others must
|
|
be saved by the caller if they wish to preserve their values.
|
|
|
|
Unlike the Microsoft calling convention, a shadow space is not provided; on
|
|
function entry, the return address is adjacent to the seventh integer argument
|
|
on the stack.
|
|
|
|
config SIM_X8664_MICROSOFT
|
|
bool "Microsoft x64 calling convention"
|
|
---help---
|
|
The Microsoft x64 calling convention is followed on Microsoft Windows and
|
|
pre-boot UEFI (for long mode on x86-64). It uses registers RCX, RDX, R8,
|
|
R9 for the first four integer or pointer arguments (in that order), and
|
|
XMM0, XMM1, XMM2, XMM3 are used for floating point arguments. Additional
|
|
arguments are pushed onto the stack (right to left). Integer return
|
|
values (similar to x86) are returned in RAX if 64 bits or less. Floating
|
|
point return values are returned in XMM0. Parameters less than 64 bits
|
|
long are not zero extended; the high bits are not zeroed.
|
|
|
|
endchoice
|
|
|
|
choice
|
|
prompt "Simulation at a fixed cadence in near real-time"
|
|
default SIM_WALLTIME_SLEEP
|
|
|
|
config SIM_WALLTIME_SLEEP
|
|
bool "Execution the simulation in near real-time using host sleep"
|
|
---help---
|
|
NOTE: This configuration setting will cause the sim target's IDLE loop to delay
|
|
on each call so that the system "timer interrupt" is called at a rate approximately
|
|
correct for the system timer tick rate. With this definition in the configuration,
|
|
sleep() behavior is more or less normal.
|
|
|
|
config SIM_WALLTIME_SIGNAL
|
|
bool "Execute the simulation using a host timer"
|
|
---help---
|
|
Run the NuttX simulation using a host timer that delivers periodic SIGALRM
|
|
events at a tick rate specified by CONFIG_USEC_PER_TICK. Enabling this option
|
|
will generate the timer 'tick' events from the host timer at a fixed rate.
|
|
The simulated 'tick' events from Idle task are no longer sent.
|
|
|
|
endchoice
|
|
|
|
config SIM_WALLTIME_RATIO
|
|
int "Simulated time ratio in percent relative to real time"
|
|
default 100
|
|
range 1 100000
|
|
---help---
|
|
Set the ratio of simulated time to real time in percent.
|
|
100 means real-time (default). 200 means simulated time advances
|
|
twice as fast as real time. 50 means half speed.
|
|
This can also be overridden at runtime with --sim-rt-ratio=<percent>.
|
|
|
|
config SIM_LOOP_INTERVAL
|
|
int "loop interval in ms"
|
|
default 10
|
|
---help---
|
|
Loop event sleep time
|
|
|
|
config SIM_STACKSIZE_ADJUSTMENT
|
|
int "The adjustment of stack size for sim"
|
|
default 65536
|
|
---help---
|
|
The adjustment of stack size for sim. When the task is created,
|
|
the stack size is increased by this amount.
|
|
|
|
config SIM_HOSTFS
|
|
bool "Simulated HostFS"
|
|
depends on FS_HOSTFS
|
|
---help---
|
|
Access host filesystem through HostFS.
|
|
|
|
config SIM_IMAGEPATH_AS_CWD
|
|
bool "Simulator switch working directory"
|
|
default n
|
|
---help---
|
|
If this option is enabled, the working path of nuttx will be modified
|
|
to the folder where the nuttx file is located.
|
|
It affects the file access of hostfs, which will start looking for
|
|
files based on the nuttx image folder.
|
|
Otherwise the default $CWD will be used as the starting path for the search.
|
|
Absolute paths are never affected.
|
|
|
|
choice
|
|
prompt "Simulated Network Interface"
|
|
default SIM_NETDEV
|
|
depends on NET
|
|
optional
|
|
|
|
config SIM_NETDEV
|
|
bool "Simulated Network Device"
|
|
select ARCH_HAVE_NETDEV_STATISTICS
|
|
select SCHED_LPWORK
|
|
select NET_ETHERNET
|
|
---help---
|
|
Build in support for a simulated network device.
|
|
|
|
config SIM_NETUSRSOCK
|
|
bool "Simulated Network Device with Native Stack via usrsock"
|
|
select NET_USRSOCK
|
|
---help---
|
|
Built-in support for a simulated network device using native stack via usrsock
|
|
|
|
endchoice
|
|
|
|
config SIM_CANDEV
|
|
bool "Simulated CAN Device"
|
|
depends on HOST_LINUX
|
|
default n
|
|
---help---
|
|
Build in support for a simulated CAN device.
|
|
|
|
if SIM_CANDEV
|
|
|
|
config SIM_CANDEV_CHAR
|
|
bool "Simulated CAN Device as CAN character driver"
|
|
default n
|
|
depends on CAN
|
|
select ARCH_HAVE_CAN_ERRORS
|
|
|
|
config SIM_CANDEV_SOCK
|
|
bool "Simulated CAN Device as SocketCAN"
|
|
default n
|
|
depends on NET_CAN
|
|
select NET_CAN_HAVE_ERRORS
|
|
select NET_CAN_HAVE_CANFD
|
|
|
|
endif # SIM_CANDEV
|
|
|
|
if SIM_NETDEV
|
|
|
|
choice
|
|
prompt "Simulated Network Device Type"
|
|
default SIM_NETDEV_TAP
|
|
|
|
config SIM_NETDEV_TAP
|
|
bool "Simulated Network Device with TAP/WPCAP"
|
|
depends on (HOST_LINUX || HOST_WINDOWS)
|
|
---help---
|
|
Build in support for a simulated network device using a TAP device on Linux or
|
|
WPCAP on Windows.
|
|
|
|
config SIM_NETDEV_VPNKIT
|
|
bool "Simulated Network Device with VPNKit"
|
|
---help---
|
|
Build in support for a simulated network device using VPNKit.
|
|
|
|
endchoice
|
|
|
|
config SIM_NETDEV_MTU
|
|
int "The MTU of Simulated Network Device"
|
|
default 1500
|
|
range 1280 65535 if NET_IPv6
|
|
range 576 65535 if !NET_IPv6
|
|
---help---
|
|
The MTU of the network devices.
|
|
|
|
config SIM_NETDEV_NUMBER
|
|
int "Number of Simulated Network Device"
|
|
default 1
|
|
range 1 8
|
|
depends on SIM_NETDEV
|
|
---help---
|
|
The number of simulated network devices.
|
|
|
|
Note that only one network device will be brought up by netinit automatically,
|
|
others will be kept in DOWN state by default.
|
|
|
|
if SIM_NETDEV && DRIVERS_IEEE80211 && NETDEV_WIRELESS_HANDLER
|
|
|
|
config SIM_WIFIDEV_NUMBER
|
|
int "Number of Simulated WiFi Device"
|
|
default 0
|
|
range 0 SIM_NETDEV_NUMBER
|
|
---help---
|
|
The number of simulated wifi network devices.
|
|
|
|
Note that only one network device will be brought up by netinit automatically,
|
|
others will be kept in DOWN state by default.
|
|
|
|
choice
|
|
prompt "Select SimWiFi Platform"
|
|
depends on SIM_WIFIDEV_NUMBER != 0
|
|
default SIM_WIFIDEV_HOST
|
|
|
|
config SIM_WIFIDEV_HOST
|
|
bool "Use the host Wi-Fi interfaces"
|
|
---help---
|
|
Use the host Wi-Fi interfaces, which are either simulated by
|
|
hwsim or the real wireless network cards.
|
|
|
|
config SIM_WIFIDEV_PSEUDO
|
|
bool "Use the Simulated Wi-Fi devices"
|
|
depends on DRIVERS_WIFI_SIM
|
|
---help---
|
|
Use the Simulated Wi-Fi devices, which are supported by the bss file.
|
|
endchoice
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
config SIM_NETDEV_VPNKIT_PATH
|
|
string "Unix domain socket to communicate with VPNKit"
|
|
default "/tmp/vpnkit-nuttx"
|
|
depends on SIM_NETDEV_VPNKIT
|
|
|
|
if HOST_LINUX
|
|
choice
|
|
prompt "Simulation Network Type"
|
|
default SIM_NET_HOST_ROUTE
|
|
depends on SIM_NETDEV_TAP
|
|
|
|
config SIM_NET_HOST_ROUTE
|
|
bool "Use local host route"
|
|
---help---
|
|
Add a host route for the simulation that points to the created tap device. The
|
|
simulation will not be able to access the public network unless iptables is
|
|
configured to masquerade for it. See boards/sim/sim sim/NETWORK-LINUX.txt
|
|
for more information.
|
|
|
|
config SIM_NET_BRIDGE
|
|
bool "Attach to Linux bridge"
|
|
---help---
|
|
Add the created tap device to the specified bridge. You will need to manually
|
|
configure the bridge IP address (if any) and routes that point to the bridge.
|
|
See boards/sim/sim/sim/NETWORK-LINUX.txt for more information.
|
|
|
|
endchoice
|
|
endif
|
|
|
|
if SIM_NET_BRIDGE
|
|
config SIM_NET_BRIDGE_DEVICE
|
|
string "Bridge device to attach"
|
|
default "nuttx0"
|
|
---help---
|
|
The name of the bridge device (as passed to "brctl create") to which the simulation's
|
|
TAP interface should be added.
|
|
|
|
endif
|
|
|
|
config SIM_SOUND
|
|
bool "Simulated sound support"
|
|
depends on AUDIO
|
|
default y
|
|
|
|
if SIM_SOUND
|
|
|
|
choice
|
|
prompt "Simulated sound Type"
|
|
default SIM_SOUND_ALSA
|
|
|
|
config SIM_SOUND_ALSA
|
|
bool "alsa support on sim"
|
|
depends on HOST_LINUX
|
|
depends on AUDIOUTILS_LIBMAD
|
|
depends on AUDIOUTILS_LAME
|
|
|
|
endchoice
|
|
|
|
endif
|
|
|
|
config SIM_OFFLOAD_NUM_BUFFERS
|
|
int "Number of offload buffers for audio processing"
|
|
default 2
|
|
---help---
|
|
Specifies the number of offload buffers to allocate for audio processing.
|
|
If Driver Specified buffer sizes is enabled (below), then the
|
|
low-level drivers will have the opportunity to override this
|
|
value.
|
|
|
|
config SIM_OFFLOAD_BUFFER_NUMBYTES
|
|
int "Size of each offload buffer for audio processing"
|
|
default 32767
|
|
---help---
|
|
Specifies the allocation size for each offload buffer
|
|
If Driver Specified buffer sizes is enabled (below), then the
|
|
low-level drivers will have the opportunity to override this
|
|
value.
|
|
|
|
config SIM_CAMERA
|
|
bool "Simulated camera support"
|
|
depends on VIDEO
|
|
default y
|
|
|
|
if SIM_CAMERA
|
|
|
|
choice
|
|
prompt "Simulated camera device type"
|
|
default SIM_CAMERA_V4L2 if HOST_LINUX
|
|
default SIM_CAMERA_AVFOUNDATION if HOST_MACOS
|
|
|
|
config SIM_CAMERA_V4L2
|
|
bool "V4L2 camera support on sim"
|
|
depends on HOST_LINUX
|
|
|
|
config SIM_CAMERA_AVFOUNDATION
|
|
bool "AVFoundation camera support on sim"
|
|
depends on HOST_MACOS
|
|
|
|
endchoice
|
|
|
|
config SIM_CAMERA_DEV_PATH
|
|
string "NuttX video device path prefix"
|
|
default "/dev/video"
|
|
|
|
endif
|
|
|
|
menu "Simulated v4l2m2m support"
|
|
|
|
config SIM_VIDEO_DECODER
|
|
bool "Video decoder support on sim"
|
|
depends on VIDEO
|
|
depends on VIDEOUTILS_OPENH264
|
|
default n
|
|
---help---
|
|
v4l2m2m simlator decoder, dependent on videoutils_openh264.
|
|
|
|
config SIM_VIDEO_DECODER_DEV_PATH
|
|
string "Video decoder device path"
|
|
depends on SIM_VIDEO_DECODER
|
|
default "/dev/video1"
|
|
|
|
config SIM_VIDEO_ENCODER
|
|
bool "Video encoder support on sim"
|
|
depends on VIDEO
|
|
depends on VIDEOUTILS_LIBX264
|
|
default n
|
|
---help---
|
|
v4l2m2m simlator encoder, dependent on videoutils_libx264.
|
|
|
|
config SIM_VIDEO_ENCODER_DEV_PATH
|
|
string "Video encoder device path"
|
|
depends on SIM_VIDEO_ENCODER
|
|
default "/dev/video2"
|
|
|
|
endmenu
|
|
|
|
menu "Simulated Graphics/Input"
|
|
|
|
config SIM_X11FB
|
|
bool "X11 graphics/input"
|
|
default n
|
|
select SCHED_LPWORK
|
|
---help---
|
|
Use X11 to provide graphics and input emulation to interact with host.
|
|
|
|
if SIM_X11FB
|
|
config SIM_X11NOSHM
|
|
bool "Don't use shared memory with X11"
|
|
default n
|
|
---help---
|
|
Don't use shared memory with the X11 graphics device emulation.
|
|
|
|
config SIM_X11UPDATE_INTERVAL
|
|
int "X11 update interval in ms"
|
|
default 16
|
|
---help---
|
|
X11 update sleep time
|
|
|
|
menu "Window Configuration"
|
|
|
|
config SIM_FBHEIGHT
|
|
int "Display height"
|
|
default 240
|
|
---help---
|
|
Simulated display height. Default: 240
|
|
|
|
config SIM_FBWIDTH
|
|
int "Display width"
|
|
default 320
|
|
---help---
|
|
Simulated width of the display. Default: 320
|
|
|
|
config SIM_FBBPP
|
|
int "Pixel depth in bits"
|
|
default 32
|
|
---help---
|
|
Pixel depth in bits. Valid choices are 4, 8, 16, 24, or 32.
|
|
If you use the X11 display emulation, the selected BPP must match the BPP
|
|
of your graphics hardware (probably 32 bits). Default: 32
|
|
|
|
config SIM_FRAMEBUFFER_COUNT
|
|
int "Framebuffer count"
|
|
depends on SIM_FRAMEBUFFER
|
|
default 2
|
|
---help---
|
|
Framebuffer count.
|
|
Simulated framebuffer count. Default: 2
|
|
|
|
config SIM_FB_INTERVAL_LINE
|
|
int "The line between non-consecutive framebuffers"
|
|
depends on SIM_FRAMEBUFFER && SIM_FRAMEBUFFER_COUNT > 1
|
|
default 0
|
|
---help---
|
|
When SIM_FB_INTERVAL_LINE = 0, the framebuffers are consecutive.
|
|
When SIM_FB_INTERVAL_LINE > 0, the first buffer is not consecutive with
|
|
the second buffer, and the interval between discontinuous buffers is
|
|
SIM_FB_INTERVAL_LINE * stride. Default: 0
|
|
|
|
endmenu
|
|
|
|
choice
|
|
prompt "Graphics Device"
|
|
default SIM_FRAMEBUFFER
|
|
---help---
|
|
Choose which kind of graphics device to emulate
|
|
|
|
config SIM_LCDDRIVER
|
|
bool "LCD device"
|
|
depends on LCD
|
|
---help---
|
|
Emulate an LCD driver
|
|
|
|
config SIM_FRAMEBUFFER
|
|
bool "Framebuffer"
|
|
depends on VIDEO_FB
|
|
---help---
|
|
Emulate a framebuffer
|
|
|
|
endchoice
|
|
|
|
endif # SIM_X11FB
|
|
|
|
if INPUT
|
|
config SIM_X11EVENT_INTERVAL
|
|
int "X11 event interval in ms"
|
|
default 8
|
|
depends on SIM_X11FB
|
|
---help---
|
|
X11 event sleep time
|
|
|
|
choice
|
|
prompt "Input Device"
|
|
default SIM_NOINPUT
|
|
|
|
config SIM_TOUCHSCREEN
|
|
bool "X11 mouse-based touchscreen emulation"
|
|
select INPUT_TOUCHSCREEN
|
|
depends on SIM_X11FB
|
|
---help---
|
|
Support an X11 mouse-based touchscreen emulation. Also needs INPUT=y
|
|
|
|
config SIM_AJOYSTICK
|
|
bool "X11 mouse-based analog joystick emulation"
|
|
depends on SIM_X11FB
|
|
---help---
|
|
Support an X11 mouse-based analog joystick emulation. Also needs INPUT=y
|
|
|
|
config SIM_BUTTONS
|
|
bool "X11 mouse-based button emulation"
|
|
depends on SIM_X11FB
|
|
---help---
|
|
Support an X11 mouse-based button emulation
|
|
(left-click mapped to button press). Also needs INPUT=y
|
|
|
|
config SIM_NOINPUT
|
|
bool "No input device"
|
|
|
|
endchoice # Input Device
|
|
|
|
config SIM_KEYBOARD
|
|
bool "X11 keyboard"
|
|
select INPUT_KEYBOARD
|
|
depends on SIM_X11FB
|
|
---help---
|
|
Support an X11 mouse-based keyboard emulation. Also needs INPUT=y
|
|
|
|
config SIM_KEYBOARD_BUFFSIZE
|
|
int "sim keyboard buffer size"
|
|
default 64
|
|
depends on SIM_KEYBOARD
|
|
---help---
|
|
Emulator keyboard buffer size
|
|
|
|
endif # if INPUT
|
|
|
|
endmenu
|
|
|
|
config SIM_HCISOCKET
|
|
bool "Attach Host Bluetooth"
|
|
default false
|
|
depends on HOST_LINUX && (UART_BTH4 || UART_BTH5 || WIRELESS_BLUETOOTH)
|
|
---help---
|
|
Attached the local bluetooth device to the simulation
|
|
target via HCI_CHANNEL_USER. This gives NuttX full
|
|
control of the device, but is abstracted from the
|
|
physical interface which is still handled by Linux.
|
|
|
|
config SIM_HCISOCKET_DEVID
|
|
int "Bluetooth Device ID"
|
|
default 0
|
|
depends on SIM_HCISOCKET
|
|
---help---
|
|
Attached the local bluetooth device use specific
|
|
Bluetooth HCI number id.
|
|
|
|
config SIM_I2CBUS
|
|
bool "Simulated I2C Bus"
|
|
default n
|
|
select I2C
|
|
---help---
|
|
Build in support for simulated i2c bus
|
|
|
|
if SIM_I2CBUS
|
|
|
|
choice
|
|
prompt "Simulated I2C Bus Type"
|
|
default SIM_I2CBUS_LINUX
|
|
|
|
config SIM_I2CBUS_LINUX
|
|
bool "Linux I2C Bus Character Dev"
|
|
depends on HOST_LINUX
|
|
---help---
|
|
Attach a Linux I2C bus via the character device
|
|
interface. This should be used with caution as it
|
|
could interfere with devices internal to the system.
|
|
It is recommended to use this with a USB<>I2C device
|
|
like the MCP2221 and set udev rules so that only
|
|
the bus provided by this device can be controlled
|
|
by the user running the simulator.
|
|
https://www.kernel.org/doc/html/latest/i2c/dev-interface.html
|
|
|
|
endchoice
|
|
|
|
config SIM_I2CBUS_ID
|
|
int "I2C host bus ID to attach to simulator"
|
|
default 0
|
|
depends on SIM_I2CBUS
|
|
---help---
|
|
This is the bus identifier that should be used by the host implementation to
|
|
attach to the simulator driver.
|
|
|
|
endif
|
|
|
|
config SIM_SPI
|
|
bool "Simulated SPI port"
|
|
default n
|
|
select SPI
|
|
---help---
|
|
Build in support for simulated spi port
|
|
|
|
if SIM_SPI
|
|
|
|
choice
|
|
prompt "Simulated SPI Type"
|
|
default SIM_SPI_LINUX
|
|
|
|
config SIM_SPI_LINUX
|
|
bool "Linux SPI Character Dev"
|
|
depends on HOST_LINUX
|
|
---help---
|
|
Attach a Linux SPI port via the character device
|
|
interface. To achieve a SPI port on Linux host, it is
|
|
recommended to use a USB<>SPI device such as CH341A/B.
|
|
|
|
endchoice
|
|
|
|
config SIM_SPIDEV_NAME
|
|
string "the name of SPI host dev to attach to simulator"
|
|
default "/dev/spidev0.0"
|
|
depends on SIM_SPI
|
|
---help---
|
|
This is the name of the SPI device on the host implementation to
|
|
attach to the simulator driver.
|
|
|
|
endif
|
|
|
|
config SIM_GPIOCHIP
|
|
bool "Simulated gpiochip"
|
|
default n
|
|
depends on IOEXPANDER
|
|
---help---
|
|
Build in support for simulated gpiochip
|
|
|
|
if SIM_GPIOCHIP
|
|
|
|
choice
|
|
prompt "Simulated GPIOCHIP Type"
|
|
default SIM_GPIOCHIP_LINUX
|
|
|
|
config SIM_GPIOCHIP_LINUX
|
|
bool "Linux Gpiochip Character Dev"
|
|
depends on HOST_LINUX
|
|
---help---
|
|
Attach a Linux Gpiochip via the character device
|
|
interface. To achieve a SPI port on Linux host, it is
|
|
recommended to use a USB<>GPIO device such as CH341A/B.
|
|
|
|
endchoice
|
|
|
|
config SIM_GPIOCHIP_NAME
|
|
string "the name of host gpiochip dev to attach to simulator"
|
|
default "/dev/gpiochip0"
|
|
---help---
|
|
This is the name of the gpiochip device on the host implementation to
|
|
attach to the simulator driver.
|
|
|
|
endif
|
|
|
|
menu "Simulated UART"
|
|
|
|
config SIM_UART_DMA
|
|
bool "SIM UART use DMA mode"
|
|
default y
|
|
select SERIAL_TXDMA
|
|
select SERIAL_RXDMA
|
|
---help---
|
|
console use DMA mode or single char mode
|
|
|
|
config SIM_UART_NUMBER
|
|
int "Number of simulated UART ports"
|
|
default 0
|
|
range 0 4
|
|
---help---
|
|
Under simulation, a NuttX port can be bound to a serial
|
|
port on the host machine. This way NuttX can access the
|
|
host's hardware directly.
|
|
|
|
There are two possibilities regarding the host's port:
|
|
it can be either a physical one, or a simulated one.
|
|
|
|
In case of a physical port, NuttX will be able to open
|
|
this port and communicate with any actual hardware that
|
|
it is connected to. This is useful for testing code that
|
|
uses external hardware (e.g. sensors or other boards).
|
|
In order for this to work, NuttX port name must be set to
|
|
the same name that the host is using for this port (e.g.
|
|
/dev/ttyUSB0).
|
|
|
|
Alternatively, a "simulated" host port may be used to.
|
|
This is useful if you need to also simulate the external
|
|
hardware, or to have NuttX communicate with any other
|
|
software in your system.
|
|
You can create a "simulated" port in your host,
|
|
by running:
|
|
|
|
socat PTY,link=/dev/ttySIM0 PTY,link=/dev/ttyNX0
|
|
stty -F /dev/ttySIM0 raw
|
|
stty -F /dev/ttyNX0 raw
|
|
|
|
This will create two new ports on your system.
|
|
NuttX will use the ttySIM0 port, and another software
|
|
may open and use the ttyNX0 port.
|
|
Anything sent to the one of these ports will be relayed
|
|
automatically to the other, and vice-versa.
|
|
|
|
If SIM_UART_PTY is enabled, NuttX creates the simulated
|
|
host pseudoterminal itself. In that mode SIM_UARTx_NAME is
|
|
only the NuttX device name, and the host pseudoterminal path
|
|
is printed when the port is opened.
|
|
|
|
config SIM_UART_BUFFER_SIZE
|
|
int "UART buffer size"
|
|
default 256
|
|
depends on SIM_UART_NUMBER >= 1
|
|
---help---
|
|
The size of the transmit and receive buffers of the
|
|
simulated UART ports.
|
|
|
|
Note that all ports will have the same buffer size.
|
|
|
|
config SIM_UART_PTY
|
|
bool "Create host pseudoterminals for simulated UART ports"
|
|
default n
|
|
depends on HOST_LINUX && SIM_UART_NUMBER >= 1
|
|
---help---
|
|
Open a new host pseudoterminal for each simulated UART
|
|
instead of opening an existing host serial device. The
|
|
UART remains registered in NuttX using SIM_UARTx_NAME, and
|
|
the host PTY slave path is printed when the port is opened.
|
|
|
|
The existing behavior requires the host endpoint named by
|
|
SIM_UARTx_NAME to exist before the simulated UART is opened.
|
|
This makes automated tests awkward when the peer endpoint is
|
|
a generated PTY with a host-dependent path, because the host
|
|
path must be prepared up front and encoded in the NuttX
|
|
configuration. With this option enabled, the sim UART
|
|
backend owns the host PTY allocation and reports the actual
|
|
slave path at runtime, while keeping the NuttX device name
|
|
stable for applications.
|
|
|
|
If disabled, SIM UART keeps the existing behavior and opens
|
|
the host device path specified by SIM_UARTx_NAME directly.
|
|
|
|
config SIM_UART0_NAME
|
|
string "UART port 0 name"
|
|
default "/dev/ttySIM0"
|
|
depends on SIM_UART_NUMBER >= 1
|
|
---help---
|
|
This is the name of the simulated UART port.
|
|
The port will be registered in NuttX under this name.
|
|
|
|
If SIM_UART_PTY is disabled, a UART port must also exist on
|
|
the host system with the exact same name specified here. If
|
|
SIM_UART_PTY is enabled, the host pseudoterminal is allocated
|
|
automatically and printed when this port is opened.
|
|
|
|
config SIM_UART1_NAME
|
|
string "UART port 1 name"
|
|
default "/dev/ttySIM1"
|
|
depends on SIM_UART_NUMBER >= 2
|
|
---help---
|
|
This is the name of the simulated UART port.
|
|
The port will be registered in NuttX under this name.
|
|
|
|
If SIM_UART_PTY is disabled, a UART port must also exist on
|
|
the host system with the exact same name specified here. If
|
|
SIM_UART_PTY is enabled, the host pseudoterminal is allocated
|
|
automatically and printed when this port is opened.
|
|
|
|
config SIM_UART2_NAME
|
|
string "UART port 2 name"
|
|
default "/dev/ttySIM2"
|
|
depends on SIM_UART_NUMBER >= 3
|
|
---help---
|
|
This is the name of the simulated UART port.
|
|
The port will be registered in NuttX under this name.
|
|
|
|
If SIM_UART_PTY is disabled, a UART port must also exist on
|
|
the host system with the exact same name specified here. If
|
|
SIM_UART_PTY is enabled, the host pseudoterminal is allocated
|
|
automatically and printed when this port is opened.
|
|
|
|
config SIM_UART3_NAME
|
|
string "UART port 3 name"
|
|
default "/dev/ttySIM3"
|
|
depends on SIM_UART_NUMBER >= 4
|
|
---help---
|
|
This is the name of the simulated UART port.
|
|
The port will be registered in NuttX under this name.
|
|
|
|
If SIM_UART_PTY is disabled, a UART port must also exist on
|
|
the host system with the exact same name specified here. If
|
|
SIM_UART_PTY is enabled, the host pseudoterminal is allocated
|
|
automatically and printed when this port is opened.
|
|
|
|
config SIM_RAM_UART
|
|
bool "SIM RAM UART Device"
|
|
depends on RAM_UART
|
|
default n
|
|
---help---
|
|
SIM RAM UART. It emulates a UART device but using a RAM memory
|
|
instead a physical peripheral.
|
|
|
|
if SIM_RAM_UART
|
|
config SIM_RAM_UART0
|
|
bool "SIM RAM UART Device 0"
|
|
default n
|
|
---help---
|
|
sim ram uart device 0
|
|
|
|
config SIM_RAM_UART0_SLAVE
|
|
bool "SIM_RAM_UART0 is slave"
|
|
depends on SIM_RAM_UART0
|
|
default n
|
|
---help---
|
|
The sim ram uart0 is slave
|
|
|
|
config SIM_RAM_UART1
|
|
bool "SIM RAM UART Device 1"
|
|
default n
|
|
---help---
|
|
sim ram uart device 1
|
|
|
|
config SIM_RAM_UART1_SLAVE
|
|
bool "SIM_RAM_UART1 is slave"
|
|
depends on SIM_RAM_UART1
|
|
default n
|
|
---help---
|
|
The sim ram uart1 is slave
|
|
|
|
config SIM_RAM_UART2
|
|
bool "SIM RAM UART Device 2"
|
|
default n
|
|
---help---
|
|
sim ram uart device 2
|
|
|
|
config SIM_RAM_UART2_SLAVE
|
|
bool "SIM_RAM_UART2 is slave"
|
|
depends on SIM_RAM_UART2
|
|
default n
|
|
---help---
|
|
The sim ram uart2 is slave
|
|
endif
|
|
|
|
endmenu
|
|
|
|
config SIM_USB_DEV
|
|
bool "Linux USB Device"
|
|
select USBDEV
|
|
---help---
|
|
Build in support for simulated usb device
|
|
|
|
if SIM_USB_DEV
|
|
|
|
config SIM_USB_RAW_GADGET
|
|
bool "Simulated USB Raw Gadget Dev"
|
|
default n
|
|
depends on HOST_LINUX
|
|
---help---
|
|
Use USB Raw Gadget and Dummy HCD/UDC to set up virtual
|
|
USB Device and Host controller that connected to each
|
|
other inside the kernel.
|
|
|
|
Get Raw Gadget:
|
|
Get Raw Gadget code at https://github.com/xairy/raw-gadget.
|
|
|
|
Make Raw Gadget:
|
|
Run make in the raw_gadget and dummy_hcd directory. If raw_gadget
|
|
build fail, you need to check which register interface meets your
|
|
kernel version, usb_gadget_probe_driver or usb_gadget_register_driver.
|
|
|
|
Install Raw Gadget:
|
|
Run ./insmod.sh in the raw_gadget and dummy_hcd directory.
|
|
|
|
endif
|
|
|
|
config SIM_USB_HOST
|
|
bool "Linux USB Host"
|
|
select USBHOST
|
|
select USBHOST_HAVE_ASYNCH
|
|
select USBHOST_ASYNCH
|
|
---help---
|
|
Build in support for simulated usb host
|
|
|
|
if SIM_USB_HOST
|
|
|
|
config SIM_LIBUSB
|
|
bool "Simulated USB Host use libusb"
|
|
default n
|
|
depends on HOST_LINUX
|
|
---help---
|
|
Use libusb to set up virtual USB Host controller.
|
|
|
|
config SIM_USB_VID
|
|
hex "Simulated USB Dev VID"
|
|
default 0x18d1
|
|
|
|
config SIM_USB_PID
|
|
hex "Simulated USB Dev PID"
|
|
default 0x4e11
|
|
|
|
config SIM_USB_STACKSIZE
|
|
int "Simulated USB waiter stack size"
|
|
default 1024
|
|
|
|
config SIM_USB_PRIO
|
|
int "Simulated USB waiter task priority"
|
|
default 100
|
|
|
|
endif
|
|
|
|
config SIM_CUSTOM_DATA_SECTION
|
|
string "Custom data section name for Simulator"
|
|
default ""
|
|
---help---
|
|
Custom data section name for Simulator to allow
|
|
developer to define special data sections.
|
|
|
|
endif # ARCH_SIM
|