Commit Graph

1720 Commits

Author SHA1 Message Date
SPRESENSE
63182d43b9 libm/newlib: Change the download site to https
Change newlib download site from ftp to more secure https.
2023-11-10 16:28:13 +08:00
zhanghongyu
234dd95e0b libc_atomic: add file to cmake script
resolves an error where atomic related symbols cannot be found at cmake compile time.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-07 17:39:03 +01:00
zhanghongyu
c831c8cc56 cmake: add needed file to cmake script for build sim
nuttx/crypto/chachapoly.c:232: undefined reference to `timingsafe_bcmp'

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-07 17:39:03 +01:00
zhanghongyu
766e4a4154 libs/libc: adapt the cmake script from the makefile
fix the cmake build error.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-07 17:39:03 +01:00
chao an
d410a6e1a6 libc/realpath: allocate link buffer of pseudofs to save stack
The link buffer of pseudofs will occupy too much of stack, allocate from
the heap to save the stack usage.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-07 09:05:50 +08:00
Stuart Ianna
c1db9732c5 libs/libc/spawn: Add minimal implementation for posix_spawnattr_destory.
Add a minimal implementation to suppress warnings when building
application code shared with other operating systems.

For example:

When building with a c++ compiler and GCC 12.2.0, the following warning is emitted:

nuttx/include/spawn.h:178:40: warning: statement has no effect [-Wunused-value]
  178 | #define posix_spawnattr_destroy(attr) (0)
2023-10-31 13:42:00 +08:00
dongjiuzhu1
489bd15271 arch/arm64: support relocate for aarch64
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-30 18:20:22 +08:00
raiden00pl
5b87fdfb9d Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
Xiang Xiao
7aad7eebff libc: Change errno to set_errno and get_errno
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-29 17:16:09 +02:00
Xiang Xiao
f911d3a1c3 stdio: Implement [clearerr|putc|fflush]_unlocked
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-29 17:09:18 +02:00
Xiang Xiao
2c9511e655 libc/stdio: Remove bforce from lib_fflush[_unlocked]
since all callers set bforce to true

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-29 17:09:18 +02:00
Xiang Xiao
c3be772441 libc/stdio: lib_fwrite_unlocked must call lib_fflush_unlocked with true
otherwise the following file i/o mess up the output

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-29 17:09:18 +02:00
dongjiuzhu1
5c98649a7a libs/lib_psfa_adddup2.c: remove workaround aboud dup2
Because popen no longer needs to rely on intermediate
tasks to start command tasks.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-27 21:15:07 +08:00
Michal Lenc
65ae8a545c libc: add support for memory buffer stream with fmemopen()
Add support for POSIX interface fmemopen(). This interface open a memory
buffer as a stream and permits access to this buffer specified by mode.
This allows I/O operations to be performed on the memory buffer.

The implementation uses fopencookie() for custom stream operations and
callbacks.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-10-27 08:55:24 +08:00
simbit18
8f96e59aee libs/libc/stdlib/lib_exit.c: fix multiple definition of __dso_handle in msys2
CPP:  nuttx-names.in-> nuttx-names.dat
LD:  nuttx
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: nuttx.rel:/d/a/nuttx_windows/nuttx_windows/nuttxspace/nuttx/libs/libc/stdlib/lib_exit.c:48: multiple definition of `__dso_handle'; /usr/lib/gcc/x86_64-pc-msys/13.2.0/crtbegin.o:cygming-crtbeg:(.data+0x0): first defined here
2023-10-27 01:21:10 +08:00
xuxin19
e3003f691b cmake:init RISC-V cmake qemu-rv build
cmake currently does not support non-FlatBuild,
need disable ELF and LOADABLE when compiling other defconfigs

```
 cmake -B build -DBOARD_CONFIG=rv-virt/smp64 -GNinja # for rv32:rv-virt/smp
 cmake --build build -t menuconfig
 cmake --build build
 qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -smp 8 -bios none -kernel nuttx -nographic
```

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-10-26 21:01:46 +08:00
Stuart Ianna
ad9f6b79e0 libs/libcxx: Silence warnings when building libcxx.
Silence two warnings when building libcxx with GCC 12.2.0 and std=c++2b:

libcxx/src/charconv.cpp_CXXFLAGS += -Wno-attributes
 - Results from libcxx fallback to use __always_inline__ when exclude_from_explicit_instantiation isn't available.

