Commit Graph

905 Commits

Author SHA1 Message Date
Xiang Xiao
4444c13c14 arch/sim: The second CPU shouldn't call up_irqinitialize
since the signal handler the process concept

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-17 07:48:27 +09:00
Xiang Xiao
98b5724b59 arch: Fix rtcb can't found error
use the same condition check in declaration and reference

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7b05316e914708fceeddac394d784ee3720a3c1b
2021-07-16 12:48:09 -03:00
Xiang Xiao
3204c75c1d arch/sim: Remove the unused sim_host_timer_handler
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icacbe74308580b7fc2449cdf9e41f85fce43d5a4
2021-07-16 17:41:00 +09:00
Xiang Xiao
cee43ce280 arch/sim: Initialize the idle thread stack info correctly
and change the default value of IDLETHREAD_STACKSIZE to 65536

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia54efbbca4b69706150bc4178844b316688a104e
2021-07-16 08:37:53 +09:00
Xiang Xiao
5fe51b923a mm: Simplify the semaphore handling
1.Move all special process to mm_takesemaphore
2.Remove the support of recurive lock
3.Remove mm_trysemaphore function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie216a6294ab67c5d427f31b089beb15c532f08fe
2021-07-10 16:10:32 -03:00
ligd
f5279f8583 sim: fix loop add delaylist when mm_free in IDLE thread
Change-Id: I1827c663275f47c9dc30d63e17e3d016b0000166
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-10 16:10:32 -03:00
Xiang Xiao
76cdd5c329 mm: Remove mm_heap_impl_s struct
it's more simple to make mm_heap_s opaque outside of mm

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5c8e435f6baba6d22b10c5f7e8d9191104fb5af2
2021-07-07 04:25:15 -07:00
Xiang Xiao
75bfa4584c mm: Add kmm_malloc_size and mm_malloc_size
make malloc_size implementation align with malloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8d7781925f06e58a880437a16569dccbfd2ea035
2021-07-05 14:23:24 +09:00
Xiang Xiao
ddaa3e42b9 mm: Move the real implementation of mm_sbrk to sbrk
and remove mm_sbrk and kmm_sbrk since it's wrong to expose
sbrk to other heaps except the default userspace heap.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-05 08:02:08 +09:00
Xiang Xiao
b3f568c216 boards/sim: Add asan config to test the custom heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:53:44 -03:00
Xiang Xiao
4589c369be arch/sim: Implement mm_mallinfo for the custom heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:53:44 -03:00
Xiang Xiao
8ebf9c92cf arch/sim: Implement malloc_size for the custom heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:53:44 -03:00
Xiang Xiao
f240b2e631 arch/sim: Remove host_malloc and host_calloc
use host_realloc instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:53:44 -03:00
Xiang Xiao
0941bad877 note: Move up_schednote.c to drivers/note folder
since it is general enough to work on other target

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 18:52:32 -03:00
Xiang Xiao
a18b807fa9 arch/sim: Fix bt and audio simulation stop work in SMP mode
by removing the SMP up_idle and sim_timer_handler

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 10:16:12 +09:00
Xiang Xiao
b1f711f790 mm: Move procfs_register_meminfo into common place
to avoid the code duplication and ensure the consistent behaviour

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-03 09:39:32 -07:00
ligd
f479ca9096 sim/smp: fix smp can't start, caused by signal too busy
Change-Id: Ia9cad04759a869f9bed871fa0acd002115eefb0a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 23:19:15 +09:00
ligd
2ab1dcf763 sim: add setitimer to nuttx-names.in
Change-Id: Id6d91d81b3d67cbe9215eb94f4ef394d61156fe8
2021-07-02 05:02:36 -05:00
ligd
a7a8c20083 sim: fix host_sleep unit error
Change-Id: Iaddd6381eb9870b709147d33b36482ae2e37c04d
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 05:02:36 -05:00
ligd
36c1bba88c sim/up_oneshot.c: take host time as current
Change-Id: I34625f3d3f9557a103017124388dba6104aba7cc
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 05:02:36 -05:00
ligd
92cd7628e0 sim: remove CONFIG_SIM_WALLTIME fast timing maybe harmful for IOs
Change-Id: Ic4ff5ec0aa99d2d229a07c4d1a9a4dae738d3cd9
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 05:02:36 -05:00
ligd
aa43a0215d mm: fix memory corruption when loop create/exit thread in SMP mode
Root casue:
when do thread exit, need add free stack operation to mm_delaylist,
but in SMP mode, CPU0 thread1 exit, at this time, CPU1 call malloc
and free mm_delaylist.

