Commit Graph

762 Commits

Author SHA1 Message Date
Matias N
f3712d2b8c sim: add support for simulated button device via mouse click 2020-11-30 03:35:37 -06:00
Matias N
010ac2bcf4 sim: correctly handle X11 button state/events 2020-11-30 03:35:37 -06:00
Masayuki Ishikawa
3ec743f72f arch: sim: Fix comments in up_setjmp64.S and up_smpsignal.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-11-28 09:01:08 -06:00
chao.an
c56785bd0d style/Makefile: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:30 +01:00
Matias N
d5b6ec450f Parallelize depend file generation 2020-11-22 09:02:59 -03:00
YAMAMOTO Takashi
6ee7fdf874 include/inttypes.h: Provide PRIdMAX and friends using 'j' modifier
Replace definitions in other places.
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi
123d882027 sim types.h: A workaround for macOS MODULECC 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi
a863fa30f9 sim: Make int64_t match the host OS 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi
c97f6f1b59 sim: Add _intmax_t and _uintmax_t 2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi
09fca224ec arch/sim/include/inttypes.h: Fix intptr_t
64-bit size_t/intptr_t/ptrdiff_t are long, not long long,
for macOS and Linux.

Note: we don't care CONFIG_SIM_M32 on macOS.

macOS:
    spacetanuki% uname -a
    Darwin spacetanuki.lan 18.7.0 Darwin Kernel Version 18.7.0: Mon Aug 31 20:53:32 PDT 2020; root:xnu-4903.278.44~1/RELEASE_X86_64 x86_64
    spacetanuki% cc --version
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    spacetanuki% cc -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    spacetanuki% cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    spacetanuki%

Linux:
    root@4c2e9e83ac82:/tools# uname -a
    Linux 4c2e9e83ac82 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    root@4c2e9e83ac82:/tools# cc --version
    cc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    root@4c2e9e83ac82:/tools# cc -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ long unsigned int
    root@4c2e9e83ac82:/tools# cc -m32 -dM -E - < /dev/null|grep __SIZE_TYPE__
    #define __SIZE_TYPE__ unsigned int
    root@4c2e9e83ac82:/tools#
2020-11-19 00:49:56 -08:00
YAMAMOTO Takashi
c79bda6e4f sim inttypes.h: Remove PRI/SCN macros for fast and least types
I forgot to remove some of them
in https://github.com/apache/incubator-nuttx/pull/2227 .
This commit removes them.
2020-11-10 00:03:35 -08:00
chao.an
182507f325 boards/sim: add atexit(2) into naming list
(gdb) b longjmp
Breakpoint 1 at 0x8270
(gdb) r
Starting program: /home/chao/code/m3/nuttx/nuttx
[    0.000000] Assertion failed at file:task/task_onexit.c line: 99

Breakpoint 1, 0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
(gdb)
(gdb) bt
|#0  0xf7b905e0 in siglongjmp () from /lib/i386-linux-gnu/libc.so.6
|#1  0xf7f9c3dc in siglongjmp_alias () from /lib/i386-linux-gnu/libpthread.so.0
|#2  0x5655d668 in up_assert (filename=0x56641018 "task/task_onexit.c", line=99) at sim/up_head.c:132
|#3  0x56567413 in _assert (filename=0x56641018 "task/task_onexit.c", linenum=99) at assert/lib_assert.c:36
|#4  0x565f8cfd in on_exit (func=0x565f8c12 <exitfunc>, arg=0x565fd780 <simuart_restoremode>) at task/task_onexit.c:99
|#5  0x565f8c89 in atexit (func=0x565fd780 <simuart_restoremode>) at task/task_atexit.c:109
|#6  0x565fd819 in simuart_start () at sim/up_simuart.c:112
|#7  0x5656c844 in up_uartinit () at sim/up_uart.c:496
|#8  0x5656ba7a in up_initialize () at sim/up_initialize.c:234
|#9  0x5655da56 in nx_start () at init/nx_start.c:701
|#10 0x5655d5e9 in main (argc=1, argv=0xffffd6f4, envp=0xffffd6fc) at sim/up_head.c:96

