Commit graph

1463 commits

Author SHA1 Message Date
7335b36eca walnux: moveout
Some checks failed
Build Documentation / build-html (push) Has been cancelled
Docker-Linux / push (push) Has been cancelled
2025-11-04 19:15:10 +02:00
raiden00pl
628c05acf3 arch/sim/sim_canchar.c: fix CAN flags decoding for message
fix CAN flags decoding for SIM CAN

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-09-27 21:41:55 +08:00
wangchengdong
21e1596dff arch: fix alignment bug for archs that need stack alignment
These archs only align the size of the stack, forgeting to do the
 stack start addr alignment, this patch fixes it.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:40:58 +08:00
guanyi
ac5b38c9e5 arch/sim: avoid host-call being interrupted before getting errno
Sim use coroutine base on one thread in host to do switch context. but if we allow switch context with in one API (host-API and errno get), maybe the switch context from coroutine cause re-enter host-API call. Make the errno get behavior not work as expected.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2025-07-21 19:19:05 -03:00
raiden00pl
194b635739 arch: unify Private Types banners
unify Private Types banners according to NuttX coding standard

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-28 10:17:15 +08:00
wangzhi16
35a62b7d5e Revert "Reduce the size of tcb by four bytes."
This reverts commit 893c5e92c2.
2025-05-27 16:30:35 +08:00
p-szafonimateusz
7cb09d96e3 arch/sim/sim_canchar.c: fix compilation when CAN FD is disabled
Fix case for CAN character driver in simulator when CANFD is disabled
and ch_edl field is not present in CAN header.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-24 21:28:51 +08:00
Lars Kruse
3dc53adb28 arch | boards | drivers: fix whitespace issues for switch case statements 2025-05-23 10:48:41 +08:00
Lars Kruse
3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
p-szafonimateusz
cc5d6fcb41 arch/sim/Kconfig: fix codespell issues
arch/sim/Kconfig: fix codespell issues

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-14 21:50:15 +08:00
p-szafonimateusz
df76246c03 arch/sim/Kconfig: simulated CAN depends on LINUX host
simulated CAN depends on LINUX host now

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-14 21:50:15 +08:00
p-szafonimateusz
5bf3110777 arch/sim/sim_canchar.c: notify upper-half driver that tx done
add missing can_txdone() callback after message is send

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-14 03:05:56 +08:00
Jukka Laitinen
e78a33464e arch/sim/src/sim/sim_oneshot.c: Fix spelling in comments, "Ths" -> "This"
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-13 21:05:12 +08:00
Jukka Laitinen
bf870e51ba arch/sim/sim_oneshot: Calculate next oneshot time in ticks instead of timespec
This removes drift in tick start times, when the base time is always rounded to
tick boundary.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-05-13 21:05:12 +08:00
p-szafonimateusz
76e1b80076 arch/sim: add CAN support based on host SocketCAN
Add CAN support for sim target based on host SocketCAN interface.

Tested with virtual CAN on Linux but should work also with hardware CAN cards supported by host.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-03 11:26:08 +08:00
chao an
52482219c8 libc/elf: rename modlib to libelf
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.

CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-04-11 09:43:22 +08:00
zhangshoukui
69597ec486 arch/sim: Add i2s setup and shutdown interface
This interface is required if you want to open an i2c node directly on the sim
12b4340b00

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2025-04-10 18:10:54 +08:00
Xiang Xiao
8fd8af9edc Revert "Use small lock to protect usbdev and endpoint in sim."
This reverts commit 4558db18e4.
2025-02-13 14:15:43 +08:00
Xiang Xiao
0021e7731a Revert "Because sched_lock is now called in spin_lock_irqsave, there is no need to call it explicitly."
This reverts commit b0af946b7a.
2025-02-13 14:15:43 +08:00
Huang Qi
a2e8bb83a4 sim: Align LLVM target info across CMake and Makefile
Summary:
- Unified the specification of LLVM architecture and ABI types across the CMake and Makefile configurations.
- Introduced `LLVM_ARCHTYPE` and `LLVM_CPUTYPE` variables in the CMake configuration to match the Makefile's approach.
- Standardized the ABI type (`LLVM_ABITYPE`) to `sysv` for both Linux and macOS host configurations.