Fix:
Divide mm_delaylist for per CPU in SMP mode.

Change-Id: Ibf7d04614ea2f99fb5b506356b7346a0d94f0590
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 04:55:46 -05:00
Xiang Xiao
ae9b5fd306 Replace mktime with timegm in rtc and fs driver
since kernel component should use UTC instead local time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf939e1ab0af8e577105f539d2553bc67b3b3d10
2021-06-23 13:43:32 -03:00
Xiang Xiao
ab974edc84 sched: Identify the stack need to free by TCB_FLAG_FREE_STACK
instead calling kmm_heapmember or umm_heapmember because:
1.The stack supplied by caller may allocate from heap too
2.It's hard to implement these two function in ASan case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I196377822b7c4643ab4f29b7c1dc41dcd7c4dab1
2021-06-18 05:44:41 -07:00
Abdelatif Guettouche
af5e0c620f Rename MODULE_TEXT to TEXT_HEAP as the latter is more generic.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-06-18 07:14:17 -05:00
Xiang Xiao
fa0d123f87 arch: Colorize the idle thread stack in an unified way
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idae8da53e5a4799a8edc0e882f17fd515b70cb14
2021-06-10 06:50:41 -07:00
Alexander Vasiljev
45672c269d Make: use gcc as LD 2021-06-10 03:43:18 -07:00
Xiang Xiao
6576306bca arch: Rename xxx_getsp to up_getsp
All modern desgin support stack pointer and it's also an
important information, so let's standardize this interface.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-09 10:20:02 -07:00
Xiang Xiao
5b2a17b892 Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:06:08 -07:00
Xiang Xiao
2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Xiang Xiao
281921bcf9 arch: Flush syslog buffer for sim and x86_64 arch
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:27:24 +09:00
Xiang Xiao
d7f96003cf Don't include debug.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:42:02 +09:00
chao.an
99bfd355c7 serial/uart/h4: add bt h4 uart serial driver
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 09:50:54 -03:00
chao.an
6c69b12000 wireless/bluetooth: decoupling bt_driver_s and bt_buf_s
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 09:50:54 -03:00
chao.an
6837d4e1ba arch/sim: remove BT uart implement
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 09:50:54 -03:00
Jiuzhu Dong
dab99acfe3 sim/rptun: support multi(>2) core interactive by share memory
N/A

Change-Id: Ia8254bfe369e40a04ed54adfa64afa38974b165c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-30 23:28:40 -05:00
Jiuzhu Dong
73cc1f8884 driver/rtc: add config CONFIG_RTC_RPMSG_SERVER to
N/A
select rtc rpmsg role.

Change-Id: I7f9053b070593573caa5d988c6a2e13593da6bc5
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-15 14:33:52 -03:00
Jiuzhu Dong
f082893b9a driver/rtc: add config RTC_RPMSG_SERVER_NAME to
specified the name of remote proc(rpmsg server)

Change-Id: I0086bb43727a2bbb5e68f88907b5e4608182ef9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-15 14:33:52 -03:00
Jiuzhu Dong
ff567124d3 driver/syslog: add config SYSLOG_RPMSG_SERVER_NAME to
N/A

specified the name of remote proc(rpmsg server)

Change-Id: Ie270d651071e87a40a80ab489597ae18db9814f0
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-15 09:39:57 -03:00
Masayuki Ishikawa
1a9e7efde5 smp: Remove CONFIG_SMP_IDLETHREAD_STACKSIZE
Summary:
- The CONFIG_SMP_IDLETHREAD_STACKSIZE was introduced to optimize
  the idle stack size for other than CPU0
- However, there are no big differences between the idle stacks.
- This commit removes the config to simplify the kernel code

Impact:
- All SMP configurations

Testing:
- Tested with ostest with the following configs
- spresense:smp, spresense:rndis_smp
- esp32-devkitc:smp (QEMU), maix-bit:smp (QEMU)
- sabre-6quad:smp (QEMU), sabre-6quad:netnsh_smp (QEMU)
- raspberrypi-pico:smp, sim:smp (x86_64)

