Commit Graph

1916 Commits

Author SHA1 Message Date
anjiahao 60796a7063 coredump:add const to memory region struct ptr
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-01 20:40:28 +08:00
xuxingliang 7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
Alin Jerpelea 6b5dddd5d7 libs/libc: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
Alin Jerpelea 9440887f9d libs/libnx: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
Alin Jerpelea d56c16e2b8 libs/libxx: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
Alin Jerpelea d5754ec7da libs/libm: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
Alin Jerpelea d500b92db1 libs: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
Alin Jerpelea 3ac9a6e179 libs/libdsp: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
guoshichao ff4ad07576 greenhills: add cmake support
1. refactor the ghs/gcc/clang/armclang toolchain management in CMake
2. unify the cmake toolchain naming style
3. support greenhills build procedure with CMake
4. add protect build for greenhills and gnu toolchain with CMake

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-10-01 11:48:09 +08:00
xuxin19 1bbcbc3440 ctype.h:move locale macro define to lib_ctype file
Macro definitions such as _S in public header files can cause compilation problems under the MSVC compiler.
Move macro definitions that are not used in public locations to the corresponding files

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-30 19:29:34 +08:00
Petro Karashchenko f0cbcb95ff nuttx/libm: switch from integer to double constants in pow
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-30 08:32:46 +08:00
Petro Karashchenko 776035ee9e nuttx/libm: fix powl wrong if first parameter is negative
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-30 08:32:46 +08:00
anjiahao 29e4e71167 modlib/dlfcn:unify same code
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-29 15:06:54 +08:00
dongjiuzhu1 fc1aefbeb3 libc/modlib: free memory resource when rmmod elf
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-29 15:06:54 +08:00
dongjiuzhu1 1f1d90de1c binfmt/modlib: support loading each sections to different memory for Relocate object
The feature depends on ARCH_USE_SEPARATED_SECTION
the different memory area has different access speed and cache
capability, so the arch can custom allocate them based on
section names to achieve performance optimization

test:
sim:elf
sim:sotest

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-29 15:06:54 +08:00
chenrun1 2e8e37bbf8 lib_fdopendir.c:Fix crash in fdopendir caused by fdsan
Summary:
  Add fdsan check in fdopendir, fdsan can work normally when using fdopendir

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-29 07:45:52 +08:00
yangguangcai 523b72d095 ftok:check mkdir return value.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 19:10:31 +08:00
yanghuatao 7cd38dca6a nuttx/libm: Fix powf wrong if first parameter is negative
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-28 10:42:36 +08:00
zhuanglin 07507669ba libc.csv: Add more missing interface
libc.csv adds the strlcpy, getrandom, task_tls_alloc, and fork interfaces

Signed-off-by: zhuanglin <zhuanglin@xiaomi.com>
2024-09-28 09:11:10 +08:00
yanghuatao 375178b42a nuttx/libm: Move define __BSD_VISIBLE to openlibm_math.h
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-27 23:21:01 +08:00
chenrun1 0d46c68731 libxx:fix build error when enable LIBCXXTOOLCHAIN
Summary:
  P:➜  nuttx git:(4cec713dbf) LC_ALL=C make
CC:  chip/stm32_gpio.c chip/stm32_gpio.c:41:11: note: '#pragma message: CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py'
   41 | #  pragma message "CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py"
      |           ^~~~~~~
CXX:  libcxxmini/libxx_new.cxx libcxxmini/libxx_new.cxx:72:11: error: redefinition of 'void* operator new(std::size_t, void*)'
   72 | FAR void *operator new(std::size_t nbytes, FAR void *ptr)
      |           ^~~~~~~~
In file included from /usr/include/newlib/c++/13.2.1/bits/atomic_base.h:36,
                 from /usr/include/newlib/c++/13.2.1/atomic:41,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/atomic.h:32,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/fs/fs.h:38,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/lib/lib.h:30,
                 from libcxxmini/libxx_new.cxx:29:
/usr/include/newlib/c++/13.2.1/new:174:33: note: 'void* operator new(std::size_t, void*)' previously defined here
  174 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
      |                                 ^~~~~~~~
make[1]: *** [Makefile:69: libxx_new.o] Error 1
make: *** [tools/LibTargets.mk:216: libs/libxx/libxx.a] Error 2

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-27 21:43:04 +08:00
SPRESENSE 53bbf797da libcxx: Apply 0001_fix_stdatomic_h_miss_typedef.patch to libcxx.defs
0001_fix_stdatomic_h_miss_typedef.patch is only applied to cmake,
so apply it to Makefile as well.
2024-09-27 17:10:17 +08:00
chenrun1 4581cbdb7e libc.h:Fixed the problem of multiple define appearing in arch_xxx.S after opening kasan
The reason is that libc.h needs to check whether CONFIG is enabled before the corresponding macro is enabled

