Commit Graph

44179 Commits

Author SHA1 Message Date
chao.an 1911ae2192 net/tcp: add interface tcp_wrbuffer_timedalloc()
add new interface to support alloc wrbuffer with timeout

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 21:27:39 +01:00
chao.an a92d5f622e net/ioballoc: add support of alloc with timeout net_iobtimedalloc()
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 21:27:39 +01:00
Piet 8828a43219 Default macro to compile one Rust file 2022-02-17 15:35:27 -03:00
chao.an c73df52c46 net/socket: fix shadow variable
socket/setsockopt.c: In function ‘psock_socketlevel_option’:
socket/setsockopt.c:168:38: warning: declaration of ‘conn’ shadows a previous local [-Wshadow]
  168 |               FAR struct tcp_conn_s *conn;
      |                                      ^~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 17:55:16 +01:00
chao.an 0b18cfbd9a mm/iob: add support of alloc with timeout iob_timedalloc()
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 11:55:29 -03:00
chao.an 4824ea68a9 libs/libnx: handle the bad message correctly
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-17 13:40:11 +01:00
Petro Karashchenko 7933442b98 sched/semaphore/sem_clockwait: fix typo in comment
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-17 12:54:49 +01:00
Masayuki Ishikawa 41d62033a0 mm: umm_heap: Fix umm_heap for BUILD_KERNEL & ADDRENV
Summary:
- I noticed that the user heap is corrupted
- This commit fixes this issue by reverting the change to
  the NuttX-9.0.0

Impact:
- None

Testing:
- sabre6-quad:netknsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Co-authored-by: Oki Minabe <minabe.oki@gmail.com>
2022-02-17 11:31:01 +01:00
Masayuki Ishikawa a44a0a08cd binfmt: Call umm_initialize() for BUILD_KERNEL & ADDRENV
Summary:
- I noticed that the user heap is not initialized correctly
  if BUILD_KERNEL=y and ADDRENV=y
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with sabre-6quad:netknsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-17 11:31:01 +01:00
lp.xiao bc12260540 dp83848c ethernet phy interrupt support 2022-02-17 08:00:53 +01:00
Xiang Xiao 69a6072946 arch/ceva: Replace adj_stack_ptr with stack_base_ptr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-17 11:06:09 +09:00
Xiang Xiao 814cab1cd1 arch/ceva: Mark the allocated stack with TCB_FLAG_FREE_STACK
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-17 11:06:09 +09:00
Xiang Xiao f8df491d5d arch/ceva: Update tls handle to the latest mainline
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-17 11:06:09 +09:00
Xiang Xiao 4bc5b246ac arch/ceva: Remove B2C and C2B
since TL420 doesn't support anymore, we
can safely remove the special hack for it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-17 11:06:09 +09:00
YAMAMOTO Takashi 85af0f37ad arch/sim/src/Makefile: Fix build issues with clang on linux
This commit fixes at least two issues.

* Fix a build with clang on linux

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

* Restore symbol renaming for clang on linux

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

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

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