Signed-off-by: Masayuki Ishikawa <asayuki.Ishikawa@jp.sony.com>
2021-04-19 21:46:39 -05:00
YAMAMOTO Takashi
7f307f9765 sim: Restore stack alignemnt
Reapply the following commit [1], which has been reverted by
the recent change [2] with no obvious reasons.

Also, add a comment block to explain the calculation.

[1]
```
commit 298c2e5e4f
Author: YAMAMOTO Takashi <yamamoto@midokura.com>
Date:   Wed Jan 29 03:26:43 2020 +0900

    sim: Fix stack alignment

    The recent x86-64 convention requires 16-byte alignment before
    (not after) calling a function.

    This fixes snprintf crash I observed on macOS while saving XMM registers.
```

[2]
```
commit 2335b69120
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Mon Apr 12 23:44:08 2021 +0800

    arch: Allocate the space from the beginning in up_stack_frame

    arch: Allocate the space from the beginning in up_stack_frame

    and modify the affected portion:
    1.Correct the stack dump and check
    2.Allocate tls_info_s by up_stack_frame too
    3.Move the stack fork allocation from arch to sched

    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
```
2021-04-19 01:29:38 -05:00
Xiang Xiao
2335b69120 arch: Allocate the space from the beginning in up_stack_frame
arch: Allocate the space from the beginning in up_stack_frame

and modify the affected portion:
1.Correct the stack dump and check
2.Allocate tls_info_s by up_stack_frame too
3.Move the stack fork allocation from arch to sched

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-16 12:41:41 +09:00
Alin Jerpelea
08612337f6 NuttX: nxstyle fixes
nxstyle fixes to pass CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-10 06:42:19 -05:00
Alin Jerpelea
231b8518b7 NuttX: Ken Pettit: update licenses to Apache
Ken Pettit has submitted the ICLA and we can migrate the licenses
 to Apache.

Sebastien Lorquet has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-10 06:42:19 -05:00
Masayuki Ishikawa
445770a600 arch: sim: Refactor signal handling
Summary:
- This commit refactors signal handling logic

Impact:
- None

Testing:
- Tested with sim:smp and sim:ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-04-08 01:59:31 -05:00
Xiang Xiao
dd1d980c3a arch/sim: Move setjmp/longjmp to libc/machine/sim
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-05 09:00:42 -03:00
Xiang Xiao
9097244cb8 build: Makefile should reference CONFIG_HOST_xxx
instead to detect the host through uname

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-04-04 23:20:35 -07:00
Xiang Xiao
5f3a98b5a8 libc/assert: Reference the expression in all case
to avoid the warning "defined but not used"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
2021-04-03 21:00:41 +01:00
Alin Jerpelea
08e5378b11 NuttX: Gregory Nutt: update licenses to Apache
Several licenses were missed in the initial work

David Sidrane has submitted the ICLA and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-03 04:20:31 -07:00
raiden00pl
5bff5dc971 motor/foc: use motor debug messages in FOC files 2021-04-01 15:43:49 -03:00
Alin Jerpelea
80ee1864df arch: sim: nxstyle fixes
Nxstyle fixes to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-31 21:12:25 -05:00
Alin Jerpelea
41342c0a12 arch: sim: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-31 21:12:25 -05:00
raiden00pl
168355a40b sim: add the simulated lower-half FOC device 2021-03-31 04:32:26 -05:00
Jiuzhu Dong
1c74d8042a rtc/rpmsg: support server and client to set time each other
Change-Id: I5d13f424cb636a79a9fd98c275786771c213ddb8
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-03-30 22:41:12 -05:00
Matias N
1b8a690b7c sim: only abort sim in assertion if in interrupt context/IDLE task
This fixes the problem that an assertion in sim build aborted NuttX
even when the assertion was generated from userspace (in which case
simpy the task needs to exit). This required moving the relevant code
into the sim blob.
2021-03-29 06:57:18 -06:00
mage1
5340fde427 sim: fix signal deliver calling error on sim platform
since the signal deliver handler should be called in signal owner task.

Change-Id: Ic55c08d1a880069864eddda8dab945ce677792d7
2021-03-25 19:42:31 -07:00
YAMAMOTO Takashi
7f8d0c327b sim: Add dlsym to nuttx-names.in
Fixes the following crash with CONFIG_SIM_SANITIZE=y on Linux.