Error scene:
arm-none-eabi-ld: /home/crafcat7/SSD/xxx/xxx-dev/nuttx/staging/libc.a(arch_libc.o): in function `memmove':
/home/crafcat7/SSD/xxx/xxx-dev/nuttx/libs/libc/machine/arch_libc.c:146: multiple definition of `memmove'; /home/crafcat7/SSD/xxx/xxx-dev/nuttx/staging/libc.a(arch_memmove.o):/home/crafcat7/SSD/xxx/xxx-dev/nuttx/libs/libc/machine/arm/armv8-m/gnu/arch_memmove.S:56: first defined here

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-27 10:32:09 +08:00
likun17 65264051aa stdio/va_format: move non-standard structure va_format to nuttx/streams.h
Signed-off-by: likun17 <likun17@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-27 10:29:22 +08:00
xucheng5 887c6c8716 syslogstream : init value for lib_syslograwstream_s.last_ch
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2024-09-27 09:59:45 +08:00
guoshichao 78e5fe3473 hcreate: fix using the uninit value misra issue
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 00:20:53 +08:00
guoshichao 3e66184f23 pthread_mutexattr_setprotocol: remove the unreached dead code
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 00:20:53 +08:00
guoshichao c9223469d4 moblib_bind: fix the variable uninit misra issue
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 00:20:53 +08:00
chao an f44a9c44a7 libc/pathbuffer: fix build warning on tasking
[263/1096] Building C object libs/libc/CMakeFiles/c.dir/misc/lib_pathbuffer.c.obj
ctc W574: ["libs/libc/misc/lib_pathbuffer.c" 144/3] 'return' with an expression in function returning void

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 23:10:31 +08:00
dongjiuzhu1 90d990712d libs/libc/stdio: Optimize header file dependencies in *prinf.c file.
Signed-off-by: likun17 <likun17@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
likun17 b8835be6c5 libs/libc/stdio: Optimize header file dependencies in *scanf.c file.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 47eec633a0 libs/libc/stdio: using sprintf to instead itoa
itoa isn't posix function, the standard stdlib file exclude it.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 c9ad454807 libs/stdio: fix compile warning when disable CONFIG_LIBC_NUMBERED_ARGS
libs/libc/stdio/lib_libvsprintf.c:160:48: warning: unused parameter 'arglist' [-Wunused-parameter]
                             FAR struct arg_s *arglist, int numargs,
                                               ^
