Commit Graph

1189 Commits

Author SHA1 Message Date
chenxiaoyi fd34be15eb sim: use correct size to avoid buffer overflow
Fix buffer overflow issue from PR #10128, since the sizeof
xcpt_reg_t is different on 32/64 bit platform.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2023-08-11 20:13:28 +08:00
chenxiaoyi 6d6e1aea3b sim: Fix sim stack smashing problem
The reason is that the new created task receives signal while
it has not entered its stack frame.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2023-08-10 23:30:22 +08:00
ligd 324aa7d17f sim: rptun support panic & reset
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-10 23:13:40 +08:00
wangbowen6 cbb594dcbc sim: add set/get_power for sim_framebuffer.c
add set/get_power operation for sim_framebuffer to avoid assert
in fb_ioctl(cmd= FBIOSET_POWER/FBIOGET_POWER)

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-08-10 15:57:57 +08:00
cuiziwei c1ddfcfa83 nuttx/arch:support to obtain host cpuinfo in NSH. 2023-08-05 14:57:15 -07:00
yangsen5 d8ca744052 drivers/video: video driver supports NV12
Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2023-08-03 22:37:53 -07:00
yintao 5d1536c5e3 nuttx/sim: use workquene instead of sim_bthcisock_loop
Signed-off-by: yintao <yintao@xiaomi.com>
2023-08-03 21:15:36 -07:00
jianglianfang d5a8746be8 sim framebuffer: Optimize the timing of window to open and to close
The window opens when the fb opens and closes when the fb closes.
test step: run fb demo, 1. ./nuttx 2. fb

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-08-03 10:36:17 -07:00
ligd ebaea6bd9f sim: set loop thread priority to configurable
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 10:15:43 -07:00
yuexinyi 4f0a8dc391 drivers/video: fix if video node do not exist on host of sim env, video driver init fail
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2023-08-02 22:50:03 -07:00
shipei 238eba14ad alsa/sim_alsa.c:fix ioctl AUDIOIOC_GETBUFFERINFO error
when executing ioctl AUDIOIOC_GETBUFFERINFO,the priv->pcm is still NULL,
so it will return -ENXIO,we can remove this check at the start of ioctl
and add in the case where it is used.

Signed-off-by: shipei <shipei@xiaomi.com>
2023-08-02 03:27:12 -07:00
zhangyuan21 8f39ba6ae4 arch: update g_running_tasks when context switch occurred
When supporting high-priority interrupts, updating the
g_running_tasks within a high-priority interrupt may be
cause problems. The g_running_tasks should only be updated
when it is determined that a task context switch has occurred.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-01 09:35:18 -07:00
yuexinyi 56be0ab050 drivers/video: add capture arg to support multi instance
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2023-07-29 07:42:29 -07:00
dongjiuzhu1 d89e0996f5 sim/usbdev: Add string table as it is needed when USBTRACE is turned on
nuttx/drivers/usbdev/usbdev_trprintf.c:418: undefined reference to `g_usb_trace_strings_intdecode'
/usr/bin/ld: nuttx/drivers/usbdev/usbdev_trprintf.c:496: undefined reference to `g_usb_trace_strings_deverror'

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 20:58:23 -07:00
dongjiuzhu1 ddc2c62aa8 sim/rawgadget: don't push fifo if ioctl failed because it will cause busy read
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 20:58:23 -07:00
dongjiuzhu1 7d281f46de sim/hostfs: fix issue about access file with size more than 2GB
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 07:42:12 -07:00
anjiahao 2645e59901 sim/tcbinfo:add ebp to tcbinfo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-26 06:57:25 -07:00
guoshichao 3524f4b9ce libs/libc/fork: add lib_fork implementation
1. add lib_fork api in libs/libc, we need a fork() api to implement the
fork relative method, such as pthread_atfork
2. rename the assembly fork entry function name to up_fork(), and rename
the up_fork() to arch specific name, such as
sim_fork()/arm_fork()/mips_fork() etc.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 10:41:52 +02:00
Xiang Xiao 46b25b3849 arch: Compute the array size by nitems
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-26 09:33:38 +02:00
Xiang Xiao f3269a6caa sched: Rename DEBUG_TCBINFO to ARCH_HAVE_TCBINFO
and select if the arch support to define g_tcbinfo variable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-26 09:33:38 +02:00
chao an 49dec5b48c cmake/build: fix build break on cmake
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-25 15:00:10 +02:00
anjiahao eadfdab9a7 sim:add sim32 & sim64 tcbinfo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-23 21:59:35 -07:00
anjiahao 9f644579b3 fix sim register & tcb info typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-23 21:59:35 -07:00
yintao 0b01340aec nuttx/sim: use workquene instead rptun_loop
Signed-off-by: yintao <yintao@xiaomi.com>
2023-07-21 20:46:59 +08:00
Xiang Xiao a51be33a41 libc/tls: Change the default value of TLS_NELEM to zero
to ensure the default config as small as possible.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-20 08:11:30 +02:00
Xiang Xiao 4d8eedb09a arch/sim: Link to libgcov.a when CONFIG_ARCH_COVERAGE is enabled
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
chao an f10b54a081 cmake: fix CMake build break
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
raiden00pl ad6361f0cc cmake: fix build after c33d1c9c97 (vfork -> fork) 2023-07-12 09:47:54 -03:00
guoshichao c33d1c9c97 sched/task/fork: add fork implementation
1. as we can use fork to implement vfork, so we rename the vfork to
fork, and use the fork method as the base to implement vfork method
2. create the vfork function as a libc function based on fork
function

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-12 02:27:37 +08:00
Xiang Xiao 813b652ba5 elf: Move 32/64bit generic mapping from risc-v/arch_elf.c to elfxx.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-10 13:09:47 -03:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Petro Karashchenko 85a46bf599 arch/sim: unify usage for SYMBOL macro
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
Petro Karashchenko f7dfe8326f arch/sim: fix function prototype compilation warning
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
qiaohaijiao1 a5d1d2d4e5 audio: add AUDIOIOC_FLUSH ioctl
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2023-07-07 23:06:11 +08:00
Xiang Xiao 6b11672310 arch/sim: Remove the unused sim_camera_uninitialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-04 20:15:30 +09:00
Xiang Xiao af50cdd21b arch/sim: Rename sim_video to sim_camera
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-04 20:15:30 +09:00
libei1 63774125d9 arch/sim : Audio driver add AUDIOIOC_GETLATENCY ioctl
add AUDIOIOC_GETLATENCY definition, and add reference code in sim alsa.