```
    Program received signal SIGSEGV, Segmentation fault.
    getpid () at task/task_getpid.c:76
    76      task/task_getpid.c: No such file or directory.
    rax            0x2feeb4            3141300
    rbx            0xc53f83            12926851
    rcx            0x6837665ee4c00     1833394399759360
    rdx            0x472080            4661376
    rsi            0xc53f83            12926851
    rdi            0xffffffffffffffff  -1
    rbp            0x7ffe4cdfe140      0x7ffe4cdfe140
    rsp            0x7ffe4cdfe0f0      0x7ffe4cdfe0f0
    r8             0xffffffffffffffff  -1
    r9             0x0                 0
    r10            0x22                34
    r11            0x246               582
    r12            0x472080            4661376
    r13            0x7ffe4cdfe3e8      140730188162024
    r14            0x472080            4661376
    r15            0xf60398            16122776
    rip            0x4e9b93            0x4e9b93 <getpid+35>
    eflags         0x10206             [ PF IF RF ]
    cs             0x33                51
    ss             0x2b                43
    ds             0x0                 0
    es             0x0                 0
    fs             0x0                 0
    gs             0x0                 0
    #0  getpid () at task/task_getpid.c:76
    #1  0x00000000006ad25a in modlib_registry_lock () at modlib/modlib_registry.c:89
    #2  0x0000000000c3648d in modsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at module/mod_modsym.c:77
    #3  0x0000000000c2cd3a in dlsym (handle=0xffffffffffffffff, name=0xc53f83 "mmap") at dlfcn/lib_dlsym.c:149
    #4  0x00000000004a0034 in __interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long) ()
    #5  0x000000000048181e in InitializeCommonInterceptors() ()
    #6  0x000000000048106a in __asan::InitializeAsanInterceptors() ()
    #7  0x000000000049b85e in __asan::AsanInitInternal() ()
    #8  0x00007f09cfb04ce6 in ?? () from /lib64/ld-linux-x86-64.so.2
    #9  0x00007f09cfaf413a in ?? () from /lib64/ld-linux-x86-64.so.2
    #10 0x0000000000000001 in ?? ()
    #11 0x00007ffe4cdfff56 in ?? ()
    #12 0x0000000000000000 in ?? ()
```
2021-03-23 07:27:09 -07:00
YAMAMOTO Takashi
6797826b84 arch/sim/src/sim/up_hostmemory.c: build fix for older macOS versions
I'm still using 10.14 (Mojave) for nuttx related things.

Note: the CI is using 10.15. (Catalina)
2021-03-23 02:48:50 -07:00
Masayuki Ishikawa
083a11a3c3 arch: sim: Fix sim_sigdeliver() for SMP
Summary:
- In the previous implementation, signal handling for SMP was done
  in a critical section that is not correct
- This commit fixes this issue

Impact:
- signal handling for SMP

Testing:
- Tested with ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-03-23 00:41:57 -07:00
mage1
6ff11d8c76 mm: add heap policy and anta logic to support mm debug on sim platform
since atan tool will enhance memory debug operation.

Change-Id: Ic953755faff156832e84b6a764452751dc14f0e3
2021-03-22 11:02:20 -07:00
Alin Jerpelea
bd94263a33 arch: Makefile: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-13 05:56:43 -08:00
YAMAMOTO Takashi
51be5c08bf arch/sim/include/limits.h: Fix the type of LONG_MIN, LONG_MAX, ULONG_MAX 2021-03-12 16:23:26 +08:00
Xiang Xiao
f292b67dce arch/sim: Remove DRVLIB and reuse STDLIBS instead
Change-Id: I5f79eca9039a296eca705d25b3541199a7fbaf9e
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-09 23:33:16 -08:00
Gustavo Henrique Nihei
330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Xiang Xiao
88e3231ed9 arch/sim: Don't remove OPOST in the raw mode
to ensure '\n' from host library output correctly(translate to '\r\n')

Change-Id: I9ce81adb04ca01cfd8a0ec8e8dc85c7fad848601
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-08 08:39:24 -08:00
ligd
d009074ed5 sim/up_uart.c: fix losting uart data when user paste long cmd
N/A