libcxx/src/locale.cpp_CXXFLAGS += -Wno-attributes
 - Results from the expansion of _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS. Should be fine to ignore.
2023-10-26 09:07:17 +02:00
dongjiuzhu1
a7e448c57e modlib/modlib_load: fix compile warning
CC:  icmp/icmp_input.c modlib/modlib_load.c: In function 'modlib_elfsize':
modlib/modlib_load.c:87:30: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   87 |                   textaddr = (FAR void *)phdr->p_vaddr;
      |                              ^
cc1: all warnings being treated as errors

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 01:53:38 +08:00
dongjiuzhu1
db13ff2dd5 libs/libc: fix compile warning about modlib_depend when CONFIG_MODLIB_MAXDEPEND = 0
modlib/modlib_symbols.c: In function ‘modlib_symcallback’:
modlib/modlib_symbols.c:215:13: warning: implicit declaration of function ‘modlib_depend’; did you mean ‘modlib_read’? [-Wimplicit-function-declaration]
  215 |       ret = modlib_depend(exportinfo->modp, modp);
      |             ^~~~~~~~~~~~~
      |             modlib_read

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 01:53:38 +08:00
dongjiuzhu1
e88a36fa92 libs/modlib: Adding architecture-specific memory allocator for dynamic data loading
Arch can specific the memory allocator for data to optimize access speed.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 01:53:38 +08:00
dongjiuzhu1
81717a59ea libs/modlib: remove dupliate define about modlib_dumpbuffer
CP:  nuttx/include/nuttx/config.h
modlib/modlib_init.c:53: warning: "modlib_dumpbuffer" redefined
   53 | #  define modlib_dumpbuffer(m,b,n) binfodumpbuffer(m,b,n)
      |
In file included from modlib/modlib_init.c:36:
nuttx/include/nuttx/lib/modlib.h:64: note: this is the location of the previous definition
   64 | #  define modlib_dumpbuffer(m,b,n) sinfodumpbuffer(m,b,n)
      |

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 01:53:38 +08:00
dongjiuzhu1
fbd6484532 libc/localtime: fix the timezone error caused by minor error
align: https://github.com/eggert/tz/blob/main/localtime.c

correct timeone in test:

server> timedatectl set-timezone Pacific/Auckland
server> timedatectl
      TimeZone: NZDT, 46800
    Local time: Sat, Oct 21 21:47:34 2023 NZDT
Universal time: Sat, Oct 21 08:47:34 2023 UTC
      RTC time: Sat, Oct 21 08:47:35 2023

error timezone:

server> timedatectl set-timezone Pacific/Auckland
server> timedatectl
      TimeZone: NZST, 43200
    Local time: Sat, Oct 21 20:52:27 2023 NZST
Universal time: Sat, Oct 21 08:52:27 2023 UTC
      RTC time: Sat, Oct 21 08:52:27 2023

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 00:10:04 +08:00
Xiang Xiao
1883b91e3c libc: Remove the unused lib_libdtoa.c
__dtoa is not used because currently NuttX uses other
function called __dtoa_engine() to do the same thing

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-23 20:06:34 -03:00
Xiang Xiao
66db15437d libc/stdio: Change FILE buffer field from "unsigned char *" to "char *"
to avoid the unnecessary casting

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-22 21:18:46 +03:00
raiden00pl
eed42a12ed libds: add missing observer_b16.c to cmake build 2023-10-19 01:18:40 +08:00
Michal Lenc
0a107ca6d9 libc: add support for custom streams with fopencookie()
This commit adds support for custom stream via fopencookie function.
The function allows the programmer the create his own custom stream
for IO operations and hook his custom functions to it.

This is a non POSIX interface defined in Standard C library and implemented
according to it. The only difference is in usage of off_t instead of
off64_t. Programmer can use 64 bits offset if CONFIG_FS_LARGEFILE is
enabled. In that case off_t is defined as int64_t (int32_t otherwise).

Field fs_fd is removed from file_struct and fs_cookie is used instead
as a shared variable for file descriptor or user defined cookie.

