Commit Graph

941 Commits

Author SHA1 Message Date
Xiang Xiao 9bc2b4c31b board/sim: Remove CCLINKFLAGS, use CFLAGS/CXXFLAGS instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-28 23:13:22 +08:00
Xiang Xiao 872c570343 arch: Align the implementation of stack related functions
arm: Avoid call k[u]mm_memalign to save the code size
ceva: Correct stack_base_ptr usage(top of stack v.s. bottom of stack)
mips: Correct the stack alignment in up_use_stack
misoc: Correct the stack alignment in up_use_stack
or1k: Correct the stack alignment in up_use_stack

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-28 15:05:41 +08:00
Xiang Xiao 3bf416e8b8 arch: Move STACK_ALIGNMENT definition to up_internal.h
to avoid the same macro duplicate to many place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-28 15:05:41 +08:00
Xiang Xiao f634ea24b5 arch/sim: Don't include execinfo.h since cygwin doesn't support it
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-26 07:05:42 -06:00
Jiuzhu Dong c5ba9261bc procfs: add memdump interface to dump used/free memory info
usage:echo <used/free> > /proc/memdump
echo used > /proc/memdump // output all used memory node info(address + size)
echo free > /proc/memdump // output all free memory node info(address + size)

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-02-26 14:32:42 +08:00
Huang Qi da25883c64 arch/sim: Fix usrsock build break on macOS
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-18 09:06:46 -03:00
chao.an 5da5ffb7d4 sim/usrsock: correct the xid type to uint64_t
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-18 08:16:17 +01:00
YAMAMOTO Takashi 85af0f37ad arch/sim/src/Makefile: Fix build issues with clang on linux
This commit fixes at least two issues.

* Fix a build with clang on linux

```
/usr/bin/ld: cannot open linker script file nuttx.ld: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

* Restore symbol renaming for clang on linux

I guess it actually depends on the linker.
For now, use CONFIG_HOST_MACOS.

This fixed the following crash seen with sim/linux built with clang.

```
    #135462 0x0000000000404a81 in nxtask_exithook (tcb=0x48f310 <g_idletcb>, status=1, nonblocking=0 '\000') at task/task_exithook.c:618
    #135463 0x0000000000402aed in exit (status=1) at task/exit.c:103
    #135464 0x0000000000475833 in host_abort (status=1) at sim/up_hostmisc.c:48
    #135465 0x000000000040e6c6 in up_assert (filename=0x47b167 "semaphore/sem_wait.c", lineno=113) at sim/up_assert.c:126
    #135466 0x000000000040850b in _assert (filename=0x47b167 "semaphore/sem_wait.c", linenum=113) at assert/lib_assert.c:36
    #135467 0x0000000000403a40 in nxsem_wait (sem=0x7fca38b1c2d0) at semaphore/sem_wait.c:113
    #135468 0x0000000000403b43 in sem_wait (sem=0x7fca38b1c2d0) at semaphore/sem_wait.c:271
    #135469 0x000000000040aad3 in lib_stream_semtake (list=0x7fca38b1c2d0) at stdio/lib_libstream.c:159
    #135470 0x000000000040a8e7 in lib_flushall (list=0x7fca38b1c2d0) at stdio/lib_libflushall.c:61
    #135471 0x0000000000404c3c in nxtask_flushstreams (tcb=0x48f310 <g_idletcb>) at task/task_exithook.c:520
    #135472 0x0000000000404a81 in nxtask_exithook (tcb=0x48f310 <g_idletcb>, status=1, nonblocking=0 '\000') at task/task_exithook.c:618
    #135473 0x0000000000402aed in exit (status=1) at task/exit.c:103
    #135474 0x0000000000475833 in host_abort (status=1) at sim/up_hostmisc.c:48
    #135475 0x000000000040e6c6 in up_assert (filename=0x47b167 "semaphore/sem_wait.c", lineno=113) at sim/up_assert.c:126
    #135476 0x000000000040850b in _assert (filename=0x47b167 "semaphore/sem_wait.c", linenum=113) at assert/lib_assert.c:36
    #135477 0x0000000000403a40 in nxsem_wait (sem=0x7fca38b1c2d0) at semaphore/sem_wait.c:113
    #135478 0x0000000000403b43 in sem_wait (sem=0x7fca38b1c2d0) at semaphore/sem_wait.c:271
    #135479 0x000000000040aad3 in lib_stream_semtake (list=0x7fca38b1c2d0) at stdio/lib_libstream.c:159
    #135480 0x000000000040a8e7 in lib_flushall (list=0x7fca38b1c2d0) at stdio/lib_libflushall.c:61
    #135481 0x0000000000404c3c in nxtask_flushstreams (tcb=0x48f310 <g_idletcb>) at task/task_exithook.c:520