libs/libc/stdio/lib_libvsprintf.c:160:61: warning: unused parameter 'numargs' [-Wunused-parameter]
                             FAR struct arg_s *arglist, int numargs,

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 319501e9ef libs/libc: remove LIB_BUFLEN_UNKNOWN to reduce depends on libc.h
1. remove libc.h
2. include <nuttx/stream.h>, remove stdio.h, becuase stream.h include stdio.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
lipengfei28 56308bf202 bitmap: add bitmap_find_free_region
The pci ep framewoek use bitmap manage the pci outbond memory

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28 ca39dc2e74 math: Optimize the implementation of log2ceil and log2floor
and move common math funtions to math32.h:
div_round_up
div_round_closest
is_power_of_2
roundup_pow_of_two
rounddown_pow_of_two

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28 4fd78583f7 libc: add find_next_zero_bit
The pci ep framework use bitmap manage free bar

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
chenrun1 76e83a5424 arch_atomic.c:Provide __sync_synchronize when the compiler does not support it
Summary:
  Configuration/Tool: zp214xpa/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2024-09-14 06:11:00
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
arm-none-eabi-ld: /github/workspace/sources/nuttx/staging/libfs.a(fs_inoderemove.o): in function `inode_remove':
fs_inoderemove.c:(.text.inode_remove+0x94): undefined reference to `__sync_synchronize'
arm-none-eabi-ld: fs_inoderemove.c:(.text.inode_remove+0x9c): undefined reference to `__sync_synchronize'
make[1]: *** [Makefile:212: nuttx] Error 1
make: *** [tools/Unix.mk:548: nuttx] Error 2
make: Target 'all' not remade because of errors.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
Shoukui Zhang 2c543c27bf Fix greater-than-or-equal-to-zero issue
unsigned_compare: This greater-than-or-equal-to-zero comparison without a signed value is always true. ndx >= 0U

Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-09-20 12:34:27 +02:00
wangjianyu3 44cce29d12 libs/gnssutils: Ignore source zip
Log:
  Untracked files:
    (use "git add <file>..." to include in what will be committed)
          libs/libc/gnssutils/db46128e73cee26d6a6eb0482dcba544ee1ea9f5.zip

  nothing added to commit but untracked files present (use "git add" to track)

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-20 14:38:43 +08:00
likun17 71876ae098 lib_libvscanf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
likun17 89a3f28a76 lib_libvsprintf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
anjiahao e085f0ee80 armv8-m:arch libc function need save ip register use pacbti
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:50:53 +08:00
YAMAMOTO Takashi df090a86f9 libc: add missing preadv/pwritev in CMakeLists.txt 2024-09-19 03:49:29 +08:00
wangjianyu3 c652f41c87 nuttx/uorb: Rename GPS to GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
xuxin19 e03fba1ad4 cmake:fix 7300 cmake build fail,init gpsutils cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-19 03:44:49 +08:00
Karel Kočí f2fd0bc148 libs/libc/obstack: revert invalid null byte append to obstack_vprintf
The commit c4d8d937d5 added null byte for
obstack_vprintf and thus to obstack_printf. I probably lost my marbles
but the same test I run previously now won't append null byte at the end
and this "fix" now causes regressions in code using obstack.

For the reference this is the testing code:

  #define _GNU_SOURCE
  #include <obstack.h>
  #include <stdarg.h>
  #include <stdio.h>
  #include <stdlib.h>

  #define obstack_chunk_alloc malloc
  #define obstack_chunk_free free

  static void print(struct obstack *obs, const char *fmt, ...) {
    va_list arg;
    va_start(arg, fmt);
    obstack_vprintf(obs, fmt, arg);
    va_end(arg);
  }

  int main(int argc, char *argv[]) {
    struct obstack obs;
    obstack_init(&obs);

    obstack_printf(&obs, "this %s", "text ");
    obstack_printf(&obs, "is appended");
    print(&obs, " as well as %s", "vprintf text");
    obstack_1grow(&obs, '\0');

    printf("%s\n", (char *)obstack_finish(&obs));

    obstack_free(&obs, NULL);
    return 0;
  }

The output on NuttX without this patch:

  > obstest
  this text

The output on NuttX with this patch:

  > obstest
  this text is appended as well as vprintf text

The output with GlibC:

  $ gcc test.c && ./a.out
  this text is appended as well as vprintf text
  $ ldd a.out
  	linux-vdso.so.1 (0x00007ffff7fc5000)
  	libc.so.6 => /nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib/libc.so.6 (0x00007ffff7dc8000)
  	/nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib/ld-linux-x86-64.so.2 => /nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib64/ld-linux-x86-64.so.2 (0x00007ffff7fc7000)

The output with Musl (and obstack_vprintf removed):

  $ gcc -lobstack test-musl.c && ./a.out
  this text is appended
  $ ldd a.out
  	/nix/store/00w9nz0343pxk7hbsjzq9bzaby65hk4g-musl-1.2.3/lib/ld-musl-x86_64.so.1 (0x7ffff7f4b000)
  	libobstack.so.1 => /nix/store/qvv16dqn85qwz9vz9wvpnv435z0n5msr-musl-obstack-1.2.3/lib/libobstack.so.1 (0x7ffff7f3b000)
  	libc.so => /nix/store/00w9nz0343pxk7hbsjzq9bzaby65hk4g-musl-1.2.3/lib/ld-musl-x86_64.so.1 (0x7ffff7f4b000)
2024-09-17 11:32:48 +08:00
p-szafonimateusz 92cbb63fc8 arch/x86_64: add basic support for R_X86_64_REX_GOTPCRELX relocation
GOTPCRELX reloc available only for CONFIG_ARCH_ADDRENV=y

when CONFIG_ARCH_ADDRENV is not set, CONFIG_ARCH_TEXT_VBASE is not specified
so we can't relocate

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-17 03:20:03 +08:00
Huang Qi 3a677e3268 libc/netdb: Remove unnecessary CONFIG_LIBC_NETDB checks
Since it already checked by Make.defs and CMakeLists.txt

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-17 03:19:47 +08:00
wanggang26 f6d378e528 enable O_CLOEXEC explicitly to avoid fd leak
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-17 02:07:34 +08:00