Commit Graph

913 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
df4c60c96d arch/sim/src/sim/up_touchscreen.c: Fix a syslog format 2020-12-05 08:13:32 -06:00
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
YAMAMOTO Takashi
b17d9871e5 nuttx-names.in: sort 2020-09-01 23:10:29 +08:00
Xiang Xiao
3ddb3dc00e arch/sim: Should use HOSTCFLAGS for the HOSTSRCS dependence generation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-30 20:48:07 +01:00
Brennan Ashton
8934f2ed79 SIM: Add support Linux HCI Socket as BLE adaptor
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-08-28 01:01:29 -07:00
Xiang Xiao
1e21c97744 arch/sim: Remove the redundant Kconfig variable dependence check
because Kconfig system already guarantee the invariance

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-24 21:18:31 +09:00
Xiang Xiao
ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Xiang Xiao
8617cd94b2 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-21 18:09:19 +08:00
Xiang Xiao
8ce0ff5ce4 arch/sim: Make up_internal.h includable in host environment
to avoid the declaration repetition

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-21 18:09:19 +08:00
Xiang Xiao
acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Xiang Xiao
a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
Xiang Xiao
be10c734b0 arch/sim: Always preserve the heap memory dynamically
so size with nuttx could report the correct bss value:
  text    data     bss     dec     hex filename
 155467    1464    1948  158879   26c9f nuttx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7e9ec4d09d14b6f15b235b4b46ebdd98986d9750
2020-08-10 08:20:06 +02:00
Huang Qi
fd78f83e02 drivers/video: Refine the update region notification mechanism
1.Expose the notification through fb_vtable_s::updatearea
2.Incorporate old nx_notify_rectangle into the new updatearea callback
3.Migrate the calle of nx_notify_rectangle to fb_vtable_s::updatearea

Change-Id: Ia3d1f73e8757b2d381586d76ec6adc16c810018d
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-08-10 08:08:33 +02:00
Xiang Xiao
baa4da2d0f Revert "arch/sim/src/sim/up_hostfs.c: hostfs skip '.' and '..' in readdir'"
This reverts commit 9f0502f8ba.
2020-08-09 16:16:34 -06:00
Xiang Xiao
4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
YAMAMOTO Takashi
0b90ad3dd4 arch/sim/src/sim/up_exit.c: Appease a clang-check warning
clang-check complained like the following.
While this is not a real bug, it's easy to appease.

sim/up_exit.c:68:21: warning: Value stored to 'tcb' during its initialization is never read
  FAR struct tcb_s *tcb = this_task();
                    ^~~   ~~~~~~~~~~~
1 warning generated.
2020-08-03 22:52:31 -05:00
Xiang Xiao
2a2dd35339 arch/sim: Fix warning: implicit declaration of function ‘pthread_yield’
https://stackoverflow.com/questions/32174861/why-implicit-declaration-of-pthread-yield-with-lpthread-while-all-ok-with-pthr

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-01 14:31:49 +09:00
Xiang Xiao
b330b3ac0c arch/sim: Fix the linkage of up_irqinitialize mismatch
include/arch/irq.h💯20: note: previous declaration with ‘C++’ linkage
  100 | static inline void up_irqinitialize(void)
      |                    ^~~~~~~~~~~~~~~~
In file included from include/ctype.h:45,
                 from include/libcxx/ctype.h:38,
                 from include/libcxx/cctype:38,
                 from include/libcxx/cwctype:53,
                 from include/libcxx/cwchar:106,
                 from include/libcxx/string:510,
                 from libcxx/src/debug.cpp:13:
include/nuttx/arch.h:1343:6: error: conflicting declaration of ‘void up_irqinitialize()’ with ‘C’ linkage
 1343 | void up_irqinitialize(void);
      |      ^~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0e0963a3465f9dabdaca6534a55b9c2c41f4bc64
2020-07-30 12:50:39 +09:00
Xiang Xiao
7a32a396b0 arch/sim: Move share memory allocation to up_hostmemory.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-28 15:41:19 +01:00
SPRESENSE
e249a2f82f Makefile: Fix Make.dep not updated by config changes
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:

 1) Add source files by config symbol
 2) Include header files in #ifdef directive