Change-Id: I66c01c0789fc83ae8f6db522d61ff8ab63cd9211
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-03-03 19:05:22 -08:00
Xiang Xiao
418a87af4c arch/sim: Fix typo error(HCITTY->BTUART)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-30 15:43:03 -08:00
Xiang Xiao
39f96361a3 arch/sim: Rename bthcitty driver to btuart driver
align with other soc naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-25 08:23:23 -08:00
Xiang Xiao
503780497a board/sim: Support NuttX BLE stack through uart shim driver
and add new btuart config to test it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-24 19:04:37 -08:00
Xiang Xiao
94da3e4c3a arch: Remove critical section inside up_schedule_sigaction
since nxsig_tcbdispatch already hold it for us

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2fe6ad840bdca3ec0eaa76a9af3b6929c7d5a721
2021-01-22 08:34:07 +01:00
Jiuzhu Dong
f6cfd1c87b vfork: support sim vfork
N/A

Change-Id: I15920bcbacfc5ea519cfe12c39cb64dfe6365838
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-20 08:39:17 -08:00
chao.an
a32856f965 sim/hcitty: remove the poll lock to avoid invalid wait
it it unnecessary to protect pollnotify() since the wakeup
source comes from idle thread

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-19 03:38:15 -08:00
Xiang Xiao
34a300b647 arch/sim: Fix up_hcitty.c:366:20: warning: ‘eventset’ may be used uninitialized
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-18 11:20:06 -03:00
Xiang Xiao
aa37399c89 arch/sim: Extend hcitty_register to accept device name
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-18 11:20:06 -03:00
Xiang Xiao
8c8c30b9d7 arch/sim: Rename g_hcitty_ops to g_bthcitty_ops
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-18 11:20:06 -03:00
Xiang Xiao
db0b661f37 arch/sim: Don't potect recvsem in bthcitty_pollnotify
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-18 11:20:06 -03:00
chao.an
328b7c06bc sim/hcitty: add hcitty adapter
add support to attach the devices via HCI TTY to Bluetooth Host

Reference:

drivers/wireless/bluetooth/bt_uart_shim.c

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-16 21:32:10 -08:00
YAMAMOTO Takashi
27a49331fc sim: Link libc++abi for LIBCXX + macOS 2021-01-14 04:26:12 -06:00
Xiang Xiao
fbc68912b9 arch/sim: Simplify SYMBOL macro definition
Change-Id: I1772b65b9bbe29917885e432056f84921b562eb0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-10 11:10:09 +01:00
chao.an
961532a5da arch/sim/hci: reuse the reserved fields of hci buffer
Reuse the reserved fields of hci buffer to avoid redundant packet type splitting

Change-Id: I79d70ae939111bb909a6e0981c50e401734590f2
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 18:10:04 -08:00
chao.an
2ca99ed1be sim/host/hcisocket: add avail/close interface
Change-Id: I3d96f62c4c3c7d703bfec74952953bee4aef9c7c
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-29 18:10:04 -08:00
dongjiuzhu
b83ae99456 rpmsg_uart: fix compile break when enable rptun
nuttx.rel: In function `rpmsg_serialinit':
nuttx/arch/sim/src/sim/up_rptun.c:257: undefined reference to `uart_rpmsg_init'
collect2: error: ld returned 1 exit status
Makefile:310: recipe for target 'nuttx' failed

Change-Id: I93a20941bc07f749165dc8f012da46ddb7b02b00
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-12-25 21:07:04 +01:00
YAMAMOTO Takashi
e1c53eaeb0 arch/sim/include/irq.h: Make 32-bit xcpt_reg_t unsigned
* 64-bit version is already unsigned

* up_copyfullstate uses unsigned for 32-bit

 Error: sim/up_unblocktask.c:107:33: error: pointer targets in passing argument 1 of 'up_copyfullstate' differ in signedness [-Werror=pointer-sign]
  107 |           up_savestate(rtcb->xcp.regs);
      |                        ~~~~~~~~~^~~~~
      |                                 |
      |                                 xcpt_reg_t * {aka int *}
sim/up_internal.h:133:45: note: in definition of macro 'up_savestate'
  133 | #define up_savestate(regs) up_copyfullstate(regs, (xcpt_reg_t *)CURRENT_REGS)
      |                                             ^~~~
sim/up_internal.h:205:33: note: expected 'uint32_t *' {aka 'unsigned int *'} but argument is of type 'xcpt_reg_t *' {aka 'int *'}
  205 | void up_copyfullstate(uint32_t *dest, uint32_t *src);
      |                       ~~~~~~~~~~^~~~
