Commit Graph

1004 Commits

Author SHA1 Message Date
Xiang Xiao
be2f688cd9 Fix net/lib_nametoindex.c:58:7: error: 'strncpy' specified bound 16 equals destination size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-10 19:46:01 +02:00
Huang Qi
69cfe8d626 arch/arm: Support setjmp/longjmp for all socs
After check the official specification of ARM ISA
and Thumb ISA, the arch_setjmp_thumb.S are written
by arm unified assembly language,
so it easy to make it works for ARM and thumb ISA.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-09 17:13:21 +02:00
chao.an
82f90e4c33 libs/vsprintf: fix the type issue
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-09 10:16:54 +02:00
Huang Qi
c6e636a871 arch/risc-v: Save/Load float register in setjmp
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-09 10:15:54 +02:00
Xiang Xiao
01517b2ebe libc/gettext: Support the plural format
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-08 15:57:25 -03:00
Xu Xingliang
f38783f4b5 libc/locale: check if mmap failed before proceeding.
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2022-03-08 15:57:25 -03:00
Xiang Xiao
0e12bf167b libc/stdio: Make %p[V|S|s] work with CONFIG_LIBC_NUMBERED_ARGS
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-08 11:33:54 -03:00
Xiang Xiao
a2e9e83956 libc/stdio: Don't fetch width/prec modifier in parser phase
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-08 11:33:54 -03:00
Xiang Xiao
428ce93ee5 libc/stdio: Skip fetch double argument if !CONFIG_LIBC_FLOATINGPOINT && CONFIG_LIBC_NUMBERED_ARGS
since the argument is already fetched by lib_vsprintf in this case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-08 11:33:54 -03:00
Xiang Xiao
0c01f0ce5a libc/stdio: Add _s suffix for struct arg in lib_libvsprintf.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-08 11:33:54 -03:00
Huang Qi
cfff115f21 arm: Move setjmp to common place
Since some Cortex A core supports thumb mode also,
thus they can share same implementation.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-08 21:00:29 +08:00
Alin Jerpelea
c58ac94450 libs: libc: lib_ubsqrt: migrate license to Apache
Haltian has submitted the SGA as a result can migrate the licenses
to Apache

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2022-03-02 18:14:36 +08:00
Xiang Xiao
4a16cf71f9 Fix -Werror=nonnull-compare and -Werror=format-truncation=
Error: module/mod_insmod.c:203:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
  203 |   strncpy(modp->modname, modname, MODLIB_NAMEMAX);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wqueue/kwork_thread.c: In function 'work_start_lowpri':
Error: wqueue/kwork_thread.c:212:22: error: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Werror=format-truncation=]
  212 |   snprintf(args, 16, "0x%" PRIxPTR, (uintptr_t)wqueue);

local/local_sockif.c: In function 'local_getsockname':
Error: local/local_sockif.c:392:11: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  392 |           strncpy(unaddr->sun_path, conn->lc_path, namelen);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

chip/esp32_wifi_utils.c: In function 'esp_wifi_scan_event_parse':
Error: chip/esp32_wifi_utils.c:373:37: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
   memset(ap_list_buffer, 0x0, sizeof(ap_list_buffer));
                                     ^

stdio/lib_fputs.c: In function 'fputs':
Error: stdio/lib_fputs.c:99:9: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
         ^
Error: stdio/lib_fputs.c:99:27: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
                           ^

stdio/lib_vfprintf.c: In function 'vfprintf':
Error: stdio/lib_vfprintf.c:40:6: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (stream)
      ^

string/lib_strdup.c: In function 'strdup':
Error: string/lib_strdup.c:39:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strndup.c: In function 'strndup':
Error: string/lib_strndup.c:56:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strpbrk.c: In function 'strpbrk':
Error: string/lib_strpbrk.c:39:7: error: nonnull argument 'str' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
       ^~~~
Error: string/lib_strpbrk.c:39:15: error: nonnull argument 'charset' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
               ^~~~~~~~

string/lib_strrchr.c: In function 'strrchr':
Error: string/lib_strrchr.c:40:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

Error: time/lib_asctimer.c:73:50: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 12 [-Werror=format-truncation=]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                                                  ^~
time/lib_asctimer.c:73:21: note: directive argument in the range [-2147481748, 2147483647]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
time/lib_asctimer.c:73:3: note: 'snprintf' output between 17 and 68 bytes into a destination of size 26
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            g_wday_name[tp->tm_wday], g_mon_name[tp->tm_mon],
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            1900 + tp->tm_year);
            ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-02 15:55:38 +08:00
Xiang Xiao
da954956e7 Simplify DEFAULT_SMALL usage in Kconfig
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-01 03:15:01 +08:00
Oki Minabe
fbf05db906 fix up_tls_info define for BUILD_KERNEL
Summary:
- In case of BUILD_KERNEL, NuttX uses USR mode sp and SVC mode sp.
- The kernel runs on SVC mode sp.
- While the kernel is running, up_getsp() cannot get the TLS address.
- The kernel requires tls_get_info() function.
- For the user land, up_getsp() can be used.
- tls_getinfo.c is always compiled and tls_get_info() function is
  filtered by macros in the tls_getinfo.c.

Impact:
BUILD_KERNEL

