Commit Graph

2965 Commits

Author SHA1 Message Date
Shanmin Zhang 7bfd3abc65 Revert "libs/libc/stdlib/lib_exit.c: fix multiple definition of __dso_handle in msys2"
This reverts commit 8f96e59aee9cd0c5bbb82e01044d109f8588fec2.

The implementation of __dso_handle is independent of the HOST OS but dependent on the specific compiler.
Therefore, this patch will cause compilation failures for other cross-compilers on the Windows platform, such as arm-none-eabi-gcc and aarch64-none-elf-gcc.
Constraints should be applied to compiler target rather than compiler host.

Signed-off-by: Shanmin Zhang <zhangshanmin@xiaomi.com>
2026-04-27 10:04:05 +08:00
buxiasen 20c8380fd3 libc/strtold: fix ERANGE false positive for negative floats in decfloat()
Commit 1a8bac11a5a moved negative sign handling from strtox() into
decfloat()/hexfloat() so that y carries the sign directly. However,
the range check at the end of decfloat() was not updated accordingly:

  if (y < FLT_MIN || y > FLT_MAX)

FLT_MIN/DBL_MIN/LDBL_MIN are the smallest positive normalized values
(e.g. FLT_MIN ~ 1.17e-38). Any negative float (e.g. -9.87) is less
than FLT_MIN, so the check incorrectly sets errno to ERANGE. This
causes sscanf/fscanf to treat the conversion as failed, returning 0
instead of 1 for all negative floating-point inputs.

Fix by using fabsl(y) in the range comparisons, consistent with how
hexfloat() already uses fabsl() after the same commit.

Failing tests before fix (scanftest):
  Test #56: sscanf("-9.87654321", "%f")  -> returned 0 instead of 1
  Test #59: sscanf("-9.87654321e8", "%f") -> returned 0 instead of 1
  Test #61: sscanf("-9.87654321e-8", "%f") -> returned 0 instead of 1
  Test #64: sscanf("-9.87654321", "%lf") -> returned 0 instead of 1
  Test #67: sscanf("-9.87654321e8", "%lf") -> returned 0 instead of 1
  Test #69: sscanf("-9.87654321e-8", "%lf") -> returned 0 instead of 1

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-21 01:36:01 +08:00
hujun5 a9d5f9287e fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:35:03 +08:00
hujun5 1d31361856 tls: split tls.h to tls.h and tls_task.h
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 01:35:03 +08:00
guoshichao 2c27af036b environ: move the environ from sched/environ to libc/environ
change the environ implementation from sched/environ to
libc/environ, thus we can access the environ related API can vai libc
directl, which could improve the access speed in kernel build.
And in order to support this modification, we change the
struct task_info_s's ta_lock from nxmutex_t to nxrmutex_t,
this is because the env_*-related APIs require the ta_lock
to be reentrant.
If recursive locks are not supported, it may lead to deadlocks
in certain scenarios. For example, during initialization on the
qemu-miwear platform, it is necessary to call getenv while already
holding the ta_lock. To support such cases, we need to change
the ta_lock from nxmutex_t to nxrmutex_t.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:34:01 +08:00
zhengyu16 89af2157b1 fs: rename PSEUDOFS_SOFTLINKS to FS_LINKS
Signed-off-by: zhengyu16 <zhengyu16@xiaomi.com>
2026-04-21 01:33:21 +08:00
pengyinjie 06a9f127e8 Implement POSIX-compliant abort()
https://pubs.opengroup.org/onlinepubs/9799919799/functions/abort.html?utm_source=chatgpt.com
Per POSIX.1-2024, abort() must:
- Override blocking or ignoring of SIGABRT
- Raise SIGABRT to calling thread
- If the signal is caught by a handler that returns,
reset disposition to SIG_DFL and raise SIGABRT again
- Ensure abnormal termination occurs and never return

NuttX's prior implementation directly called _exit(EXIT_FAILURE),
which bypassed signal semantics and failed PSE52 abort test.
This patch restores correct POSIX behavior by unblocking SIGABRT,
raising it (with handler support), and enforcing default termination
if needed.

Signed-off-by: pengyinjie <pengyinjie@xiaomi.com>
2026-04-21 01:32:22 +08:00
anpeiyun e79c58faa0 strtol: fix endptr handle issue.
If the subject sequence does not have the expected form, no conversion is performed; when endptr is not a null pointer, the value of nptr shall be stored in the object pointed to by endptr.
For example, after calling strtol("  ABC", &endptr, 10);, endptr should point to the first space ' ', not to 'A'.
Refer to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtol.html

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-04-21 01:32:21 +08:00
anjiahao f325a4a990 libc:use task_info replace libc global variables
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-04-21 01:32:13 +08:00
anpeiyun c87a9c128b lib_strtold.c: strtold don't correctlly set errno.
Improved the statistics of floating point results exceeding
the boundary and correctly set errno

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-04-21 01:31:25 +08:00
chenchaokai 230f7daa2a Fix PSE52 strtoul error. Base should be 2~36, not 2~26.
Signed-off-by: chenchaokai <chenchaokai@xiaomi.com>
2026-04-21 01:29:27 +08:00
anjiahao 94b20bf604 Avoid nuttx/sched.h include tls.h and mm.h
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-04-21 01:28:45 +08:00
wangzhi16 0419926f35 libs/libc: fix compile error.
misc/lib_idr.c:46:3: error: unknown type name 'mutex_t'
   46 |   mutex_t lock;
      |   ^~~~~~~