The interface will be useful for future fmemopen implementation.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-10-18 21:13:01 +08:00
Xiang Xiao
b1c8c84e81 stdio: Merge fs_fdopen into fdopen to simplify the code logi
since fs_fdopen could avoid call the kernel specific function now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-17 13:34:00 +08:00
Xiang Xiao
b0d197534f stdio: Move lib_stream_[initialize|release] from libc/stdio to sched/tls
both functions aren't suitable to be put into libc,
because they call the kernel internal functions directly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-17 13:34:00 +08:00
Xiang Xiao
b892ec5c6e libc/machine: Remove FAR from sparc
since sparc is 32bit arcch, FAR is useless

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-17 13:15:48 +08:00
raiden00pl
8bdb78b446 libdsp/lib_observer.c: use float numbers in all calculations
we want to use FPU instructions in calculations not __aeabi
2023-10-15 10:43:37 -04:00
liqinhui
602c644f4d netdb: When set a dns nameserver, if the nameserver already exists, retrun OK.
We consider the setting successful when the namesaerver we set already exists.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-10-12 12:22:16 +08:00
hujun5
99eeaafd07 lib_memfd: turn a runtime error into a linker error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-11 23:39:37 +08:00
Lee Lup Yuen
6cad7e9582 arm, arm64, xtensa, libxx: Change sed -r to sed -E to support macOS
When we build NuttX on macOS, it shows many `sed` messages (and the build still completes successfully):

```text
$ tools/configure.sh pinephone:nsh
$ make
sed: illegal option -- r
```

This is due to the Makefiles executing `sed -r` which is not a valid option on macOS.

This PR proposes to change `sed -r` to `sed -E` because:

- `sed -E` on macOS is equivalent to `sed -r` on Linux

- `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual

- `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake and process_config.sh
2023-10-10 11:36:32 +03:00
raiden00pl
4f8a2b3874 libds/lib_misc: use b16abs() 2023-10-07 21:25:56 +08:00
raiden00pl
819bec0888 libdsp/lib_observe: fix typo and use b16sign() 2023-10-07 21:25:56 +08:00
Xiang Xiao
dfa0283d83 spinlock: Rename spin_islocked to spin_is_locked
align with Linux naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-06 20:03:19 -04:00
Xiang Xiao
aa0b3fcdf9 lib/memfd: shm_unlink or unlink anonymous file
https://man7.org/linux/man-pages/man2/memfd_create.2.html:
       The name supplied in name is used as a filename and will be
       displayed as the target of the corresponding symbolic link in the
       directory /proc/self/fd/.  The displayed name is always prefixed
       with memfd: and serves only for debugging purposes.  Names do not
       affect the behavior of the file descriptor, and as such multiple
       files can have the same name without any side effects.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-06 20:02:30 -04:00
SPRESENSE
bf6606f80c libxx: Use gnu++20 option only if using libcxx
Fix an issue that gnu++20 option is always used.
Essentially, when cxx is not used, gnu++17 should be retained.
2023-10-05 13:09:20 +08:00
hujun5
b6693065e7 pthread_once: g_lock may lead deadlock
For programs with the dependencies logic in pthread_once callback , using global locks may cause deadlock:

task A
pthread_once()
|
|-> nxrmutex_lock(&g_lock);
 -> init_routine(); // callback to wait task B
                                                  task B
                                                  pthread_once()
                                                  |
                                                   ->nxrmutex_lock(&g_lock); // Deadlock
                                                   ->init_routine(); // hold resource to wake up task A

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-09-26 10:13:00 +08:00
Xiang Xiao
b172de378d Fix make[1]: *** No rule to make target '.header', needed by 'context'. Stop.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-25 23:29:05 +08:00
Xiang Xiao
06619ac6fc lib/netdb: Change the default NETDB_DNSCLIENT_NAMESIZE to PATH_MAX
Domain name has the similar layout as file path, so it's too small
to use 32 bytes as the default value, and better to has the same
default value as PATH_MAX which is 255.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 19:32:25 -04:00
Xiang Xiao
b383c31089 libc: Add bsearch to libc.csv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-25 01:08:15 +03:00
Xiang Xiao
381c7dd747 Fix error: unknown warning option '-Wno-unqualified-std-cast-call'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
Stuart Ianna
4f90a6140c libcxx: Remove exiting patches and update libcxx version to 15.0.7
- Add __config_site for NuttX.
   In libcxx 12.0.0. CMake concatenated __config_site with _config,
   which enabled NuttX to build without its inclusion. In 15.0.7, this
   file is configured by CMake and included explicitly in __config.
 - Add additional include directories.
 - Mute always_inline warning.
 - Make the download of libcxx/libcxxabi configurable