2020-12-24 21:57:39 -06:00
chao.an
08b22784c3 sim/names: add writev/readv into name list
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-24 11:09:59 -03:00
Brennan Ashton
c6947199b2 Bluetooth: Fix bt_buff lifecycle
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-12-21 23:36:57 -06:00
Masayuki Ishikawa
ec73a4e69c arch & sched: task: Fix up_exit() and nxtask_exit() for SMP
Summary:
- During repeating ostest with sabre-6quad:smp (QEMU),
  I noticed that pthread_rwlock_test sometimes stops
- Finally, I found that nxtask_exit() released a critical
  section too early before context switching which resulted in
  selecting inappropriate TCB
- This commit fixes this issue by moving nxsched_resume_scheduler()
  from nxtask_exit() to up_exit() and also removing
  spin_setbit() and spin_clrbit() from nxtask_exit()
  because the caller holds a critical section
- To be consistent with non-SMP cases, the above changes
  were done for all CPU architectures

Impact:
- This commit affects all CPU architectures regardless of SMP

Testing:
- Tested with ostest with the following configs
- sabre-6quad:smp (QEMU, dev board), sabre-6quad:nsh (QEMU)
- spresense:wifi_smp
- sim:smp, sim:ostest
- maix-bit:smp (QEMU)
- esp32-devkitc:smp (QEMU)
- lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-12-21 23:29:56 -06:00
chao.an
4a559807a5 arch/netdev: try tcp timer in every txavail call
In the current implementation, the first transmission of the new
connection handshake is depends entirely by tcp_timer(), which will
caused 0.5s - 1s delay each time in connect().

This patch is mainly to improve the performance of TCP handshake.

Original:

nsh> tcp_client
[    1.536100] TCP connect start.
[    2.000200] TCP connect end. DIFF: tick: 4641, 464ms.
[    3.000300] TCP connect start.
[    4.000400] TCP connect end. DIFF: tick: 10001, 1000ms.
[    5.000500] TCP connect start.
[    6.000600] TCP connect end. DIFF: tick: 10001, 1000ms.
[    7.000700] TCP connect start.
[    8.000800] TCP connect end. DIFF: tick: 10001, 1000ms.

Optimized:

nsh> tcp_client
[    3.263600] TCP connect start.
[    3.263700] TCP connect end. DIFF: tick: 1, 0ms.
[    4.263800] TCP connect start.
[    4.263800] TCP connect end. DIFF: tick: 0, 0ms.
[    5.263900] TCP connect start.
[    5.263900] TCP connect end. DIFF: tick: 0, 0ms.
[    6.264000] TCP connect start.
[    6.264000] TCP connect end. DIFF: tick: 0, 0ms.
[    7.264100] TCP connect start.
[    7.264100] TCP connect end. DIFF: tick: 0, 0ms.

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-18 14:16:11 +09:00
Xiang Xiao
625eef20f0 arch: Remove the special check for idle thread in up_use_stack
since the idle thread don't call up_use_stack anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-16 09:54:29 +09:00
Xiang Xiao
efee1c6ded arch: Initialize the idle thread stack info directly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-16 09:54:29 +09:00
danguanghua
796217917a fix build break with CONFIG_AUDIO_MULTI_SESSION enabled
N/A

Change-Id: Idfa87031e09f26bd4ca57b5c220ce0ca849f80c4
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2020-12-11 08:04:30 -06:00
Masayuki Ishikawa
f3a81cb1b7 sim: Fix interrupt handling for SMP
Summary
- This commit fixes interrupt handling for SMP
- The following are the changes
- Introduce up_copyfullstate.c
- Add enter_critical_section() to up_exit()
- Add a critical section to up_schedule_sigaction()
- Introduce pseudo timer thread to send periodic events
- UART and interval timer are now handled in the pause handler
- Apply the same SMP related code as other CPU architectures
- However, signal handling and context switching are not changed
- Also enable debug features and some tools in smp/defconfig

Imact
- SMP only

Testing
- Tested with sim:smp on ubuntu18.04 x86_64
- Tested with hello, taskset, smp, ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-12-10 08:33:42 +01:00
Masayuki Ishikawa
ad9f88f042 Revert "Revert "arch/sim: Make the SIGUSR1 host signal to use the NuttX irq logic""
This reverts commit 3098b61776.
2020-12-10 08:33:42 +01:00
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