```
2022-02-17 09:36:20 +08:00
YAMAMOTO Takashi 7fcfe40821 arch/sim/src/Makefile: Fix whitespace 2022-02-17 09:36:20 +08:00
Peter Kalbus 6abdf73535 sim: Initial support on MacOS M1 and Linux AARCH64 based hosts. 2022-02-17 09:35:09 +08:00
Alan Rosenthal 8defb843aa Remove duplicate linker script definitions
## Summary
A lot of linker scripts were listed twice, once for unix, once for windows.

This PR cleans up the logic so they're only listed once.

 ## Impact
Any opportunity to use a single source of truth and reduce lines of code is a win!

 ## Testing
CI will test all build
2022-02-17 02:55:25 +08:00
Xiang Xiao 6b02e32904 arch/sim: Remove 08 from the format string in up_vfork
to make the code more general for both x86 and x64.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-15 06:44:21 +01:00
Xiang Xiao e1879e35cd arch/sim: Always typedef xcpt_reg_t to unsigned long
to simplify the code logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-15 06:44:21 +01:00
Peter Kalbus 271518a5ff sim: detect clang native compiler on MacOS. 2022-02-11 21:23:07 +08:00
Alin Jerpelea 0cfdfde6c7 arch: sim: update licenses for FishSemi
FishSemi is part of Xiaomi and according to xiaoxiang781216
the SGA covers those files

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-02-09 19:58:52 +08:00
Alin Jerpelea e2725d536a arch: sim: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-02-09 19:58:52 +08:00
Xiang Xiao 963feca4a1 arch/sim: Don't add up_tls_size in up_use_stack before foward to up_create_stack
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 08:45:34 +01:00
Xiang Xiao 202b8141a6 arch/sim: Adjust the stack size for up_use_stack too
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 13:36:51 +08:00
Xiang Xiao 5749ea6604 arch/sim: Unify the return value of usrsock_xxx_handler
All handler should return the result of usrsock_send_[dack|event]

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 13:18:19 +08:00
Alexander Lunev b2f3cefe3d sim/netdev,tapdev: implemented emulation of TX done and RX ready interrupts
and removed two tcp_send_txnotify() calls from tcp_sendfile (they are not needed anymore).

As a result, the TX throughput of both the tcp_send_buffered and tcp_send_unbuffered
is significantly boosted in case of TUN/TAP network device.
2022-01-28 18:16:42 +08:00
Fotis Panagiotopoulos f8ba016d72 sim: Added Kconfig option for UART buffer size. 2022-01-27 17:15:17 +01:00
Alexander Lunev f73abc76d5 sim/netdev: retrieve all the queued RX frames from the network device on every poll.
As a result, the RX throughput is increased significantly w/o harming the TX throughput.
2022-01-22 15:34:58 +08:00
YAMAMOTO Takashi f356ff34a7 arch/sim/src/sim/up_macho_init.c: Fix an assertion
Handle the case of no constructors.
2022-01-21 11:01:53 +01:00
Xiang Xiao 77792a1598 sched: Define CONFIG_SMP_NCPUS to 1 in no SMP case
to simplify the SMP related code logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-20 23:21:21 +08:00
Xiang Xiao 67fc54dd3d boards/sim: Change CONFIG_LIBCXX to CONFIG_HAVE_CXXINITIALIZE
since the contructor is required with other libc++ implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-20 16:20:41 +08:00
Xiang Xiao af7fd718cc arch/sim: Don't add -lc++abi to STDLIBS
link libs/libxx/libcxxabi instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-20 16:20:41 +08:00
YAMAMOTO Takashi 10f7ad85e6 arch/sim/src/nuttx-names.in: Add mprotect and sysconf
For up_macho_init.c.
2022-01-20 15:09:17 +08:00
YAMAMOTO Takashi f0acf8e62a arch/sim/src/sim/up_macho_init.c: Add a workaround for Monterey 2022-01-20 15:09:17 +08:00
yinshengkai face0514b6 touchscreen: update sim_touchscreen, using touch_upperhalf
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-01-20 01:22:25 +08:00
YAMAMOTO Takashi a94c52b204 sim: Postpone constructor calls on macOS
For Linux, we rename the section so that they are not invoked.
However, it doesn't work for macOS.

Notes:

* Renaming the sections (as the Linux version does) doesn't work
  because the section is looked by its flags, not by its names.

* No convenient tools available to alter the relevant bit in
  the section flags.

* The constructors are invoked before the program entry point.
2022-01-20 01:16:56 +08:00
ligd 0a51f13ca5 rpmsg_rtc: merge the rpmsg_rtc_init to same place
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-18 22:48:15 +08:00
Petro Karashchenko 9551de7115 net: use HTONS, NTOHS, HTONL, NTOHL macro in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-18 10:59:47 +01:00
Petro Karashchenko 8d3bf05fd2 include: fix double include pre-processor guards
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-16 11:11:14 -03:00
Xiang Xiao 41b9cf3cd8 rtc/rpmsg: Add sync parameter to control whether call clock_synchronize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-16 11:58:13 +01:00
Xiang Xiao 93b0b9678f sim: Forward /dev/rtc0 operation to rpmsg rtc driver
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-16 11:58:13 +01:00
Alexander Lunev 019fc0ad78 sim/netdev: eliminated RX data stream congestion in case of high TX network traffic.
In case of high TX network traffic, netdriver_loop() that reads data from netdev
was invoked via up_idle() only after high TX network traffic had stopped.
That resulted in massive delay and drop of TCP ACK packets and
any other packets from netdev (tun/tap device).
2022-01-14 19:39:39 +08:00
Xiang Xiao bbf5511e3a arch/sim: Move the dummy ioe driver to drivers/ioexpender
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-09 11:06:06 +08:00
Xiang Xiao b054bd9d37 arch/sim: Move the dummy foc driver to drivers/motor/foc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-09 11:06:06 +08:00
Xiang Xiao 3156a96a1b arch/sim: Move qspiflash simulation to drivers/spi instead
since it's common implementation can be used in other arch too

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-07 23:50:11 +08:00
Xiang Xiao d296f9c085 arch/sim: Move spiflash simulation to drivers/spi instead
since it's common implementation can be used in other arch too

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-07 23:50:11 +08:00
Xiang Xiao 49c00e0361 arch/sim: Rename up_vfork[32|64].S to up_vfork_x86[_64].S
to follow other arch/x86 arch/x86_64 convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-07 15:59:34 +08:00
Xiang Xiao 1a02556265 Revert "arch/sim: Rename up_vfork[32|64].S to up_vfork_x[32|64].S"
This reverts commit 3982296294.
2022-01-07 15:59:34 +08:00
Xiang Xiao 3982296294 arch/sim: Rename up_vfork[32|64].S to up_vfork_x[32|64].S
to align with up_vfork_arm.S naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-06 09:42:44 +01:00
Zeng Zhaoxiu fb43fd73ed signal: signal handler may cause task's state error
For example, task is blocked by nxsem_wait(sem1), use nxsem_wait(sem2)
in signal handler, and take sem2 successfully, after exit from signal
handler to task, nxsem_wait(sem1) returns OK, but the correct result
should be -EINTR.

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
2022-01-05 21:36:44 +09:00
Xiang Xiao d2309195da boards/sim: Add vncserver config for test
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-03 11:19:32 +08:00
Xiang Xiao f302e8fd40 arch/sim: Implement up_backtrace
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 11:03:08 +08:00
Xiang Xiao f061766801 video/fb: Fix typo error in include/nuttx/video/fb.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-28 17:21:18 -03:00
chao.an a42aa8415d compile/flags: add FRAME_POINTER into Toolchain.defs
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-12-27 22:31:27 -06:00
Huang Qi 0751bcd4ca arch/sim: Support vncserver as display device
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-24 11:59:43 -06:00
Xiang Xiao b03886415f sim/netdev: Update IFF_RUNNING flag by netdev_carrier_on and netdev_carrier_off
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-22 07:15:00 -03:00