Commit graph

1568 commits

Author SHA1 Message Date
Xiang Xiao
a0357b3a65 !include/fcntl.h: align open flags with Linux values
Align the NuttX open(2) flag constants with the Linux asm-generic
values so that the FUSE wire protocol and other cross-platform
interfaces work without conversion.

All code that used '(flags & O_RDONLY)' as a bitmask check (always 0
now that O_RDONLY=0) has been updated to use '(flags & O_ACCMODE)'
comparisons.

The NUTTX_O_* constants in include/nuttx/fs/hostfs.h are updated to
match, and the sim hostfs open flag mapping is fixed.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-07-03 10:33:47 +08:00
Shoji Tokunaga
db1035f820 arch/sim: Add dependencies for Rust cargo in make builds
Add `EXTRA_LIB_DEPS` to the simulator nuttx target prerequisites.

This lets Make notice when an extra application library, such as a Rust
static library rebuilt by Cargo, has changed and ensures the final
simulator binary is relinked.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
2026-06-10 08:57:45 -03:00
Lingao Meng
64f1962568 arch/sim: walk frame-pointer chain for non-running tasks in up_backtrace
The previous up_backtrace() relied entirely on host_backtrace() (a thin
wrapper around glibc's backtrace()), which can only unwind the host
thread that calls it.  As a result, when assert / dump_tasks() walked the
task list and called sched_dumpstack() for every task, every task other
than the currently-running one returned a zero-length backtrace, and the
output was silently dropped.  In practice this meant that on sim only
the crashing task ever produced a usable trace.

Fix this by walking the frame-pointer chain ourselves whenever the
target tcb is not the running task.  Because sim's setjmp/longjmp is
provided by NuttX itself (libs/libc/machine/sim/arch_setjmp_*.S) and not
by host libc, the rbp/rsp/rip (or arm fp/sp/pc) saved in tcb->xcp.regs
are plain unmangled pointers, identical across Linux, macOS and Windows
hosts.  The frame layout ([fp]=prev fp, [fp+1]=return address) is also
shared by every host ABI sim supports (x86, x86_64, ARM, ARM64).

The walker validates that fp lies inside the task's stack and is
properly aligned, and stops when fp[0] is NULL, so a corrupted stack
cannot make us read out of bounds.  The running-task path is unchanged
and still uses host_backtrace() so DWARF unwinding through host
libraries continues to work.

Requires CONFIG_FRAME_POINTER=y so the compiler emits a usable fp link.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-06-10 08:54:41 -03:00
hanzj
9aada7f9ae arch/sim: Fix OOB read/write in usrsock_ioctl_handler
usrsock_ioctl_handler() copies req->arglen bytes from the request
payload into the fixed-size usrsock->out buffer without validating
that the payload fits either the received request or the destination
buffer.  This is the same class of vulnerability as the one already
fixed in nrf91_modem_sock.c (commit a43fb69283).

Add three checks before the copy:

  - len >= sizeof(*req): ensure the full request header is present.
  - copylen <= len - sizeof(*req): payload must fit the received data.
  - copylen <= SIM_USRSOCK_BUFSIZE - sizeof(*ack): payload must fit
    the destination buffer.

Signed-off-by: hanzj <hanzjian@zepp.com>
2026-06-10 19:29:28 +08:00
Shoji Tokunaga
7c38d58675 tools/rust: Fix aarch64 NuttX Rust target specs
Add a custom aarch64 Mach-O Rust target for macOS sim builds and use it
instead of an Apple Darwin Rust target. This keeps Rust cfg values aligned
with NuttX while producing Mach-O objects required by the simulator link.

Also align sim host handling for aarch64 Linux by detecting `aarch64` as
`HOST_ARM64` and avoiding x86-specific `-mcmodel` and `-no-pie` options
on ARM64 hosts.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
2026-05-29 10:25:10 +02:00
hanzhijian
2969c8807e arch/sim: Stop publishing stale X11 display during teardown.
sim_x11events() polls g_display from the idle loop while the
framebuffer teardown path closes the X connection.  Clear the global
Display handle before teardown so the event path stops using it, but
keep the saved local Display pointer for XShmDetach(), XUngrabButton(),
and XCloseDisplay().

This only changes the sim X11 framebuffer shutdown ordering and does
not change user-visible APIs or build configuration.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-05-27 13:16:29 +02:00
yushuailong
9e58127339 arch/sim: Add MM_FILL_ALLOCATIONS support to sim customized heap.
When CONFIG_MM_UMM_CUSTOMIZE_MANAGER is enabled, the sim heap
bypasses mm_heap/tlsf entirely and calls host malloc/free directly,
so MM_FILL_ALLOCATIONS has no effect. Add fill pattern support
directly in sim_ummheap.c:
- malloc: fill user region with 0xaa
- free: fill user region with 0x55
- realloc: fill extended region with 0xaa

This helps detect uninitialized reads in sim environment,
which ASan does not support.

Signed-off-by: yushuailong <yyyusl@qq.com>
2026-05-27 01:40:18 +08:00
Matteo Golin
94f3db6bff sim/keyboard: Translate X11 key codes to NuttX codec
The previous implementation just passed X11 key codes to the NuttX
keyboard driver, which only really worked correctly for the letter keys.
Now, special keys are translated into the NuttX codec (like Enter, arrow
keys, etc.) so that they can be used properly by NuttX applications
relying on keyboard input.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-24 16:01:31 -03:00
Shoji Tokunaga
5349a5ab0c arch/sim: replace macOS C++ constructor runtime hack with post-link patch
- Invoke `codesign` and after lief rewrites the binary, so the modified
   Mach-O remains loadable on macOS.
- Run the patch script via a dedicated `sim_patch_macho_initsection`
  custom target attached to `nuttx_post`, instead of a POST_BUILD
  command on the `nuttx` target.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
2026-05-19 07:08:55 -03:00
Xiang Xiao
754dfd980b arch/sim: replace macOS C++ constructor runtime hack with post-link patch
The sim architecture needs to defer C++ global constructors until after
NuttX kernel initialization completes. On macOS this was previously done
via a runtime hack (sim_macho_init.c): a __attribute__((constructor))
function intercepted constructors, saved them, and replayed them later.
That approach was fragile because it depended on constructor ordering
and required mprotect() to patch the read-only __mod_init_func section
at runtime.

This commit replaces the runtime hack with a post-link patching scheme:

  1. Link with -Wl,-ld_classic,-no_fixup_chains to keep the classic
     __mod_init_func pointer format (prevents ld64 from converting it
     to __init_offsets).
  2. Post-link, run patch_macho_initsection.py (python3 + lief) to
     patch Mach-O section type flags from
     MOD_INIT_FUNC_POINTERS/INIT_FUNC_OFFSETS to REGULAR, so dyld
     skips them entirely.
  3. Use the Mach-O auto-generated boundary symbols
     section$start$__DATA_CONST$__mod_init_func /
     section$end$__DATA_CONST$__mod_init_func, mapped via __asm()
     labels in arch/sim/include/arch.h to the common _sinit[]/_einit[]
     names used by lib_cxx_initialize().

Linux behavior is unchanged.

Changes:
  - arch/sim/include/arch.h: add macOS __asm() declarations for
    _sinit/_einit
  - arch/sim/src/Makefile: drop sim_macho_init.c HEADSRC handling,
    always pass -ld_classic,-no_fixup_chains on macOS, run
    patch_macho_initsection.py after link when CONFIG_HAVE_CXXINITIALIZE
  - arch/sim/src/sim/CMakeLists.txt: same for the CMake build
  - arch/sim/src/patch_macho_initsection.py: new lief-based patcher
  - arch/sim/src/sim/posix/sim_macho_init.c: deleted (135-line hack)
  - libs/libc/misc/lib_cxx_initialize.c: remove
    macho_call_saved_init_funcs special case; single unified loop

Testing:
  - macOS (Ventura VM): verified lief patching with standalone test
    (test_sinit7) confirming the constructor is deferred past main()
    and only invoked when explicitly called via the _sinit/_einit loop.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-05-19 07:08:55 -03:00
Liam Hickey
13ba91a33f arch/*/src/Makefile: Avoid uncessary relinking of the nuttx binary.
The goal is to only execute recipes when there is an actual change in
the prerequisites.

There are several issues which cause the nuttx binary target to be
re-made every time the top level make is run.

1. Previously the target nuttx$(EXEEXT), was used, but make resolved
this in the relative directory make -C $(ARCH_SRC), and couldn’t find
it (need an absolute path: `$(TOPDIR)/..).

2. The .tmp prerequisite for nuttx was always deleted

3. libboard's recipe had a sub-make which may or may not update that
target. This was a phony target, and was therefore always considered out
of date.

These issues were causing the nuttx recipe to be run every make, which
was hiding some missing prerequisites:

1. the .config is a prerequisite for the .tmp target
2. libapps.a (and other linklibs) are pre-requisites for nuttx

Changes:

The changes are only in the build system, and only for arm.

Track nuttx$(EXEEXT) via vpath so Make knows when it's already up to
date without an explicit path. Add $(TOPDIR)/.config as a dependency
to the linker script preprocessing so config changes trigger
re-preprocessing.

Keep the .tmp linker script on disk (clean already removes it) so
timestamp-based dependency checking works across builds. These .tmp
files need to be added to the gitignore or the CI will complain.

Use FORCE pattern for board/libboard to ensure it's always checked
but use the actual library file as the link dependency so nuttx is
only re-linked when library content changes. Add staging libs as
dependency to nuttx link rule so changed app libs trigger re-link.

Signed-off-by: Liam Hickey <williamhickey@geotab.com>
2026-05-18 09:33:58 +02:00
CuiJinji
1ae43935fd arch/sim: rename nuttx libc memchr to avoid host glibc collision
The sim/src/nuttx-names.in symbol-rename list is the mechanism that
keeps every nuttx libc function used inside nuttx.rel from clashing
with the same-named function in host glibc when the sim executable
is finally linked.  The list already covers ~200 symbols (memcpy,
strlen, strcat, strchr, ...) but memchr was missing.

On x86_64 Linux hosts the omission has no visible effect because
host glibc dispatches memchr through an IFUNC resolver
(__memchr_ifunc) that the static libc.a path does not eagerly pull
in for typical sim links.  On HOST_ARM64 (Ubuntu 20.04 aarch64,
glibc 2.31 .. 2.41), however, the final cc/ld invocation in the
sim Makefile drags libc.a(memchr.o) into the link, which then
collides with nuttx libc's lib_memchr.o that has already been
folded into nuttx.rel:

    /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/libc.a(memchr.o):
        in function `__memchr_ifunc':
        (.text+0x0): multiple definition of `memchr';
        nuttx.rel:libs/libc/string/lib_memchr.c:55: first defined here

Add memchr to the rename list (placed in alphabetical position
between malloc_usable_size and memcpy).  After this fix sim:nsh
builds cleanly on aarch64 Linux hosts (verified on NVIDIA Jetson
Orin L4T Ubuntu 20.04 + Raspberry Pi 4B Debian 13 trixie).  The
behaviour on x86_64 / macOS / Cygwin hosts is unchanged because
those targets either never hit the collision or use the
underscore-prefixed variant gated by NXSYMBOLS macro definition
in the same file (lines 26-31).

Signed-off-by: Jinji Cui <113000688+cjj66619@users.noreply.github.com>
2026-05-18 13:12:48 +08:00
bijunda
d701340cb6 fix(sim): fix cmake build on macOS
macOS /usr/bin/ar does not understand the @rsp syntax used in CMake.
Using LLVM binutils instead.

Signed-off-by: bijunda <bijunda@bytedance.com>
2026-05-13 10:01:26 -03:00
Peter Bee
2a353fcc0c sim: adapt macos avfoundation backend for camera indexing and capture
Adapt the macOS AVFoundation backend for multi-device discovery,
camera index mapping and capture startup compatibility. This enables
reliable use of multiple cameras through the SIM camera framework.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
Peter Bee
ea05918799 sim: support camera framework multi-instance and dynamic mounting
Allow the SIM camera/V4L2 capture framework to manage multiple
imgdata instances with dynamic mounting. This avoids cross-talk
between camera streams when multiple devices are used.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
Lingao Meng
e7fd9b1d49 arch/sim: add host_set_timeratio stub for Windows
The simulated time ratio feature introduced a host_set_timeratio()
call in sim_head.c, but the Windows host time implementation was
missing this symbol, causing a link error. Add a no-op stub since
the time ratio feature is not implemented on Windows.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-04-27 15:04:33 +08:00
Lingao Meng
62629d5efe arch/sim: fix host_settimer clock mismatch on macOS
dispatch_walltime() expects a delta in nanoseconds from now, but the
previous code subtracted CLOCK_REALTIME from a CLOCK_MONOTONIC absolute
timestamp, which have different epochs and produce a meaningless result.

Fix by subtracting the current CLOCK_MONOTONIC absolute time to get the
correct remaining duration.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-04-25 15:53:42 +08:00
Lingao Meng
dfd735045c arch/sim: add simulated time ratio support
Add CONFIG_SIM_WALLTIME_RATIO Kconfig option and --sim-rt-ratio=
command-line argument to control the ratio of simulated time to
real time in percent. 100 means real-time (default), 200 means
simulated time advances twice as fast, 50 means half speed.

The implementation applies the ratio in host_gettime(), host_sleepuntil()
and host_settimer() so both SIM_WALLTIME_SLEEP and SIM_WALLTIME_SIGNAL
modes are supported.

This is inspired by the --rt-ratio feature in Zephyr's native_sim board.

Tested on sim:nsh with the following sleep test:

  $ echo -e "sleep 2\nexit" | time ./nuttx
  real    0m2.0xxs

  $ echo -e "sleep 2\nexit" | time ./nuttx --sim-rt-ratio=200
  real    0m1.0xxs

  $ echo -e "sleep 2\nexit" | time ./nuttx --sim-rt-ratio=50
  real    0m4.0xxs

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-04-25 15:53:42 +08:00
bijunda
e874561291 sim: replace posix timer with GCD dispatch timer on macOS
macOS does not provide full POSIX timer support for the host-side
simulator build, so references to timer_t and timer_create can fail when
building sim:fb on Apple hosts. Replace the POSIX timer path with a
Grand Central Dispatch timer on macOS while keeping the existing POSIX
implementation for other hosts.

The dispatch timer raises SIGALRM from its event handler so the host
side keeps the same timer-driven behavior expected by the simulator.
This preserves the existing timing model and fixes the macOS host build
failure for sim:fb.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-04-14 19:40:10 +08:00
bijunda
333815c594 build(sim): fix macOS XQuartz include and library paths for sim:fb
macOS does not ship X11 headers and libraries in the default system
search paths, so sim:fb fails to build unless the XQuartz installation
prefix is detected explicitly. Probe /opt/X11 first and fall back to
/usr/X11 so the simulator can find the required X11 headers and libs on
common macOS setups.

This fixes the sim:fb build failure on macOS hosts that rely on XQuartz
for X11 development files.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-04-14 19:40:10 +08:00
Piyush Patle
13d0e64ee6 style: fix checkpatch issues after debug.h move
Fixed copespell errors, for CI sucess!

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
Piyush Patle
0dccc8ba21 include/debug.h: Move to include/nuttx/debug.h
debug.h is a NuttX-specific, non-POSIX header. Placing it in the
top-level include/ directory creates naming conflicts with external
projects that define their own debug.h.
This commit moves the canonical header to include/nuttx/debug.h,
following the NuttX convention for non-POSIX/non-standard headers,
and updates all in-tree references.

A backward-compatibility shim is left at include/debug.h that
emits a deprecation #warning and re-includes <nuttx/debug.h>,
allowing out-of-tree code to continue building while migrating.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
Huang Qi
e3eeaefd6d style: Fix "the the" typo across the codebase.
Fix 269 occurrences of duplicate "the" word typo found in 209 files
across source code, header files, and configuration.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2026-03-23 11:07:49 +01:00
Aditya Yadav
574fc64ab9 sim: Fix linker support and macOS host build issues
Update SIM configuration and CMake toolchain to resolve
linker errors when building on macOS. Adjust POSIX host
implementation to ensure successful compilation and
proper behavior of the sim target.

Modified:
- arch/sim/Kconfig
- arch/sim/src/cmake/Toolchain.cmake
- arch/sim/src/sim/posix/sim_hostmisc.c

Signed-off-by: Aditya Yadav <166515021+aditya0yadav@users.noreply.github.com>
2026-03-05 21:52:58 +08:00
zhenwei fang
f0fc695a81 arch/sim: fix warning ‘sim_buttonmap’ defined but not used
N/A

Signed-off-by: zhenwei fang <fangzhenwei@bytedance.com>
Signed-off-by: chao an <anchao.archer@bytedance.com>
2026-02-27 19:54:46 +08:00
xingrentai.1
bf83ff3fbd arch/sim: guard X11 touchscreen events with CONFIG_SIM_TOUCHSCREEN
The X11 event loop in the POSIX simulator was processing MotionNotify
(touch/mouse movement)and ButtonPress/ButtonRelease events unconditionally,
even when the touchscreen feature(CONFIG_SIM_TOUCHSCREEN) was disabled.

This could lead to unnecessary event processing, potential compiler warnings
about unusedfunctions (e.g., sim_buttonevent), or unintended behavior in simulator
builds withouttouchscreen support. The touchscreen-related event handling should
only be active whenthe corresponding configuration is enabled.

This fix wraps the MotionNotify and ButtonPress/ButtonRelease event handling
logicwith #ifdef CONFIG_SIM_TOUCHSCREEN guards to:

1. Ensure touchscreen/mouse event processing is only compiled when CONFIG_SIM_TOUCHSCREEN is enabled.
2. Eliminate unused code warnings in non-touchscreen simulator builds.
3. Align event loop behavior with the configured feature set, reducing unnecessary runtime overhead.

The change maintains full touchscreen functionality when the config is enabled, whilecleaning up the
code path for builds that don't require touchscreen support.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2026-02-27 19:54:46 +08:00
xingrentai.1
ee3e931812 arch/sim: fix X11 framebuffer window not visible in POSIX simulator
The X11 framebuffer implementation in the POSIX simulator was creating a window
and graphics context but failing to map (display) the window to thescreen with XMapWindow().

This omission meant the framebuffer window would be created in the X11server but remain hidden,
making it impossible to see any graphics outputfrom the simulator. The window existed in the X11
server's state but wasnot rendered to the screen.

This fix adds the missing XMapWindow(display, g_window) call aftercreating the graphics context, which:
1. Maps the created X11 window to the screen (makes it visible).
2. Ensures framebuffer output is rendered to the display as expected.
3. Maintains compatibility with existing X11 framebuffer logic.

The change restores basic visibility of the simulator's framebuffer window,
fixing a critical usability issue for graphics-related testing in the POSIX simulator.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2026-02-27 19:54:46 +08:00
fangzhenwei
e4ed6156ca arch/sim: fix incomplete HCI socket data reading in simulator interrupt handler
The sim_bthcisock_interrupt() handler for Bluetooth HCI sockets in the simulatorwas using
an if statement to check for available data on the HCI socket. Thismeant that only a single
packet would be read and processed per interrupt trigger,even if multiple packets were waiting
in the socket buffer.

This led to incomplete data processing: unread packets would remain in the bufferuntil the next
interrupt tick, causing delayed handling of Bluetooth HCI events/commands,packet backlogs,
or missed data in high-throughput scenarios.

This fix replaces the if with a while loop to:

1. Continuously check for and read available data from the HCI socket until no more
   packets are present in the buffer.
2. Ensure all pending HCI packets are processed in a single interrupt handler invocation.
3. Eliminate packet backlogs and reduce latency in Bluetooth HCI communication.

The change maintains the same core data reception logic (bthcisock_receive()) butensures it runs
for all available packets, improving the reliability and responsivenessof the simulator's Bluetooth HCI socket implementation.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2026-02-26 08:15:28 -03:00
SPRESENSE
72b67832ea Makefile: Remove make depend files by make distclean
Intermediate files of make depend like .ddc and .dds may remain
when make is interrupted. Remove them using make distclean.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2026-02-16 16:27:57 +01:00
yaojingwei
c5549143ad sim_camera: support enum pixel format.
Expose enum pixel format support in sim_camera.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2026-02-09 20:56:46 -03:00
wangmingrong1
28026af824 arch/sim: Add sigdelset to nuttx-names.in
sigdelset is used in up_enable_irq: sigdelset(&act.sa_mask, SIGSTOP);

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-01-31 14:14:32 +08:00
ganjing
206aaa8612 arch/sim: improve heap management on Simulator
and proper accounting of heap metadata

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-01-27 21:27:53 +08:00
ganjing
e941b18e29 mm/umm: Allow customizing the implementation of umm heap
and migrate arch/sim from the customized mm_heap to
umm_heap, so the default mm_heap implementation can
still be used(e.g. shared memory in OpenAMP).

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-01-27 21:27:53 +08:00
xuxin19
80505da579 cmake(bugfix):remove unused libmad link in SIM build
libmad has been ported into apps
and does not require linking to the host.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-27 20:54:26 +08:00
hujun5
a3273e6a96 arch: Add stack alignment and stack size checking when CONFIG_TLS_ALIGNED=y
Add validation to ensure allocated stack size does not exceed TLS_MAXSTACK when
CONFIG_TLS_ALIGNED is enabled, and verify proper stack alignment using STACK_ALIGN_MASK
across all architectures. This improves stack safety and prevents potential TLS overflow conditions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 22:18:11 +08:00
hujun5
6f03601169 arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures
Rename STACK_ALIGNMENT macro to STACKFRAME_ALIGN throughout the codebase
to provide clearer naming semantics. The new name better reflects the macro's
purpose of frame alignment rather than general stack alignment.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:37:24 +08:00
hujun5
e604bacd42 sim: it is not necessary to call restore_critical_section in irq
Remove restore_critical_section() call from up_switch_context() in simulator
as it is not necessary during interrupt context switching. The critical
section state is properly managed elsewhere in the interrupt handling flow.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 12:22:18 -03:00
hujun5
63e59e26c0 arch: move some macros to public code.
Move stack alignment and kernel stack macros from architecture-specific internal
headers to public include/nuttx/irq.h. Consolidates duplicate definitions across
17 architecture families, reducing code duplication while enabling common code
to access these core alignment utilities without architecture dependencies.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 01:53:08 +08:00
zhangshuai39
1c2d1c579f simwifi: Fix compilation warning
Added the `<nuttx/kmalloc.h>` header file and fixed the implicit conversion issue.

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2026-01-19 12:14:18 -03:00
xuxin19
a7c6f589f9 cmake(bugfix):fix sim loadable elf build support
1.add sanity check for START_OBJS
2.make laodable -e entry setting in each arch elf.cmake
3.add sim elf.cmake

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
hujun5
8bb250a4c0 arch: move STACK_ALIGNMENT to irq.h
Move STACK_ALIGNMENT macro definitions from architecture-specific internal
headers to public irq.h headers. This enables common code to directly access
STACK_ALIGNMENT without requiring internal header inclusion, improving code
organization and reducing header dependencies. Applies to all architectures:
ARM, ARM64, AVR, HC, MIPS, or1k, Renesas, RISC-V, SIM, SPARC, TriCore, x86,
x86_64, Xtensa, Z16, and Z80.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-19 14:43:43 +08:00
Bowen Wang
e686a3ac42 mm/mm_heap: use struct mm_heap_config_s to init the memory heap
To avoid add new parameters to the mm_initialize_heap() and
mm_initialize_pool()

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
anjiahao
6ed4ea63d8 mm: support mm_initialize_heap to specify a specific heap pointer
Support user pass it own heap struct to the mm_initialize_heap() to
avoid the heap struct is reserved from the heap range

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
0bc9f94304 sim/sim_rptun: modify sim_rptun to port new rptun framework
1. Use reserved[0] filed in struct fw_rsc_vdev and the driver
master/slave to judge the device role;
2. Use struct fw_rsc_carveout in resource table to provide the
share memory to virtio driver side;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
47b6c1f2a9 sim/sim_rptun: use host_kill() to kill proxy core when stop proxy
To avoid hang in the host_waitpid() in sim_rptun_stop()

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang
906299df21 sim/posix: add host_kill API to kill other thread
sim rptun need use this api to kill the proxy core

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
Yongrong Wang
911ab7c55b drivers/rptun and rpmsg_virtio: remove cmd initialize
don't need initialize in sim

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2026-01-19 14:18:27 +08:00
wangchengdong
2a0990bd31 arch/sim: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
ligd
113bb02568 checkstack: fix access overflow when checkstack
We should check length first, and then check the value

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-01-17 18:04:28 -03:00
guanyi3
f99dd20c4e sim/usrsock: move g_work_queue init before net_initialize
usrsock register work in net_initialize before g_work_queue is created, so move g_work_queue in irq_initialize.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-01-16 09:39:02 +08:00