Signed-off-by: libei1 <libei1@xiaomi.com>
2023-07-04 13:48:58 +08:00
liuwei35 63ac8fbdfd sim/audio register mixer device
add amixer register code

Signed-off-by: liuwei35 <liuwei35@xiaomi.com>
2023-07-03 10:18:37 -03:00
qiaohaijiao1 de5c35382a sim/sim_alsa.c: add paused variable instead of snd_pcm_pause.
snd_pcm_hw_params_can_pause return false on sim.
add paused variable to support pause.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2023-07-03 13:51:09 +08:00
Xiang Xiao ddbe9eb6ab mm: Rename mm_memdump_s to malltask
align with the naming of mallinfo_task

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 09:12:14 +03:00
Zhe Weng f2690837e7 arch/sim: Support more sockopts on native socket
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-06-14 15:50:31 +03:00
zhanghongyu 272e62018a sim/posix/sim_hostusrsock: process host network syscall with critical section
if config_walltime_signal is enabled, NuttX_sim will receive a lot of
signals, the socket api will break and errno will be EINTR, masking irq
before calling the host socket api will avoid this problem.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-06-13 22:10:16 +08:00
Xiang Xiao d920bfba10 mm: include malloc.h in mm/mm.h
to remove the forward declaration of mallinfo and mallinfo_task

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-11 19:37:04 +03:00
anjiahao 7732791cd6 mempool:Add mail_info support for multiple pools
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-08 23:56:40 +08:00
Xiang Xiao add569d0e5 arch/sim: Replace uart_[xmit|recv]chars_dma with uart_dma[txavail|rxfree]
to follow the original dma design

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-05 09:25:31 +02:00
hujun5 35b597ec2c arch/all: in smp pthread_cancel occasionally deadlock except for arm64
please reference the issue here for more information:
https://github.com/apache/nuttx/pull/9065

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-23 15:48:35 +09:00
simbit18 e4ffce3355 Fix Kconfig style
Remove spaces from Kconfig files
2023-05-23 00:03:25 +08:00
anjiahao c60dd72a2a Support memdump to realize incremental dump function
Add a new field to record the global on the basis of mm_backtrace.
When using alloc, the field is incremented by 1,
so that the memory usage can be dumped within the range
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-05-22 12:31:32 +08:00
Xiang Xiao 7990f90915 Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 09:52:08 -03:00
qiaohaijiao1 f67e50e920 sim/sim_alsa: modify buffer_size in GET_BUFFERINFO when offload capture.
1. when offload capture, apb buffer must big enough to fill
samples of encoder.
2. pass samplerate, channels to encoder.
2023-05-18 17:22:46 +08:00