These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
2020-07-28 03:59:45 -05:00
Xiang Xiao
78862c51dc arch/sim: Fix the wrong sleep time calculation in sim_idle_trampoline
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-28 08:37:19 +09:00
Xiang Xiao
53f33a7ea2 arch/sim: Synchronize the creation of idle thread by semaphore
it's wrong to synchronize with mutex here

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-28 08:37:19 +09:00
Xiang Xiao
71a9d2402d arch/sim: Replace sigprocmask with pthread_sigmask in main thread
like other idle thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-28 08:37:19 +09:00
Xiang Xiao
f2446ecb90 arch/sim: unify the prefix(g_cpu_) for SMP related variables
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-28 08:37:19 +09:00
Xiang Xiao
cc00d2b2b0 arch/sim: Call sched_note_cpu_* when SCHED_INSTRUMENTATION equal true
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-26 12:24:57 +01:00
Xiang Xiao
d6827cab60 arch: up_assert shouldn't call exit directly
since exit will be only callable from userspace and change
the 1st argument from "const uint8_t *" to "const char *"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86487d57210ab63109148232da71dbc4d60a563b
2020-07-19 01:21:36 +01:00
Nakamura, Yuuichi
9db5d2aeea Fix nxstyle warnings 2020-07-13 00:46:55 -05:00
Nakamura, Yuuichi
f392d246d3 Fix note driver initialization 2020-07-13 00:46:55 -05:00
Xiang Xiao
dc55968678 arch/sim: Don't construct global C++ objects before main
otherwise the crash will happen because NuttX doesn't initialize yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icc3f3fcd842a315bc68ae436d7a7a04aca1fc546
2020-07-11 15:06:09 -03:00
Xiang Xiao
19aaf7b357 arch/sim: Move the generation of nuttx-names.dat into nuttx target
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I04c612a56caee170742b07f87cea1b7feb4078c5
2020-07-11 15:06:09 -03:00
Xiang Xiao
f36bf5e079 arch/sim: Avoid build nuttx.rel and cleanrel concurrently
make can't guarantee the build order of prerequest with -jn where n > 1

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I772fcc0775d15b385f28fc0abeeff383b3a52622
2020-07-11 15:06:09 -03:00
chao.an
159053ab62 sim/c++: correct the compile flags
fix the following linker error:
nuttx.rel:(.eh_frame+0x93): undefined reference to `__gxx_personality_v0'

Change-Id: I94f43a15275194d42199c91f276e8848ad5189f6
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-11 15:06:09 -03:00
Xiang Xiao
4176a3828b arch/sim: implement sim_getsp
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-09 13:51:09 +01:00
Xiang Xiao
6b316edcda sim: add __cxa_atexit into the name list
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I81e75532db1953584124142763f9d07ddb788898
2020-07-09 15:17:12 +09:00
Beat Küng
a349595316 gpio: extend gpio_pintype_e for pulldown/up and opendrain
- fix code style
- fix bool conversion when calling go_read()
2020-07-07 08:34:25 -05:00
Xiang Xiao
67ef70d460 vfs/dirread: Should return the same file type as lstat
by extend the possible value of d_type for the special file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-07 13:41:10 +01:00
Xiang Xiao
91ed14c631 vfs/stat: Make the flag defintion more confirm POSIX standard
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-07 13:41:10 +01:00
YAMAMOTO Takashi
05671fd8f1 vpnkit: set mac address when available
up_vpnkit network driver gets its mac address from the vpnkit.
it isn't available until a successful negotiation with the vpnkit.
2020-06-25 07:27:44 -05:00
YAMAMOTO Takashi
74d13d74b9 sim: Add more names to nuttx-names.in
Some of them are for the recent development. eg. rewind, ftw
Some of them were simply missing. eg. shutdown
2020-06-25 07:26:53 -05:00
chao.an
f5039d0b23 sim: fix compile error caused by race condition
LD: nuttx.rel
objcopy: couldn't open symbol redefinition file nuttx-names.dat
         (error: No such file or directory)
Makefile: 297: recipe for target 'nuttx.rel' failed

Change-Id: Ic78f030b77c3468ddbb96d4fb0558edad3abc3ae
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-24 14:32:22 +01:00
chao.an
6e8cf28e9c nuttx/names: add symbol name preprocessing support
Change-Id: I54e0b24391b6e08801e3f0b1799ed3fcc9188ae7
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-18 07:09:40 -06:00
chao.an
1a59e5ad0f sim/names: add munmap into naming list
Change-Id: Ideb6c538fafda3f031d3a0d976da85917ba64530
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-18 07:09:40 -06:00
chao.an
d96b22ae3c nuttx/names: add getchar into naming list
Change-Id: I04b9283250bd139201b2de766f7f5f30db992434
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-18 07:09:40 -06:00
qiaowei
1ab98da054 nuttx-names.dat: add strstr.
Signed-off-by: qiaowei <qiaowei@xiaomi.com>
Change-Id: Iab4bbe0ea3b12d819c790a4720d3d3c5534ad581
2020-06-18 07:09:40 -06:00
chao.an
332e5481ee arch/stackframe: fix heap buffer overflow
ASAN trace:
...
==32087==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4502120 at pc 0x56673ca3 bp 0xff9b6a08 sp 0xff9b69f8
WRITE of size 1 at 0xf4502120 thread T0
    #0 0x56673ca2 in strcpy string/lib_strcpy.c:64

0xf4502120 is located 0 bytes to the right of 8224-byte region [0xf4500100,0xf4502120)
allocated by thread T0 here:
    #0 0xf7a60f54 in malloc (/usr/lib32/libasan.so.4+0xe5f54)
    #1 0x5667725d in up_create_stack sim/up_createstack.c:135
    #2 0x56657ed8 in nxthread_create task/task_create.c:125
    #3 0x566580bb in kthread_create task/task_create.c:297
    #4 0x5665935f in work_start_highpri wqueue/kwork_hpthread.c:149
    #5 0x56656f31 in nx_workqueues init/nx_bringup.c:181
    #6 0x56656fc6 in nx_bringup init/nx_bringup.c:436
    #7 0x56656e95 in nx_start init/nx_start.c:809
    #8 0x566548d4 in main sim/up_head.c:95
    #9 0xf763ae80 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18e80)

CALLSTACK:
    #8  0xf79de7a5 in __asan_report_store1 () from /usr/lib32/libasan.so.4
    #9  0x565fd4d7 in strcpy (dest=0xf4a02121 "", src=0xf5c00895 "k") at string/lib_strcpy.c:64
    #10 0x565e4eb2 in nxtask_setup_stackargs (tcb=0xf5c00810, argv=0x0) at task/task_setup.c:570
    #11 0x565e50ff in nxtask_setup_arguments (tcb=0xf5c00810, name=0x5679e580 "hpwork", argv=0x0) at task/task_setup.c:714
    #12 0x565e414e in nxthread_create (name=0x5679e580 "hpwork", ttype=2 '\002', priority=224, stack=0x0, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:143
    #13 0x565e42e3 in kthread_create (name=0x5679e580 "hpwork", priority=224, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:297
    #14 0x565e5557 in work_start_highpri () at wqueue/kwork_hpthread.c:149
    #15 0x565e3e32 in nx_workqueues () at init/nx_bringup.c:181
    #16 0x565e3ec7 in nx_bringup () at init/nx_bringup.c:436
    #17 0x565e3d96 in nx_start () at init/nx_start.c:809
    #18 0x565e3195 in main (argc=1, argv=0xffe6b954, envp=0xffe6b95c) at sim/up_head.c:95

Change-Id: I096f7952aae67d055daa737e967242eb217ef8ac
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-15 07:19:41 -06:00
Xiang Xiao
4fbbd2e3bf arch: Move PRIxMAX and SCNxMAX definition to include/stdint.h
like other related macro(e.g. INTMAX_MIN, INTMAX_MAX...)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8863599960b1a9b1c22ae9c35735a379a4c745b0
2020-06-10 08:24:47 +02:00
Xiang Xiao
7758eb8658 arch: Define INTx_C and UINTx_C macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia50ea8764880fabd3d878c95328632c761be6b43
2020-06-10 08:24:47 +02:00
YAMAMOTO Takashi
36ae29c21c sim: Fix hostfs errno
Don't forget to convert the host convention (-1/errno) to
the nuttx kernel convention. (negative errno)
2020-06-05 19:49:35 +08:00
Xiang Xiao
b4bd9427f7 arch: Rename _exit to up_exit to follow the naming convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2779a2a3ccb5426fe78714fdcc629b8dfbb7aaf6
2020-06-04 22:20:45 +01:00
Xiang Xiao
85b859fb8d arch: _exit should't call nxsched_resume_scheduler twice in SMP mode
utilize the call inside nxtask_exit instead, also move
nxsched_suspend_scheduler to nxtask_exit for symmetry

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I219fc15faf0026e452b0db3906aa40b40ac677f3
2020-06-04 22:20:45 +01:00
Xiang Xiao
b932b653dd arch: Select 64bit elf base on the architecture characteristic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I09eec5a76f255016a910cfec3b3f70cd7577525e
2020-05-31 21:38:32 -07:00
Gregory Nutt
82debdc213 Make task_init() and task_activate() internal OS functions.
-Move task_init() and task_activate() prototypes from include/sched.h to include/nuttx/sched.h.  These are internal OS functions and should not be exposed to the user.
-Remove references to task_init() and task_activate() from the User Manual.
-Rename task_init() to nxtask_init() since since it is an OS internal function
-Rename task_activate() to nxtask_activate since it is an OS internal function
2020-05-25 23:54:45 +01:00
Xiang Xiao
37685110cb arch/sim: Fix hostfs.h No such file or directory in makedep
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-25 09:34:47 -06:00
Xiang Xiao
7e5b0f81e9 build: Replace -I with INCDIR
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 20:20:12 +01:00
Xiang Xiao
23668a4b9b build: Remove the empty variable assignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:24:13 -06:00
Xiang Xiao
dd61d3d9f9 build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 18:00:40 +01:00
Xiang Xiao
1a95cce1a3 build: Move .config check to the top Makefile
remove the workaround to handle the inexistence of .config/Make.defs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-20 17:57:34 +01:00
chao.an
05ebb39998 arch: complete logic in create/use stack to support stack coloration.
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-18 07:30:46 -06:00
chao.an
86a412d65a arch/stack: fix check stack breakage
remove the TLS alignment check

Regression by:

--------------------------------------------------------
commit a6da3c2cb6
Author: Ouss4 <abdelatif.guettouche@gmail.com>
Date:   Thu May 7 18:50:07 2020 +0100

    arch/*/*_checkstack.c: Get aligned address only when
    CONFIG_TLS_ALIGNED is enabled.

--------------------------------------------------------
commit c2244a2382
Author: Gregory Nutt <gnutt@nuttx.org>
Date:   Thu May 7 09:46:47 2020 -0600

    Remove CONFIG_TLS

    A first step in implementing the user-space error is
    force TLS to be enabled at all times.  It is no longer optional

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-18 07:27:17 -06:00
Gregory Nutt
a569006fd8 sched/: Make more naming consistent
Rename various functions per the quidelines of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    nxsem_setprotocol -> nxsem_set_protocol
    nxsem_getprotocol -> nxsem_get_protocol
    nxsem_getvalue -> nxsem_get_value
2020-05-17 14:01:00 -03:00
Xiang Xiao
d938b50969 arch/sim: Fix multiple definition of g_cpu_wait' and g_cpu_paused'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I62d81582d58c9156ee8a56207b479dad7d6d18df
2020-05-17 07:36:45 -06:00
chao.an
8bce416c25 sim/tapdev: follow the tunnel MTU size
Change-Id: Ia32255517650d95ea3a675ee9fe5b69e923fb51a
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-05-14 07:54:57 -06:00
Gregory Nutt
f92dba212d sched/sched/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 16:58:42 -03:00
Gregory Nutt
a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Gregory Nutt
2d78ed7c7e arch/sim/src/nuttx-names.dat: Add __errno()
Needed to avoid collision with the host on simulator build.
2020-05-08 01:58:25 +01:00
Gregory Nutt
c2244a2382 Remove CONFIG_TLS
A first step in implementing the user-space error is force TLS to be enabled at all times.  It is no longer optional
2020-05-07 12:04:16 -06:00
Gregory Nutt
bda24f09c2 libs/libc/tls/tls_getinfo.c: Add tls_get_info()
Move the logic to get TLS information from an inline function to a normal function.  For the unaligned case, it is probably too large to be inlined.

Also fixes some minor things from review of previous commits.
2020-05-05 18:56:33 +01:00
Abdelatif Guettouche
b7e7fba732 TLS_UNALIGNED (#2)
* Implement the TLS_UNALIGNED
2020-05-05 18:56:33 +01:00
Xiang Xiao
2476aad5b4 sim: Fix librt can't find on macOS
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 13:09:44 -06:00
YAMAMOTO Takashi
8b054dba98 sim: Update hostfs after the recent struct stat timespec changes
Fix it after the following change:

    commit bb4458b63f
    Author: Ouss4 <abdelatif.guettouche@gmail.com>
    Date:   Thu Apr 30 19:05:12 2020 +0100

        include/sys/stat.h: Per the POSIX standard, the atime, ctime and mtime field
    s
        have changed their type from time_t to struct timespec.
2020-05-01 17:42:46 +08:00
liuhaitao
bab61180db sim: Add host mmap and perror support
Change-Id: I20bb8cba7ed6ab3e06c91f275fa2be6a633efe9e
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-30 20:20:32 +08:00
zhongan
ef9735febd arch/sim: initialize 'rxbuf_size' and 'txbuf_size' instead of 'buf_size'.
Change-Id: I5442f022cafef6c0f636614ba739e11249713134
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-26 19:59:16 -06:00
zhongan
4ec8fd521f arch/sim: change 'VIRTIO_RPMSG_F_BIND' to 'VIRTIO_RPMSG_F_ACK'
Change-Id: I4d6b6b700130e264199f490ab4e922f699955113
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-26 19:59:16 -06:00
Nathan Hartman
d6f7821b15 Docs and comments: Change OSX -> macOS
Mac OS X was renamed to macOS at some point. Update references to
OSX, OS X, Mac OS X, Mac OSX, and other permutations, to macOS,
in README files and in comments of other files.
2020-04-26 07:48:33 -06:00
Xiang Xiao
090a4d1690 Update .gitignore per testbuild.sh report
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-20 07:07:32 -06:00
Xiang Xiao
3d10f8cf8f Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-19 07:51:18 -06:00
Xiang Xiao
2a7029dd52 arch/sim: All cpu core need conform to CONFIG_SIM_WALLTIME behaviour
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-19 07:51:18 -06:00
zhongan
b4a50a9192 fix nxstyle warning.
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-15 12:30:50 -03:00
zhongan
4ff0edce25 arch/sim: add implemntation of 'host_sleep'.
Change-Id: Ib82343565ca9541499dec52c753c3f15923f7d1c
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-15 12:30:50 -03:00
zhongan
a41c5e01e1 arch/sim: add header to remove warning when build with 'CONFIG_SYSLOG_RPMSG_SERVER'.
Change-Id: I58ebe25434aaebce3812abb52caf3c670118cb66
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-04-15 12:30:50 -03:00
liuhaitao
459ad99373 Use EXTRAFLAGS instead of EXTRADEFINES to be used by make via command line
So call 'make EXTRAFLAGS=-Wno-cpp' could suppress the warnings with pre-processor
directive #warning in GCC.

Change-Id: Iaa618238924c9969bf91db22117b39e6d2fc9bb6
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-11 08:31:08 -06:00
ligd
231ad202ee global change: repace sched_xfree() to kxmm_free()
Changes:
sched_xfree() => kxmm_free()
remove garbage related APIs
remove ARCH_HAVE_GARBAGE

Cause garbage feature move to mm_heap, then don't need
garbage anymore.

Change-Id: If310790a3208155ca8ab319e8d038cb6ff92c518
Signed-off-by: ligd <liguiding@fishsemi.com>
2020-04-09 10:29:28 -06:00
Nakamura, Yuuichi
9029e4daee Fix nxstyle issues 2020-04-07 06:23:15 -06:00
Nakamura, Yuuichi
e264484c16 Remove type casting to wdentry_t (arch/) 2020-04-07 06:23:15 -06:00
Nathan Hartman
679b4fbee2 arch: Fix included directed -> included directly
This typo had been copied and pasted into numerous irq and syscall
headers.
2020-04-05 22:31:15 +01:00
Alan Carvalho de Assis
30ca00c0a9
Check for return of nxsem_wait_uninterruptible. This commit is for files under arch/sim 2020-04-01 19:50:39 +01:00
YAMAMOTO Takashi
40d7f83e31 sim: Appease a few prototype warnings 2020-03-28 12:08:57 +01:00
YAMAMOTO Takashi
a493c92826 sim: Use executable memory for the heap
On modern environments, bss is not executable.

Alternatively we can use the ARCH_HAVE_MODULE_TEXT mechanism.
But it's considered overkill for the sim, which is mainly
for development.
2020-03-27 00:04:36 -05:00
YAMAMOTO Takashi
d6d03d64d5 sim: Hide strerror/strerror_r 2020-03-25 21:35:17 -06:00
YAMAMOTO Takashi
27aa16111c sim: hostfs: Stop assuming CONFIG_NAME_MAX=32 2020-03-25 20:31:32 -06:00
YAMAMOTO Takashi
f89ccf873e sim: host_readdir: Ensure NUL termination when truncating d_name 2020-03-25 20:31:32 -06:00
YAMAMOTO Takashi
2991836ee8 sim: Appease nxstyle errors 2020-03-25 00:09:21 -05:00
YAMAMOTO Takashi
9fdda58eca sim: Hide putenv 2020-03-23 18:17:58 -06:00
YAMAMOTO Takashi
2e933102e1 sim: Hide getopt related globals
Right now this is rather theorethic as we don't actually
use getopt though.
2020-03-23 14:38:17 -05:00
YAMAMOTO Takashi
702d82d052 vpnkit: Add a config to specify the socket 2020-03-23 14:37:56 -05:00
YAMAMOTO Takashi
12a97acaed vpnkit: Make this less verbose on connection errors 2020-03-23 14:37:28 -05:00
YAMAMOTO Takashi
1ffa009c8b Revert "Don't generate .depend anymore"
This reverts commit 79af7fbf4e.

Because:

* btashton reported some issues in local builds:

  https://github.com/apache/incubator-nuttx/pull/603#issuecomment-602264860

* this might be related to the current CI breakage:

  > /bin/sh: 1: /__w/incubator-nuttx/incubator-nuttx/nuttx/tools/mkdeps: not found
2020-03-22 23:07:29 -05:00
Xiang Xiao
79af7fbf4e
Don't generate .depend anymore 2020-03-22 18:15:29 +00:00
YAMAMOTO Takashi
9b88ecc1b2 sim: Make SIM_NETDEV_TAP depends on LINUX||WINDOWS 2020-03-21 00:23:40 -05:00
YAMAMOTO Takashi
a5f8b20fcd sim: Add a netdev backed by VPNKit 2020-03-19 09:13:32 -05:00
YAMAMOTO Takashi
124c00b661 Appease nxstyle complaints in files from vpnkit 2020-03-19 09:13:32 -05:00
YAMAMOTO Takashi
cd10bd67c4 Add copyright notices to files from vpnkit 2020-03-19 09:13:32 -05:00
YAMAMOTO Takashi
4062727333 negotiate() function extracted from vpnkit
From:
    https://github.com/moby/vpnkit
    commit 2ffc1dd8a84ea7359dd09b1f4b51bb728d4f46a0
    c/vpnkit-tap-vsockd/tap-vsockd.c

With minimum changes to make it build.
2020-03-19 09:13:32 -05:00
YAMAMOTO Takashi
b748fcde0a vpnkit/protocol.c: make this compile 2020-03-19 09:13:32 -05:00
YAMAMOTO Takashi
261249cc99 vpnkit: Add a few files from vpnkit
From:
    https://github.com/moby/vpnkit
    commit 2ffc1dd8a84ea7359dd09b1f4b51bb728d4f46a0
    c/vpnkit-tap-vsockd/protocol.h
    c/vpnkit-tap-vsockd/protocol.c
2020-03-19 09:13:32 -05:00
Nathan Hartman
a5e643b0cd Fix typos in comments and documentation. 2020-03-16 20:01:11 -06:00
Petro Karashchenko
3fa6baec98 spi: change spi_send() interface to support of 32-bit word transfer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2020-03-09 08:03:35 -06:00
Juha Niskanen
f3490e42c3 Fix typos in comments 2020-03-03 09:11:57 -06:00
Xiang Xiao
b9b86fcc63 arch/sim: Handle tap device initializition failure gracefully 2020-02-24 08:42:03 -06:00
Xiang Xiao
96adb827a3 arch/sim: Ensure all host printf end with \r\n
Since simulator switch console to raw mode, we have to add \r manually
2020-02-24 08:41:45 -06:00
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
liuhaitao
b4cf5f5dab arch: refine up_serialinit/up_earlyserialinit/rpmsg_serialinit 2020-02-23 09:11:57 -06:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Gregory Nutt
d06d8fbca2 Run all .c and .h files modified by PR301 through nxstyle. 2020-02-19 07:23:41 -06:00
Xiang Xiao
892290f76b syslog: Call syslog_rpmsg_init inside syslog_initialize like other syslog driver 2020-02-19 07:19:34 -06:00
Xiang Xiao
51a2171c71 ramlog: Remove g_ramlog_syslog_channel since it's same as g_default_channel
And remove syslog_init_e because all initialization is later now and we don't
distinguish the initialition phase anymore after ramlog don't need special
initialize.
2020-02-18 13:04:45 -06:00
Xiang Xiao
dcaaf2d912 ramlog: Remove all ramlog_consoleinit related code
Because we can get the same function by CONSOLE_SYSLOG/syslog_console_init.
BTW, it isn't a good choice to use g_ramlogfops as /dev/console since nsh
will read back what it send out which will surprise most people.
2020-02-18 12:57:43 -06:00
Xiang Xiao
6b77f73583 arch: Move iob_initialize into nx_start just after heap initialization
it doesn't make sense that iob initialization is in up_initialize
but other memory components initialization is called in nx_start

Change-Id: Id43aeaa995f340c5943f59a0067a483ff3ac34a2
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-18 10:26:19 -03:00
Xiang Xiao
e7d9260014 arch: Customize the typedef of size_t instead of intptr_t
To ensure size_t same as toolchain definition in the first place and rename CXX_NEWLONG to ARCH_SIZET_LONG.  The change also check whether __SIZE_TYPE__ exist before CONFIG_ARCH_SIZET_LONG so our definition can align with toolchain(gcc/clang) definition automatically.
2020-02-18 07:15:19 -06:00
Xiang Xiao
866a531899 sim/rtc: Don't change the host wall clock in sim_rtc_settime 2020-02-16 09:44:04 -06:00
Gregory Nutt
5d850fb197 arch/sim/src/sim/up_oneshot.c: Eliminate warning from build test. 2020-02-15 19:47:02 +01:00
Gregory Nutt
f5e0bb2d30 Run all files modified by PR274 through nxstyle. 2020-02-15 07:17:22 -06:00
Xiang Xiao
8b5658b918 arch/sim: Implement arch rtc interface on top of rtc driver 2020-02-15 07:17:19 -06:00
Xiang Xiao
d0d4b7a531 Reimplement arch alarm timer on top of oneshot driver framework
The benefit include:

1. Simplify the implementation
2. Support both tick and tickless automatically
3. No time drift in tickless mode
4. Support critmon arch API automatically
2020-02-15 07:17:16 -06:00
YAMAMOTO Takashi
1a3f59be58 sim: Make hostfs build for macOS
* Ignore O_DIRECT if the host OS doesn't provide it.
* Use statvfs instead of statfs. The former is in POSIX and
  more widely available these days.
2020-02-13 15:17:36 +08:00
YAMAMOTO Takashi
22d002762b sim: Add more names to nuttx-names.dat 2020-02-12 20:39:08 -06:00
YAMAMOTO Takashi
3d425280b6 simuart: Don't assume a specific endian 2020-02-12 20:38:25 -06:00
Gregory Nutt
5f306b0461 Run all .c and .h files modified by PR 249 through nxstyle. 2020-02-12 08:17:03 -06:00
Xiang Xiao
5e99e64d9f sim/net: Replace the busy polling with work
netdriver_loop should check there is data to read before queue the work
2020-02-12 08:16:43 -06:00
Xiang Xiao
5a00657ac4 arch/sim: Change CONFIG_NET_ETHERNET to CONFIG_SIM_NETDEV 2020-02-12 08:16:33 -06:00
Xiang Xiao
6b1187b402 arch/sim: Change the return type of netdriver_setmacaddr to void 2020-02-12 08:16:23 -06:00
Xiang Xiao
582b2af912 arch/sim: Change syslog to printf in up_tapdev.c
since this file is compiled with host environment, can't call NuttX's syslog
2020-02-12 08:16:08 -06:00
Ouss4
2ff43fb8a8 Run files modified by PR239 through nxstyle. 2020-02-11 21:09:12 +00:00
Xiang Xiao
e6c67bdd78 arch/sim: Drive up_x11update by work to simplify up_idle. 2020-02-11 21:07:22 +00:00
Xiang Xiao
14a82f40d2 arch/sim: Make eventloop as an internal variable to simplify up_idle. 2020-02-11 21:07:12 +00:00
Gregory Nutt
d09af3b7f3 Run .c and .h files modified by PR241 through nxstyle. 2020-02-10 08:57:20 -06:00
Xiang Xiao
f2f385902b arch/sim: Remove the unnecessary file guard
since the same protection is already done in Makefile
2020-02-10 08:57:06 -06:00
Xiang Xiao
7fd3a3bcca xarch/sim: Call pm_initialize from up_initialize directly
We don't need the additional flexibility since sim just has one chip.
2020-02-10 08:56:51 -06:00
Xiang Xiao
978575d79a arch/sim: Pass X11 related config to host environment
Remove the hard code CONFIG_SIM_X11NOSHM value from up_x11framebuffer.c
2020-02-10 08:56:37 -06:00
Xiang Xiao
856b62ca09 arch/sim: Fix X11 segmentation fault when CONFIG_SIM_X11NOSHM isn't enabled
up_x11mapsharedmem should assign the share memory to g_framebuffer
2020-02-10 08:56:22 -06:00
Xiang Xiao
406a9adfdd arch/sim: fix up_idle call the wrong pthread_yield version
The logic want the host version but link to NuttX version
2020-02-09 07:44:51 -06:00
Xiang Xiao
e06a4226ed arch/sim: Reuse the main thread as the simulated CPU0 2020-02-09 07:43:47 -06:00
Xiang Xiao
a87271617a arch/sim: Replace pthread mutex with atomic function for up_testset
up_testset may be called from signal hander but it isn't safe to call pthread API in that context
2020-02-09 07:43:10 -06:00
Xiang Xiao
7794dc8821 arch/sim: Set idle thread stack size to zero
To avoid ps generate "Segmentation fault" because do_stackcheck
check the stack color if the stack size doesn't equal zero
BTW, it is better to set idle task stack size to zero since idle
task use the host thread and the stack size from config isn't the
actual value.
2020-02-09 07:42:19 -06:00
Xiang Xiao
bfe1d471ce sim/arch: Fix up_head.c:122:11:implicit declaration of function 'up_cpu_index' 2020-02-09 07:41:42 -06:00
Xiang Xiao
04128b4570 arch/sim/src: Rename board_lcd.c to up_lcd.c like other sim code
Rename board_lcd.c to up_lcd.c like other sim code and compile up_spiflash.c and up_qspiflash.c conditionally
2020-02-08 08:52:34 -06:00
Xiang Xiao
fa3e66fe82 arch/sim/src/: Reimplement sim uart on top of serial driver framework
The benefits include:

1. Simplify the implementation
2. Support Ctrl+C automatically
3. Support poll automatically
4. Call pm_activity automatically
5. Save one polling thread
2020-02-08 07:52:26 -06:00
Xiang Xiao
6d69439f58 Call xxx_timer_initialize from clock subsystem
Call xxx_timer_initialize from clock subsystem to make timer ready for use as soon as possiblei and revert the workaround:

commit 0863e771a9
Author: Gregory Nutt <gnutt@nuttx.org>
Date:   Fri Apr 26 07:24:57 2019 -0600

    Revert "sched/clock/clock_initialize.c:  clock_inittime() needs to be done with CONFIG_SCHED_TICKLESS and clock_initialize should skip clock_inittime() for external RTC case since the RTC isn't ready yet."

    This reverts commit 2bc709d4b9.

    Commit 2bc709d4b9 was intended to handle the case where up_timer_gettime may not start from zero case.  However, this change has the side-effect of breaking every implementation of tickless mode:  After this change the tickless timer structures are used before they are initialized in clock_inittime().  Initialization happens later when up_initialize is called() when arm_timer_initialize().

    Since the tickless mode timer is very special, one solution might be to

    1. Rename xxx_timer_initialize to up_timer_initialize
    2  Move up_timer_initialize to include/nuttx/arch.h
    3.  Call it from clock subsystem instead up_initialize

    Basically, this change make timer initialization almost same as rtc initialization(up_rtc_initialize).

    For now, however, we just need to revert the change.
2020-02-08 07:40:06 -06:00
Xiang Xiao
76bbed07a4 Call up_irqinitialize from irq subsystem
Call up_irqinitialize from irq subsystem to make the irq ready for use as soon as possible
2020-02-08 07:39:22 -06:00
Xiang Xiao
a8de37fbec Ensure all source code end with one and only one newline
by this command:
git ls-files -z | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
2020-02-08 07:25:56 -06:00
Xiang Xiao
c5b1554d84 Remove NETDEV_LOOPBACK option, NET_LOOPBACK is enough 2020-02-02 08:25:06 -06:00