Testing:
test program on custom Cortex-A9 board (BUILD_KERNEL)
ostest on sabre-6quad:smp (QEMU, BUILD_FLAT)

Signed-off-by: Oki Minabe <minabe.oki@gmail.com>
2022-02-28 01:12:58 +08:00
Masayuki Ishikawa
de95a8550f arch, board: Add thumb support to i.MX6
Summary:
- This commit adds thumb support to i.MX6
- Also, applies the same coding style to arch_elf.c

Impact:
- i.MX6 only

Testing:
- Tested with sabre-6quad:smp (QEMU, Dev board)
- Tested with sabre-6quad:netnsh (QEMU)
- Tested with sabre-6quad:netknsh (QEMU, not merged yet)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-25 10:51:12 +08:00
Masayuki Ishikawa
11731125ef libs: armv7-a: Add thumb support to arch_elf.c
Summary:
- This commit adds thumb support to arch_elf.c

Impact:
- None

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

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-02-25 10:51:12 +08:00
zhuyanlin
1aedf30f38 libc:machine:xtensa: fix warning
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-02-24 22:13:46 +08:00
Huang Qi
e516c6247e sched: Implement task local storage
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-23 22:05:02 +08:00
Huang Qi
18227cbeff libc/tls: Supports up to 64 elements
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-23 22:05:02 +08:00
Xiang Xiao
f1ed349dd9 sched/clock: Remove CLOCK_MONOTONIC option from Kconfig
here is the reason:
1.clock_systime_timespec(core function) always exist regardless the setting
2.CLOCK_MONOTONIC is a foundamental clock type required by many places

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:26 +08:00
Petro Karashchenko
9b02a91c72 libc/sched/task_setcanceltype: fix function name in comment
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-21 20:32:49 +08:00
Xiang Xiao
928d52f315 libc/machine: Implement ARM aeabi_xxx API called by clang
specified here:
https://developer.arm.com/documentation/ihi0043/latest

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-21 09:29:18 +01:00
Xiang Xiao
1d1bdd85a3 Remove the double blank line from source files
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-20 20:10:14 +01:00
Huang Qi
f452dd7ab4 sched: Mark pthread as non-cancelable to avoid additional calls to pthread_exit()
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-20 15:36:07 +01:00
raiden00pl
4e27f4a1d2 libdsp: port lib_observer.c to b16 2022-02-20 21:58:10 +08:00
raiden00pl
7126b829af libdsp/lib_observer.c: cosmetics 2022-02-20 21:58:10 +08:00
raiden00pl
1366e14192 libdsp: initialize flux_link in params, remove flux_link from pmsm_phy_params 2022-02-20 21:58:10 +08:00
raiden00pl
ca4790c429 libdsp: add one_by_p to motor_phy_params 2022-02-20 21:58:10 +08: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
Peter Kalbus
6abdf73535 sim: Initial support on MacOS M1 and Linux AARCH64 based hosts. 2022-02-17 09:35:09 +08:00
Oki Minabe
c1ea37742b fix arm FPSCR typos in comments. 2022-02-17 01:08:11 +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
zouboan
2391e4bd71 Update libs/libdsp/lib_observer.c
Co-authored-by: Mateusz Szafoni <raiden00pl@gmail.com>
2022-02-14 10:47:15 -03:00
zouboan
132f27a91a lib_observer: add nolinear fluxlink observer 2022-02-14 10:47:15 -03:00
Xiang Xiao
47e38eb70f binfmt: Decouple builtin from binfs file system
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-14 09:35:35 -03:00
Xiang Xiao
34baf47307 libc: posix_openpty should use the absolute path("dev/ptmx")
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-14 08:43:05 +09:00
Zeng Zhaoxiu
5bf7c185af semphore: release all semphores' holder that the task held when exit
Add a list in TCB to track all semphores the task held, so we
can release all holders when exit, so nxsched_verify_tcb
is unnecessary.

Signed-off-by: Zeng Zhaoxiu <walker.zeng@transtekcorp.com>
2022-02-13 03:20:51 +08:00
anjiahao
ce3c604f48 libc/chdir:"PWD" should save absolute path
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-02-11 13:05:20 +01:00
Huang Qi
8bf7f94d39 pthread: Call cleanup callback while asyncrhonous cancel
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Huang Qi
c0a0de97ce Revert "libc: Call pthread_exit in user-space by up_pthread_exit"
This reverts commit f4a0b7aedd.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Huang Qi
63aa11ca11 libc/spawn: Fix typo in comments
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 01:39:45 +08:00
Xiang Xiao
4ee5ff81dd pthread: Add len argument to pthread_getname_np
follow the spec:
https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 08:19:17 +01:00
Xiang Xiao
0ff29e8f10 libc/stdlib: Compile lib_openpty.c without checking CONFIG_SERIAL_TERMIOS
follow up the following change:
commit 4262b09cbf
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Fri Dec 17 02:58:49 2021 +0800

    libc: Implement terminal api regardless of CONFIG_SERIAL_TERMIOS setting

    since many functions aren't related to termios directly

    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-03 22:51:28 +01:00
Xiang Xiao
57c3fce583 libc: Implement posix_openpt
specify here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_openpt.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-03 11:02:31 -03:00