2023-09-24 08:40:10 +03:00
Xiang Xiao
d6453cfc3c libxx: Change the default value of CXX_STANDARD to gnu++20
since llvm libcxx 15.0.7 require c++20 feature to pass the build

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
zhanghongyu
a41f68da84 dns: fix dns failed when ipv4/6 dual stack enable
The ipv6 address filled the cache, and the ipv4 address did not have a
place to store it, causing the resolution to fail. so if IPV6 has already
filled the buffer, rewrite ipv4 DNS results from half of the buffer.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-09-23 15:56:05 +08:00
wangyongrong
2d817deecb armv8m/strcpy: add arch optimize version 2023-09-22 08:52:25 +08:00
guoshichao
abfb7da553 libs/libc/libc.csv: add the implemented wchar api declaration
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
5bd8e56cbe libs/libc/wchar: add fputws implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
d67090c47e libs/libc/wchar: add putwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
a9b2857754 libs/libc/wchar: add putwchar implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
f8b5f613e2 libs/libc/wchar: add fputwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
d386df4424 libs/libc/wchar: add wcswidth implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
7c0685c53d libs/libc/wchar: add wcwidth implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
f9c8461c72 libs/libc/wchar: add wcswcs implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
199bc57035 libs/libc/wchar: add wcstok implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
9070743fe8 libs/libc/wchar: add wcsstr implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
20802fcf5c libs/libc/wchar: add wcsspn implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
181a2d916d libs/libc/wchar: add wcspbrk implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-22 08:51:07 +08:00
guoshichao
2abb760564 libs/libc/wchar/CMakeList: update the cmake to add the wchar impl
add lib_wcsrtombs.c lib_wcscpy.c lib_wcscat.c lib_wcslcat.c
lib_wcsncat.c lib_wcsrchr.c lib_wcschr.c lib_wcsncpy.c
lib_wcsncmp.c lib_wcscspn.c file

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
e2962e84c5 libs/libc/wchar: add wcsspn implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
899f170826 libs/libc/wchar: add wcsncmp implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
ae4303da2f libs/libc/wchar: add wcsncpy implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
34346e38e1 libs/libc/wchar: add the wcschr implementatioin
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
206cd96426 libs/libc/wchar: add wcsrchr implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
cd19acee76 libs/libc/wchar: add wcsncat implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
4f9d304591 libs/libc/wchar: add wcslcat implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
0a1708dbb2 libs/libc/wchar: add wcscat implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
guoshichao
4b1c0220d3 libs/libc/wchar: add wcscpy implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-09-21 14:02:18 +08:00
hujun5
4268b2e297 pthread_once: use rmutex replace sched_[un]lock
sched_[un]lock can not prohibit pre-emption in smp

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-09-21 00:42:29 +08:00
Neale Ferguson
5d7f2fdf16 Fix loading of ET_DYN type of shared objects
* build-globals.sh
  - Only look in the nuttx for external symbols used when loading
    dynamic shared objects

* include/elf64.h
  - Correct the type of fields in the Elf64_Phdr structure

* libs/libc/dlfcn/lib_dlclose.c
  - Distinguish between ET_DYN and other objects as the former
    has both text and data in a single allocation to reserve
    GOT offsets

* libs/libc/dlfcn/lib_dlopen.c
  - Code formatting

* libs/libc/modlib/modlib_bind.c
  - Distinguish between relocation entry sizes by section type
  - Handle RELA style relocations

* libs/libc/modlib/modlib_globals.S
  - Formatting fixes
  - Symbols should not be weak - they exist or they don't

* include/nuttx/lib/modlib.h
  - Add an inidcator to module_s to distinguish between ET_DYN and other

* libs/libc/modlib/modlib_load.c
  - ET_DYN objects need to keep the relative displacement between the text
    and data sections due to GOT references from the former to the latter.
    This also implies that linking may require modification from the default
    for the shared objects being produced. For example, default alignment may
    mean nearly 64K of wasted space.

* libs/libc/modlib/modlib_unload.c
  sched/module/mod_rmmod.c
  - Distingusih between freeing of ET_DYN storage and other as the former
    is a single allocation.

* libs/libc/modlib/mod_insmod.c
  - Cater for ET_DYN objects having init and preinit sections