Impact:
- Ensures consistent LLVM target definitions across build systems (CMake and Makefile).
- Simplifies future maintenance by avoiding divergence in LLVM-related configurations.
- No functional changes to the build output; only the internal representation of LLVM target information is aligned.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-28 16:43:37 +08:00
wangzhi16
b0af946b7a Because sched_lock is now called in spin_lock_irqsave, there is no need to call it explicitly.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-23 20:43:51 +08:00
chao an
801cd455ef sim/posix/uart: add host_printf() to debug some critical issue
Sometimes we need to bypass the system to debug some issue in critical sections

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-23 16:14:36 +08:00
chao an
cefb6cbd00 sim/rpmsg_uart: add sim rpmsg uart support
add sim_rpmsg_port_uart.c to verify the rpmsg port uart wrapper layer,

The physical transport layer could be:
1. SIM_RAM_UART(current)
2. SIM_UART(through "socat" virtual "/dev/pts/*", "socat" could monitor the bus data)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-23 10:41:38 +08:00
chao an
9db4d327fa sim/virtio: fix typo sim_rpmsg_vritio.c -> sim_rpmsg_virtio.c
Build Error:
CMake Error at arch/sim/src/sim/CMakeLists.txt:278 (target_sources):
  Cannot find source file:

    /home/archer/code/nuttx/n3/nuttx/arch/sim/src/sim/sim_rpmsg_vritio.c

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 15:28:13 +08:00
chenrun1
118f827103 sim_hostfs:add host_errno_convert API for convert result
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2025-01-15 23:33:53 +08:00
wangzhi16
4558db18e4 Use small lock to protect usbdev and endpoint in sim.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-15 17:04:58 +08:00
wangmingrong1
df7d062713 kasan/kconfig: Add config CONFIG_MM_KASAN_INSTRUMENT
It will be used to distinguish between hardware KASan and software KASan. Hardware KASan does not need to use plug-in

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-14 14:01:48 +08:00
Leo Chung
63c8de5f03 sim: Fixes the linker 'noexecstack' warning
Signed-off-by: Leo Chung <gewalalb@gmail.com>
2025-01-12 16:17:52 +08:00
Huang Qi
cfd0cc0d1a Remove duplicate includes across multiple files
This commit cleans up redundant header file includes throughout the codebase.
 The changes include:

 - Removing duplicate #include directives that were present in the same file
 - Consolidating includes that were split across multiple lines unnecessarily
 - Removing unused includes that were no longer needed
 - Fixing some formatting issues with includes

 The changes improve code organization and maintainability by:
 - Reducing unnecessary dependencies
 - Making include dependencies more explicit
 - Following consistent include patterns
 - Removing dead code

 No functional changes are made - this is purely a code cleanup commit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-09 23:30:23 +08:00
YAMAMOTO Takashi
e5ac1c620e sim: Disable chained fixups for sim_macho_init.c
This is a workaround for https://github.com/apache/nuttx/issues/15208

Tested with:
    macOS 15.2
    x86-64
    Xcode 16.2