Change-Id: Ifd7196b2de7bf9fc7cea764c19a5c0eacf08fdb6
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 09:08:03 -03:00
YAMAMOTO Takashi
577d72258a sim inttypes.h: Remove PRI/SCN macros for fast and least types 2020-11-05 18:49:22 -08:00
YAMAMOTO Takashi
53256bdaa7 sim: inttypes.h: Make the #ifdef block minimum 2020-11-05 18:49:22 -08:00
Brennan Ashton
54832f37f2 sim: Initial Linux i2c bus support
This adds the inital wiring for i2c bus support in the sim target
and for Linux host adds the lower half that uses the i2c chardev.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-11-04 23:51:09 -08:00
ligd
73282fe2d8 arch/sim: add sim alsa support
Squashed commit of the following:

sim audio: call alsa to playback/capture data
sim/audio: correct the format capability
sim/audio: add pause/resume support
sim/audio: add auto stop when meet AUDIO_APB_FINAL
sim/audio: fix abort when set small buffer_size
sim/audio: move sim_audio.c to sim_alsa.c

Change-Id: I8e00ece79159e844ca17fd4c363480b985ee0490
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-11-04 05:48:14 -08:00
Matias N
9266c54bc2 lcd: add optional putarea()/getarea() operations 2020-11-04 04:00:22 -08:00
Matias N
fea3ee28f7 sim: support LCD emulation over X11; correctly decouple LCD/FB from X11/NX 2020-11-02 19:22:05 -08:00
Sebastian Ene
efbcb2cd31 arch/sim: Enable SIM_WALLTIME option by default
### Summary of Changes ###

Running the NuttX simulation 'as fast as possible' breaks the features
that depend on timing: eg. the Bluetooth stack. Enabling this option by
default SIM_WALLTIME=y will introduce delays and will tick the simulation at
a real pace.
Refresh defconfigs for sim targets and add depends on SIM_WALLTIME for
SIM_HCISOCKET.

Signed-off-by: Sebastian Ene <sene@apache.org>
2020-10-26 11:01:40 -07:00
dongjiuzhu
d452a05910 pollnotify: we should send poll events before semaphore incrementes.
There is a good case on sim platform:
When we input some cmd and click enter key to start application in terminal,
this context will change to application from IDLE loop. Althrough entey key '\r'
has been received to recv buffer and complete post semaphore of reader, but
pollnotify may not be called because context change. So when application run
poll function, because no events happend and poll enter wait, context will
again change to IDLE loop, this pollnotify of IDLE loop will run to send poll
events, poll function of applicaton will wake up. It's wrong!

Change-Id: I812a889f2e90781a9c3cb4b0251cccc4d32bebd1
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-10-26 08:27:09 -03:00
Matias N
5386f972fa bluetooth: Add support for HCI RAW channel; make host layer optional 2020-10-25 17:04:25 -07:00
Masayuki Ishikawa
3098b61776 Revert "arch/sim: Make the SIGUSR1 host signal to use the NuttX irq logic"
This reverts commit d6210fcd84.
2020-10-26 08:42:52 +09:00
Xiang Xiao
eb4121ce38 Change all 'Nuttx' to 'NuttX'
Unify the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-20 01:45:06 -07:00
Abdelatif Guettouche
609a5fa4f0 arch/: Add the ARCH_SRC directory to the context and clean_context
targets

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2020-10-17 22:46:27 +09:00
YAMAMOTO Takashi
c7865ddca3 sim: Fix make export
Namely, don't forget to generate nuttx-names.dat.
2020-10-08 14:03:20 +08:00
YAMAMOTO Takashi
83f1f2bc42 sim: Restore some symbols in nuttx-names.in
Used by arch/sim/src/sim/vpnkit/*.c
2020-10-01 15:33:22 +08:00
Sebastian Ene
d6210fcd84 arch/sim: Make the SIGUSR1 host signal to use the NuttX irq logic
Signed-off-by: Sebastian Ene <sene@apache.org>
2020-10-01 12:11:31 +08:00
ligd
22b837f440 arch/sim/src/nuttx-names.in: fix sim crash in Cygwin platform
Change-Id: I966e626eee03ce0b2c01afa905272194028e64f1
2020-09-30 08:07:17 -06:00
Yoshinori Sugino
698008d1e5 Fix typos 2020-09-28 13:54:43 +08:00
Gregory Nutt
fe0a88c838 Correct compilation of arch/sim/src/sim/up_wpcap.c
This commit corrects the following compilation error:

    /usr/include/cygwin/socket.h:27:8: error: redefinition of 'struct sockaddr'
       27 | struct sockaddr {
          |        ^~~~~~~~
    In file included from /usr/include/w32api/winsock2.h:57,
                     from sim/up_wpcap.c:48:
    /usr/include/w32api/psdk_inc/_ip_types.h:70:8: note: originally defined here
       70 | struct sockaddr {
          |        ^~~~~~~~
    In file included from /usr/include/sys/socket.h:13,
                     from /usr/include/cygwin/in.h:21,
                     from /usr/include/netinet/in.h:12,
                     from sim/up_wpcap.c:57:
    /usr/include/cygwin/socket.h:39:8: error: redefinition of 'struct sockaddr_storage'
       39 | struct sockaddr_storage {
          |        ^~~~~~~~~~~~~~~~
    In file included from sim/up_wpcap.c:48:
    /usr/include/w32api/winsock2.h:269:10: note: originally defined here
      269 |   struct sockaddr_storage {
          |          ^~~~~~~~~~~~~

The compilation was broken by a couple of recent blind, unverified changes to up_wpcap.c.  Most were introduced with commit: 8ce0ff5ce4 with this change:

    diff --git a/arch/sim/src/sim/up_wpcap.c b/arch/sim/src/sim/up_wpcap.c
    index ef7b4b3a0c..a15421e80c 100644
    --- a/arch/sim/src/sim/up_wpcap.c
    +++ b/arch/sim/src/sim/up_wpcap.c
    @@ -55,6 +55,8 @@

     #include <netinet/in.h>

    +#include "up_internal.h"
    +
     /****************************************************************************
      * Pre-processor Definitions
      ****************************************************************************/