```
2022-02-17 09:36:20 +08:00
YAMAMOTO Takashi 7fcfe40821 arch/sim/src/Makefile: Fix whitespace 2022-02-17 09:36:20 +08:00
Peter Kalbus 6abdf73535 sim: Initial support on MacOS M1 and Linux AARCH64 based hosts. 2022-02-17 09:35:09 +08:00
Xiang Xiao 1d963058b4 arch/sparc: Replace adj_stack_ptr with stack_base_ptr
since adj_stack_ptr doesn't exist anymore

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-16 17:19:43 -03:00
Xiang Xiao 844ce47a2b sim/nimble: Enable assert
until this patch get merged:
https://github.com/apache/mynewt-nimble/pull/1161

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-16 12:03:07 -08:00
Xiang Xiao d056834605 Add CONFIG_NDEBUG Kconfig to control NDEBUG definition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-16 12:03:07 -08:00
Alan Rosenthal 8defb843aa Remove duplicate linker script definitions
## Summary
A lot of linker scripts were listed twice, once for unix, once for windows.

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

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

 ## Testing
CI will test all build
2022-02-17 02:55:25 +08:00
Oki Minabe 68a305438b fix armv7-a gtm.h GTM_COMP1 and GTM_AUTO defines. 2022-02-16 18:50:42 +01:00
Huang Qi f40a673fdf boards/rv-virt: Supports FPU test and ostest in both rv32/rv64
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-17 01:09:51 +08:00
Oki Minabe c1ea37742b fix arm FPSCR typos in comments. 2022-02-17 01:08:11 +08:00
raiden00pl 7675be7a09 include/nuttx/motor: add registers definitions for DRV8301 - 3-phase smart gate driver
This is intended to use in a board-specific logic and depends highly on a custom application.
That's why no common driver logic is provided for now.
2022-02-17 01:07:59 +08:00
Simon Filgis cf008c94cc arch/arm/samv7: fix peripheral id shift during transmit xdma configuration 2022-02-16 17:16:53 +01:00
Huang Qi ccc708a142 vncserver: Fix dead lock on re-connect
`vnc_remove_queue` would waiting for new frame update request forever
even if the connection is lost, the updater thread wouldn't exit.
But the server thread will join updater thread before accept new client
connection, then we can't re-conncet to vnc server.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-16 22:57:21 +08:00
ligd 0169a51220 mm: handle take mm sem in IRQ
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-16 09:53:42 -03:00
Masayuki Ishikawa b60b6120de arch: armv7-a: Fix arm_syscall for SYS_pthread_start
Summary:
- I noticed that pthread always crashes when started
  if CONFIG_BUILD_KERNEL=y
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with sabre-6quad:netknsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-16 13:06:25 +01:00
Petro Karashchenko 41c95da594 register_driver: fix driver modes accross the code
State of problem:
 - Some drivers that do not support write operations (does not
   have write handler or ioctl do not perform any write actions)
   are registered with write permissions
 - Some drivers that do not support read operation (does not
   have read handler or ioctl do not perform any read actions)
   are registered with read permissions
 - Some drivers are registered with execute permissions

Solution:
 - Iterate code where register_driver() is used and change 'mode'
   parameter to reflect the actual read/write operations executed
   by a driver
 - Remove execute permissions from 'mode' parameter

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-16 16:15:29 +08:00
YAMAMOTO Takashi 1d89d9ae4b libc.csv: Add pthread_setname_np and pthread_getname_np 2022-02-16 15:09:14 +08:00
Xiang Xiao 5f67662c63 libc/sim: Rename arch_setjmp[64].S to arch_setjmp_x86[_64].S
to follow other arch/x86 arch/x86_64 convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-16 12:23:16 +08:00
Mateusz Szafoni 5f50547ced libdsp: cosmetics changes from code review
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-16 03:20:20 +08:00
raiden00pl 31ffa6d576 libdsp/lib_observer.c: remove dir argument from speed observers
We can automatically detect the direction of movement from angle diff
2022-02-16 03:20:20 +08:00
raiden00pl 01cbe9133e libdsp/lib_observer.c: update some comments
The angle observer always refer to a motor electrical angle,
while the speed observer can be applied to a motor electrical speed or a motor mechanical speed.
2022-02-16 03:20:20 +08:00
raiden00pl 26f1be27dd libdsp/lib_observer.c: separate angle observer from speed observer
They can be used completely independently, so they should'n be coupled.
For example, a sensored motor controller in speed control mode doesn't need an angle estimator.
2022-02-16 03:20:20 +08:00
Michael Jung fd8b087012 Fix JLinkGDBServer crash attaching to target
If attaching to a target that is already running JLinkGDBServer calls
RTOS_GetNumThreads() without a prior call to RTOS_UpdateThreads().  So
do this within RTOS_GetNumThreads() if g_plugin_priv.ntcb has not yet
been initialized.

Note: If after attaching the debugger to the target, the target is
resumed and then stopped again, the RTOS_UpdateThreads is actually
called.  Thus, we are not running on stale thread data in this case.

I also changed PLUGIN_VER to API_VER and its value to 101, as
RTOS_GetVersion() does not query the version of the plugin, but the API
version implemented by the plugin, which in our case is 1.1.

Signed-off-by: Michael Jung <mijung@gmx.net>
2022-02-15 23:05:15 +08:00
Xiang Xiao db57e2cd8e Fix the minor style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-15 15:26:38 +01:00
Xiang Xiao b0fa232918 boards: Remove -D__NuttX__ from the individual Make.defs
since it is defined globally in tools/Config.mk now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-15 15:26:38 +01:00
Michael Jung 0a37744826 Fix jlink-nuttx build with GCC 10.2
The packed-attribute on the tcb_info_s type was misplaced, which caused
incompatible memory layout between host and target.  According to
current GCC documentation:

> You may specify type attributes in an enum, struct or union type
> declaration or definition by placing them immediately after the struct,
> union or enum keyword.  You can also place them just past the closing
> curly brace of the definition, but this is less preferred because
> logically the type should be fully defined at the closing brace.

I also added jlink-nuttx.so to the .gitignore list and updated nxstyle
to ignore the camel case function names required by JLinkGDBServer.

Signed-off-by: Michael Jung <mijung@gmx.net>
2022-02-15 13:48:52 +01:00
Masayuki Ishikawa 34cf6949ac arch: armv7-a: Add debug messages for addrenv
Summary:
- This commit adds debug messages for addrenv

Impact:
- None

Testing:
- Tested with sabre-6quad:netknsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-15 17:22:52 +08:00
Masayuki Ishikawa e7cb1b4fb1 arch: rt8920c: Move -fno-common option to ARCHCFLAGS/ARCHCXXFLAGS
Summary:
- Apply the same style as sabre-6quad

Impact:
- None

Testing:
- Build only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-15 16:27:53 +08:00
Masayuki Ishikawa 613cbbf688 boards: risc-v: Move -fno-common option to ARCHCFLAGS/ARCHCXXFLAGS
Summary:
- Apply the same style as sabre-6quad

Impact:
- None
- NOTE: esp32c3-devkit still remains old style because of link errors

Testing:
- Build only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-15 16:27:53 +08:00
Masayuki Ishikawa 85a339eb66 boards: sama5d4-ek: Move -fno-common option to previous ARCHCFLAGS/ARCHCXXFLAGS
Summary:
- Apply the same style as sabre-6quad

Impact:
- None

Testing:
- Build only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-15 16:27:53 +08:00
Masayuki Ishikawa de8f442d84 boards: sabre-6quad: Add -fno-common to Make.defs
Summary:
- I noticed that the following error happened when loading the init
  'elf_symvalue: SHN_COMMON: Re-compile with -fno-common'
- This commit fixes this issue

Impact:
- sabre-6quad only

Testings:
- Tested with sabre-6quad:netknsh (not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-15 16:27:53 +08:00
Xiang Xiao 6b02e32904 arch/sim: Remove 08 from the format string in up_vfork
to make the code more general for both x86 and x64.

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

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-15 06:44:21 +01:00
Petro Karashchenko a1f6717e2a mtd/filemtd: improve write and erase access
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-15 12:06:24 +08:00
Huang Qi 5cde8c6934 risc-v: Let g_cpu_basestack determined at compile time
Fix the CPU1 idle tasks stack corruption since the cpux's idle stack
is loaded from g_cpu_basestack (data section) before, but on this time
it maybe not ready since it is initialized by CPU0, and the value
from g_cpu_basestack is random.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-15 11:40:34 +09:00
Huang Qi 0d7f30c86d risc-v/k210: Move wfi to entry of the slave cpu boot routine
Fix another potential bug in non-smp case: load a value from overflowed address of g_cpu_basestack.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-15 11:40:34 +09:00