2025-01-07 23:28:30 +08:00
buxiasen
89455bc9a1 arch: up_getusrsp change to inline and implement in irq.h
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
buxiasen
9bdcc4dc4b arch/irq.h: update all inline to inline_function
Inline & inline_function both used make confuze, let's modify all inline
in irq.h to inline_function, also clear the always_inline_funcion
declaration.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-06 23:03:05 +08:00
Ritvik
3e6649856b Fix Overlap Handling in sim_copyfullstate to Prevent Undefined Behavior 2025-01-06 08:19:04 +08:00
cuiziwei
781c27a98e sim/oneshot: Remove redundant variables.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2025-01-03 21:12:41 +08:00
wangzhi16
893c5e92c2 Reduce the size of tcb by four bytes.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-02 23:18:42 +08:00
Bowen Wang
6485093277 rpproxy_virtio/rpserver_virtio: fix the compile error
1. Change the CONFIG_RPMSG_VIRTIO to CONFIG_RPMSG_VIRTIO_LITE
2. fix the error when modify the sim_rpmsg_virtio to port to
rpsmg_virtio_lite;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-12-31 18:01:47 +08:00
Bowen Wang
f0a3c43a54 rpmsg/rpmsg_virtio_lite: rename rpmsg_virtio to rpmsg_virtio_lite
Because rpmsg_virtio_lite is a better name to inform user that the
rpmsg virtio (original name) is a lite implementation of rpmsg virtio.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-12-28 22:43:20 -03:00
yangsen5
15c1c9d42e sim_alsa: set paused to false when executing close
Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2024-12-26 23:31:55 +08:00
yangsen5
94c0f71db9 v4l2m2m: modify return value of g_bufsize to uint32_t
CID 1578530: (#1 of 1): INTEGER_OVERFLOW

Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2024-12-25 17:06:48 +08:00
yaojingwei
bbd6931d61 nuttx/audio: add fake audio driver.
The fake audio driver aims to easily simulate the functions of audio driver through reading and writing files.
With it, you can conveniently customize and define various capture or playback audio drivers for debugging or automated testing.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-12-20 11:47:08 -03:00
YAMAMOTO Takashi
b4e5c74319 arch/sim/src/nuttx-names.in: Add pipe2
This breaks the libuv build without CONFIG_PIPES
as expected:

```
LD:  nuttx
/usr/bin/ld: nuttx.rel: in function `uv_pipe':
/src/apps/system/libuv/libuv/src/unix/pipe.c:516: undefined reference to `NXpipe2'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:427: nuttx] Error 1
make: *** [tools/Unix.mk:551: nuttx] Error 2
```

That is, this correctly exposes https://github.com/apache/nuttx/issues/14773
on linux.
2024-12-19 14:46:59 +08:00
xuxin19
f2b4ab283f cmake(bugfix):fix CMake build break on MacOS
report by https://github.com/apache/nuttx/issues/14936

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-12-05 23:36:16 +08:00
Xiang Xiao
60fb917eda Remove FAR from 32/64bit arch
since these arch doesn't distinguish between near and far pointers

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-12-05 22:55:39 +08:00
hujun5
dabf589940 remove redundant judgments *running_task != NULL
reason:
In irq, g_running_tasks is always valid.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 22:50:08 +08:00
zhangyuan29
dcea1b90e7 arch_atomic: only support atomic_xx and atomic64_xx function
Modify the kernel to use only atomic_xx and atomic64_xx interfaces,
avoiding the use of sizeof or typeof to determine the type of
atomic operations, thereby simplifying the kernel's atomic
interface operations.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-04 14:03:14 +01:00
Alin Jerpelea
eea3d77a6e arch/sim: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-02 17:23:25 +08:00
cuiziwei
8e58245524 sim: Fix sim m32 start up crash issue.
After compilation, when starting nsh, the following crash occurs.
==2500151==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==2500151==ASan shadow was supposed to be located in the [0x1ffff000-0x3fffffff] range.
==2500151==Process memory map follows:
0x30000000-0x33dd4000 /nuttx/nuttx

To avoid overlaps, change the starting address of the text segment.

Using Ttext-segment=0x30000000 causes a crash when starting the 32-bit SIM.
Using -Ttext-segment=0x50000000 causes a crash when starting the 64-bit SIM.
Setting -Ttext-segment=0x40000000 resolves all issues perfectly.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-11-23 01:47:34 +08:00
yinshengkai
0194c2f88a gcov: update gcov compilation parameters
profile-generate is used to generate compilation feedback optimization data, not just code coverage data

It will rely on the toolchain library:
nuttx/libs/libc/misc/lib_utsname.c:94:(.text.uname+0x2c): undefined reference to `__gcov_indirect_call_profiler_v4'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x178): undefined reference to `__gcov_indirect_call'
arm-none-eabi-ld: nuttx/libs/libc/misc/lib_utsname.c:113:(.text.uname+0x188): undefined reference to `__gcov_time_profiler_counter'
arm-none-eabi-ld: nuttx/staging/libc.a(lib_utsname.o):(.data..LPBX0+0x30): undefined reference to `__gcov_merge_time_profile'

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-22 19:08:08 +08:00
cuiziwei
f0e03f6c3c Unify the linking options for 32-bit and 64-bit to text-segment=0x30000000.
In order to be compatible with 32-bit and 64-bit compilation, set the text-segment to 0x30000000.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-11-21 16:13:52 +08:00
cuiziwei
feb38c43f2 sim/m64: Fix ld error.
/usr/bin/ld: nuttx.rel: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-11-21 12:13:14 +08:00