up_internal.h includes:

     47 #  include <sys/types.h>
     48 #  include <stdbool.h>
     49 #  include <netinet/in.h>

And netinet/in.h includes:

     46 #include <sys/types.h>
     47 #include <sys/socket.h>
     48 #include <stdint.h>

Which is where the collision error is introduced since up_wpcap.c includes winsock2.h already.  There were additional problems introduced to the file by other changes:

- A malformed syslog() call was added
- Some issues with netdriver_setmacaddr()
2020-09-27 18:22:02 -07:00
Sebastian Ene
c47ad0c909 arch/sim: Add host timer to oneshot timer logic
## Summary of Changes

Add a host timer that generates periodic signals and sends SIGALRM to
the process that runs the NuttX simulation. This logic is integrated as
part of the existing NuttX oneshot timer. The host timer installs an
irq handler which is expected to run every CONFIG_USEC_PER_TICK .

Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
2020-09-25 17:36:16 -03:00
Xiang Xiao
68a2727c12 arch/sim: Extend the heap size to 64MB
to support the more complex application and
remove the special definition for CONFIG_MM_SMALL

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-21 07:40:17 -07:00
ligd
a9830254cf SIM in MacOS: make MacOS link process same with Linux
1. There is difference about symbol replace on nuttx-names.in
   between MacOS & Linux
2. For MacOS, if open '-fvisibility=hidden' and adjust nuttx-names.in,
   it will meet symbol link-back-to-nuttx error.
3. Make the MacOS replace behaviour, same with Linux

Note:
MacOS should install objcopy with command:
$ brew install binutils
$ export PATH=$PATH:/usr/local/opt/binutils/bin

already check in to cibuild.sh

Change-Id: If78b784cc0ecb98cdbf7091de38acef00a8a02f3
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-18 18:58:32 +09:00
Xiang Xiao
bf7399a982 arch: Initialize idle thread stack information
and remove the special handling in the stack dump

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia1ef9a427bd4c7f6cee9838d0445f29cfaca3998
2020-09-16 06:57:29 -07:00
Matias N
166242c171 use "export" to expose TOPDIR to all child make instead of passing it around every time 2020-09-15 21:11:33 -07:00
dongjiuzhu
3634bb6ba5 sim/uart: support tty operation in arch/sim
Change-Id: I6943c1e928ed821aa913bc619e5b8c581b5610c3
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-09-14 09:23:46 -03:00
Matias N
3d1159007f Remove extra application of EXTRAFLAGS and KDEFINE and the arch-level
EXTRAFLAGS is already applied to *FLAGS in board's Make.defs (and
it applies to whole build, not just arch-code). EXTRAFLAGS is passed
around each make call to the complete build.