2023-09-20 09:35:28 -04:00
dongjiuzhu1
3884087396 libc/mod: fix minor issue about description
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
dongjiuzhu1
e8c9541263 libs/modlib: avoid double free when call modlib_unload with erro
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
dongjiuzhu1
310ba09ed7 libs/modlib: avoid seeking in each reading
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
dongjiuzhu1
13bdaaec99 libs/modlib: close fd when error happen
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-20 17:02:29 +08:00
chao an
6b070b2b00 libs/libc: currect usage of getpid/gettid in library
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-20 10:08:24 +08:00
hujun5
51a412c6b4 pthread_cleanup: rm sched_[un]lock
Since TLS is only used within a single thread and requires no additional protection.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-09-20 00:44:19 +08:00
chenrun1
4ce205cf08 lib_iconv.c:Fix possible out-of-bounds reads
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-09-19 09:34:48 +08:00
Petro Karashchenko
587f01a5e2 libs/libxx/libcxx: fix CI compilation issue reported on MACOS
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-19 01:17:17 +08:00
chao an
5026a96cfa nxstyle: cleanup UTF-8 Unicode to ASCII
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-18 11:54:17 -04:00
yanghuatao
7ea52505c2 libm/libmcs: Fix clang build download libmcs warning
VELAPLATFO-16865

Fix warnings:
CC:  libmcs/libmcs/libm/common/fenv.c libmcs/libmcs/libm/common/fenv.c:26:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int fegetround()
              ^
               void
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-09-18 23:00:38 +08:00
yanghuatao
88193d3ad5 libm/libmcs: Fix clang build libmcs warning
VELAPLATFO-15795

Fix warnings:
1 warning generated.
CC:  libmcs/libmcs/libm/mathd/lrintd.c libmcs/libmcs/libm/mathd/lrintd.c:141:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathd/lrintd.c:144:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
                       ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC:  libmcs/libmcs/libm/mathd/lroundd.c libmcs/libmcs/libm/mathd/lroundd.c:123:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathd/lroundd.c:126:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
                       ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC:  libmcs/libmcs/libm/mathf/lrintf.c libmcs/libmcs/libm/mathf/lrintf.c:67:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathf/lrintf.c:70:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
                       ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC:  libmcs/libmcs/libm/mathf/lroundf.c libmcs/libmcs/libm/mathf/lroundf.c:32:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathf/lroundf.c:34:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-09-18 21:02:39 +08:00
dongjiuzhu1
4763ca849a libxx/libcxx: select PTHREAD_MUTEX_TYPES to support recursive mutex
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-18 15:34:44 +08:00
Daniel Appiagyei
5bfda12634 c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
SPRESENSE
3c96621e1e libs:netdb: Restrict DNS query types
Corresponds to the problem of name resolution with different IP
address types in networks where only one of IPv4 or IPv6 can be
used due to physical layer reasons (e.g., LTE networks).
2023-09-16 14:43:12 +08:00
Petro Karashchenko
8a72eaf557 libs/libc/modlib: fix nxstyle issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
Petro Karashchenko
440be65010 spinlock: use spinlock API instead of direct asignment/compare
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
Petro Karashchenko
f06c509f9e libs/libc/pthread: correct description on pthread_setcanceltype
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
Xiang Xiao
368198706a lib/machine: Add LIBC_PREVENT_xxx which select LIBC_PREVENT_XXX_[KERNEL|USER] automatically
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-15 22:31:34 +03:00
yangdongdong
fa620dee9d Provide flat mode the chip string customization.
Signed-off-by: yangdongdong <yangdongdong@xiaomi.com>
2023-09-15 13:34:55 +08:00
Roy Feng
e90d58c3da esp32: Use newlib-esp32
When we are using newlib as libm, we can consider newlib-esp32 for esp32
hardware. An it contains some optimization for esp32 hardware.
Besides, two small issues has been fixed.
1. add the tar ball to .gitignore
2. Fix the some build warnings
2023-09-14 19:33:50 +08:00
Ville Juven
c178fa3260 stdio/lib_libfread: Fix buffer overflow issue
If the gulp size in the stdio buffer the remaining user buffer size it will:
- Corrupt memory in dest (user memory) and
- Keep corrupting KERNEL memory via the stdio character buffer until the
  whole system crashes, as the 'remaining' count underflows