misc/lib_idr.c: In function 'idr_alloc_u32':
misc/lib_idr.c:254:11: error: 'ENOSPC' undeclared (first use in this function)
  254 |   return -ENOSPC;
      |           ^~~~~~

stdio/lib_printf.c: In function 'printf':
stdio/lib_printf.c:46:18: error: 'STDOUT_FILENO' undeclared (first use in this function)
   46 |   ret = vdprintf(STDOUT_FILENO, fmt, ap);
      |                  ^~~~~~~~~~~~~

stdlib/lib_rand48.c: In function 'seed48':
stdlib/lib_rand48.c:97:3: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration]
   97 |   memcpy(p, g_seed48, sizeof(p));
      |   ^~~~~~

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-21 01:23:54 +08:00
guohao15 edb5b17be7 bugfix:When the stat() returns ret < 0 and the error is not ENOENT, mkstemp will hang here and keep retrying.
for example:
When:
  path_template:/data/quickapp/cache/ncm_XXXXXX
  xlen is equal to BIG_XS
  retries will be set to UINT32_MAX
then:
  The stat operation fails due to issues with drivers, memory problems,
  or file system operations and continuously returns an error other than ENOENT,
  it will keep retrying, which may cause the watchdog timer to time out.

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-04-21 01:17:41 +08:00
ligd 7f0a05fcbe abort: add backtrace for abort
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 01:16:40 +08:00
Xiang Xiao f36c146551 libc: Fix lib_arc4random.c:111:(.text.arc4random_buf+0x26): undefined reference to `clock_systime_ticks'
by replacing clock_systime_ticks to clock

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:12:49 +08:00
Xiang Xiao 66995e369b libc: Refine the arc4random_buf implementation
fill the buffer with getrandom instead random pool
and move the implementation to from crypto to libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:12:48 +08:00
Xiang Xiao f9280a15ba libc: Make getcwd() work even CONFIG_DISABLE_ENVIRON is enabled
since getcwd() can be implemented correctly without using environ

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:12:28 +08:00
openvela-robot 77f0bea7f5 Merge branch 'master' into vela
apache/nuttx commit id: eb27ebba8adfe29644a7b890f86e6f16941921dc

Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:12:27 +08:00
openvela-robot 87c6ff19cf mm: Fix some typos
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:12:20 +08:00
openvela-robot b2f5ba0753 syslog: convert \n to \r\n in syslog framework layer
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:12:15 +08:00
openvela-robot 24c239f8f5 arm/cmake: fix cmake compile error
1. The -c parameter should not be added during the link phase, otherwise the link will fail.
2. If it is the clang compiler, its toolchain library should use --print-file-name to find it, otherwise an error will occur

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:12:09 +08:00
openvela-robot 44ed68d400 fs/rpmsgfs: return real err value when open failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:12:00 +08:00
openvela-robot 85912ed402 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2026-04-21 01:11:54 +08:00
openvela-robot 0fdd165dfa Fix disable msi when msi capability not exist issue
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:11:48 +08:00
openvela-robot 61f4f9411d openamp: sync with community
Comminity has upgrade the openamp to the last commit (near 2024.05 Release),
sync back to vela.

Only modify the makefile and upgrade the patch, should be no impact in any
features.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:11:43 +08:00
openvela-robot 4ea93dbabf add a flag of lin internal sleep/wakeup state
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2026-04-21 01:11:35 +08:00
openvela-robot 5081b31bd0 cmake(sync):sync CMakeLists.txt conflict of libc with github
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-04-21 01:11:30 +08:00
openvela-robot 39fce4b20d arch/x86_64: Resolving NUC Boot Failure Issue
The segment of the Xen PVH boot protocol was not specified during linking and was placed before .loader.text, causing the boot to fail

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-04-21 01:11:24 +08:00
openvela-robot d2e613094f arm64/makefile: No longer using hwasan pile insertion
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:11:19 +08:00
openvela-robot a3dd40b0d9 mm: call sched_note within mm lock
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:11:12 +08:00
openvela-robot 8b787c52e2 sched: sync minor differences in community code
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:11:07 +08:00
openvela-robot bf0c4ea69a libc/modlib: Make modlib selectable from defconfig
since bootloader may call modlib functions directly
to load elf firmware without binfmt, dlfcn or module.

BTW, this patch also remove the duplicated selecttion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:11:02 +08:00
openvela-robot d194b91929 Revert "math32.h: remove typeof depends"
This reverts commit 4e9f8176a08aa25c7173bc4c748e721b0841ddac.

Reason for revert:
This patch are using to fix the following build warning when build with greenhills compiler:
    CC:  syslog/vsyslog.c "pthread/pthread_create.c", line 443: warning #1931-D: operand of sizeof is
              not a type, variable, or dereferenced pointer expression
              ptcb->cmn.timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                                    ^

    CC:  dirent/lib_closedir.c "sched/sched_profil.c", line 81: warning #1931-D: operand of sizeof is not a
              type, variable, or dereferenced pointer expression
        wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
                               ^

    "sched/sched_profil.c", line 142: warning #1931-D: operand of sizeof is not a
              type, variable, or dereferenced pointer expression
        wd_start(&prof->timer, PROFTICK, profil_timer_handler, (wdparm_t)prof);
                               ^

    CC:  common/arm_modifyreg8.c "sched/sched_setscheduler.c", line 165: warning #1931-D: operand of sizeof is
              not a type, variable, or dereferenced pointer expression
                tcb->timeslice  = MSEC2TICK(CONFIG_RR_INTERVAL);
                                  ^

    CC:  misc/lib_utsname.c "sched/sched_unlock.c", line 275: warning #1931-D: operand of sizeof is not a
              type, variable, or dereferenced pointer expression
                rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                                  ^

    "sched/sched_roundrobin.c", line 119: warning #1931-D: operand of sizeof is
              not a type, variable, or dereferenced pointer expression
                tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                                 ^

we need to keep the modification
2026-04-21 01:10:57 +08:00
openvela-robot ac82d776ab usb: Fix issue with the calculation descriptor length error
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:10:47 +08:00
openvela-robot 0662b2ac02 rpmsgdev/blk: sync with communitfy, minor nxstyle fix
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:10:42 +08:00
openvela-robot 97534cf708 add lin status changes the format of the reported frame and add the macros that lin needs
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2026-04-21 01:10:37 +08:00
openvela-robot 492cec3ec5 nuttx/sim: Fix MacOs build error with argument unused during compilation: '-no-pie'
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-04-21 01:10:31 +08:00
openvela-robot 1f0a222301 sim/m64:Fix ld error with .rodata can not be used when making a PIE object.
/usr/bin/ld: nuttx.rel: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-04-21 01:10:25 +08:00
openvela-robot 80196e894b nuttx: Change the judgment of GCCVER version to greater equal.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-04-21 01:10:19 +08:00
openvela-robot 6c85ce6822 vsprintf:fix bug when print int64 0x8000000000000000
stdio/lib_libvsprintf.c:1018:17: runtime error: negation of -9223372036854775808 cannot be
represented in type 'long long int'; cast to an unsigned type to negate this value to itself
    #0 0x3326a86 in vsprintf_internal stdio/lib_libvsprintf.c:1018
    #1 0x332926b in lib_vsprintf stdio/lib_libvsprintf.c:1363
    #2 0x3777978 in vfprintf stdio/lib_vfprintf.c:52
    #3 0x671b3a0 in printf stdio/lib_printf.c:44
    #4 0x37abc0c in hello_main /data/project/code/vela-pt/apps/examples/hello/hello_main.c:38
    #5 0x33201d3 in nxtask_startup sched/task_startup.c:70
    #6 0x3208ecb in nxtask_start task/task_start.c:134
    #7 0x3357a49 in pre_start sim/sim_initialstate.c:52

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:10:13 +08:00
openvela-robot 78d736af82 arm/toolchain.defs: sync the whole-archive config with community
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-21 01:10:07 +08:00
openvela-robot 47daa79e0b nuttx/x86_64:Add _sinit and _einit initialization.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-04-21 01:10:02 +08:00
openvela-robot 5d60745acb strptime.c:len is not defined.
Bring all code that uses the variable len under the CONFIG_LIBC_LOCALE

Signed-off-by: chenjiahua1 <chenjiahua1@xiaomi.com>
2026-04-21 01:09:56 +08:00
openvela-robot 679535b72f coredump: add architecture-specific registers dump, including NVIC and MPU
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2026-04-21 01:09:50 +08:00
openvela-robot 1dbe459e5f Increase the chance for _assert to work early in the boot 2026-04-21 01:09:43 +08:00
openvela-robot db1bde8907 Doc: Migrate Versioning and Task Names
Migrate
https://cwiki.apache.org/confluence/display/NUTTX/Versioning+and+Task+Names
to the official wiki

Signed-off-by: Ludovic Vanasse <ludovicvanasse@gmail.com>
2026-04-21 01:09:38 +08:00
openvela-robot ac763890d3 mm/mempool: Merge two memory requests
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:09:31 +08:00
openvela-robot 7e009970ce drivers/segger: inline note_sysview_get_timestamp
Avoid another layer of function call to get time.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:09:12 +08:00
openvela-robot 154f6f9208 cmake(sync):sync cmake Toolchain change from github
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-04-21 01:09:02 +08:00