KDEFINE is already added to EXTRAFLAGS in main Makefile so no need
to add it again in arch-level Makefile
2020-09-14 13:59:57 +09:00
ligd
d785394b0f arch/sim/src/sim/up_tapdev.c: fix compile error
Change-Id: I8d5a176671f78464c057155edace5eabbb382c5c
2020-09-10 15:33:55 +08:00
Ouss4
06ca12e6b9 arch/: Trivial typos, mostly "their is" to "there is" 2020-09-09 14:09:43 -04:00
ligd
2cfb239a87 arch/sim/src/nuttx-names.in: only host code need replace if -fvisibility=hidden
After previous commit, add -fvisibility=hidden, we don't need
worry about depended libxx.so callback to nuttx symbol in SIM.

So most of the symbol in nuttx-names.in can be remove.

But we still need some symbol replacement for host code.
Host code should call host API if access HOST sth, for example:
open, close, accept, printf...

Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-09 17:04:39 +08:00
ligd
42a1d45a8a arch/sim: replace printf fprintf to syslog, '\r\n' -> '\n'
should use syslog in kernel

RP check failed because host code call host API has
style AaaBbb, so, ignore the RP check

Change-Id: Iad3468dae2cd07e6dd92874c5e6d38d9018bee6c
Signed-off-by: ligd <liguiding1@xiaomi.com>
2020-09-09 17:04:39 +08:00
Xiang Xiao
f99719e260 Move note driver from drivers/syslog to drivers/note
it's better to put the note transport layer into a common folder

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-07 11:54:10 +08:00
Johannes Schock
515ad1c388 Added KDEFINE (__KERNEL__) to EXTRAFLAGS for libboard, for other architectures. 2020-09-05 21:25:31 +08:00
Sebastian Ene
18b47f9663 arch/sim: Add the pthread_cond_* API to the nuttx-names.in list
## Summary of changes

The pthread_cond_* API is also present as part of libfs.a and we want
to avoid colisions and link with the correct implementation.

Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
2020-09-05 16:41:54 +08:00
Sebastian Ene
5beb32bf0b arch/sim: Use pthread_cond for signalling CPU initialisation done
## Summary of changes

On OSX with CONFIG_SMP=y the semaphore which notifies that the CPU is
initialised, is not created and the up_cpu_start() returns with error
from sem_init(). This patch fixes the problem by using pthread_cond_t
signalling mechanism which is supported on Mac.

Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
2020-09-05 16:41:54 +08:00
Xiang Xiao
5107104bbe arch/sim: Model host signal as NuttX's interrupt
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-03 10:20:50 +08:00
Sebastian Ene
5db11a275e arch/sim: Mask and restore the host signal in irq_save and irq_restore
to avoid the host signal process interrupt the execution of NuttX critical section

Signed-off-by: Sebastian Ene <nuttx@fitbit.com>
2020-09-03 10:20:50 +08:00
Xiang Xiao
76c2ede936 arch/sim: Fix macOS error: 'sem_init' is deprecated
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-02 12:37:34 +09:00
Xiang Xiao
406c6ae4dd arch/sim: Fix clang error: address argument to atomic operation must be a pointer to _Atomic type
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-02 12:37:34 +09:00
YAMAMOTO Takashi
c52854f5bb nuttx-names.in: add dlopen and friends
Note: dlsymtab is not in standards. but just in case.

	(gdb) bt
	#0  getpid () at task/task_getpid.c:91
	#1  0x00000000004fbc9d in modlib_registry_lock ()
		at modlib/modlib_registry.c:89
	#2  0x0000000000719ee0 in modsym (handle=0xffffffffffffffff,
		name=0x7fa7ebdde8c7 "mmap") at module/mod_modsym.c:92
	#3  0x000000000071597d in dlsym (handle=0xffffffffffffffff,
		name=0x7fa7ebdde8c7 "mmap") at dlfcn/lib_dlsym.c:164
	#4  0x00007fa7ebdbeb39 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	#5  0x00007fa7ebd79b28 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	#6  0x00007fa7ebd9d7a7 in ?? () from /lib/x86_64-linux-gnu/libasan.so.5
	#7  0x00007fa7ec6ce03a in ?? () from /lib64/ld-linux-x86-64.so.2
	#8  0x00007fa7ec6ce141 in ?? () from /lib64/ld-linux-x86-64.so.2
	#9  0x00007fa7ec6be13a in ?? () from /lib64/ld-linux-x86-64.so.2
	#10 0x0000000000000001 in ?? ()
	#11 0x00007fff028f686b in ?? ()
	#12 0x0000000000000000 in ?? ()
	(gdb) quit
2020-09-01 23:10:29 +08:00