This patch fixes this behavior.
2023-09-13 21:52:57 +08:00
chao an
9f10ddc9b0 nuttx/build: Restore ARLOCK to improve compile speed in incremental case
To solve the issue of carrying object files from previous builds,
Matias changed the archiving process to re-archive libapps.a on every compilation,
if libapps.a carries more object files, incremental compilation will waste too
many time in re-archiving, compared with the previous implement, this is a degradation
of the build system.  Referring to mature engineering projects such as cmake, if there
is configuration or source file changed, the best solution should be to reconfigure
the environment.

Revert this PR to ensure the compilation speed during incremental compilation.

|  commit 34b34e2d45 (tag: nuttx-20200914-172150)
|  Author: Matias N <matias@protobits.dev>
|  Date:   Fri Sep 11 22:31:38 2020 -0300
|
|      Fix: ensure archive files do not carry object files from prior builds
|
|      In some cases, when NuttX configuration changes and this makes the
|      object list used to build one of the .a libraries change as well,
|      since the command used to build it is "ar crs" and this simply appends
|      the list of object files, the library could still include object
|      files from prior builds. This commit modifies the ARCHIVE macro to
|      erase the .a file if it already exists.
|
|      Since in some cases this behavior was actually expected (object
|      files from a subdirectory were appended to a library created one
|      level above) I added a ARCHIVE_ADD which works as ARCHIVE did.
|
|      This change should greatly improve behavior of building after
|      configuration changes.

Testing:

sim:nsh
-------------------------------
|   Patched    |  Current
-------------------------------
|$ time make   |  $ time make
|real 0m1.270s |  real 0m1.728s
|user 0m0.971s |  user 0m1.276s
|sys  0m0.363s |  sys  0m0.530s
-------------------------------

Private project (20+ 3rd library needs archive to libapps.a)
-------------------------------
|   Patched     |  Current
-------------------------------
|$ time make    |  $ time make
|real 0m21.181s |  real 0m39.721s
|user 0m14.638s |  user 0m24.837s
|sys  0m6.919s  |  sys  0m14.394s
-------------------------------

Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-12 21:55:23 +08:00
wangming9
61a38ca680 libs/libxx/libcxx: Fix compilation warnings
Summary
Workaround the following warning with "GCC 12"
CXX:  libcxxabi/src/cxa_demangle.cpp In file included from libcxx/src/locale.cpp:15:
In member function 'std::__1::_EnableIf<std::__1::__is_cpp17_forward_iterator<_ForwardIterator>::value> std::__1::basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = const wchar_t*; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]',    inlined from 'std::__1::basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator, _InputIterator) [with _InputIterator = const wchar_t*; <template-parameter-2-2> = void; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]' at include/libcxx/string:2182:11,
    inlined from 'virtual int std::__1::collate_byname<wchar_t>::do_compare(const char_type*, const char_type*, const char_type*, const char_type*) const' at libcxx/src/locale.cpp:764:33:
include/libcxx/string:2156:35: warning: 'lhs' may be used uninitialized [-Wmaybe-uninitialized]
 2156 |         this->__throw_length_error();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

include/libcxx/new:237:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  237 |   return ::operator new(__args...);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-09 17:08:23 +03:00
wangming9
6265596cd0 libs/libc: Modify the Kconfig error description
Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-09 17:08:23 +03:00
yangyalei
fd776e8cee fix wait after vfork return error
vfork use waitpid hang father process,
but waitpid release child processs information by default.
So when user call wait, it return errno 10.

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-09-08 00:53:56 +03:00
yangyalei
eba2f163ed Revert "fix wait after vfork return error"
This reverts commit 50428979d0.
2023-09-08 00:53:56 +03:00
dongjiuzhu1
ee598b3e21 libc/mallopt: implement dummy mallopt
refs:
https://man.freebsd.org/cgi/man.cgi?query=malloc&apropos=0&sektion=3&manpath=SunOS+4.1.3&format=html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-07 23:11:10 +08:00
dongjiuzhu1
5e3c1985e7 libc/fopen: support fopen with mode 'm'
refs:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
This is a fake implementation, in order for fopen to succeed,
Because the complete mmap mapping the entire file will waste a lot of
memory.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-07 23:05:38 +08:00
shizhenghui
6d2ece0c25 libsrc: update version in CMakeLists.txt
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-09-07 22:15:48 +08:00