Commit Graph

53747 Commits

Author SHA1 Message Date
Xiang Xiao 7c1768c167 fs/epoll: Double array size when it is full
correct the sequnce of array size from:
size, size, 2*size, 4*size, 8*size...
to:
size, 2*size, 4*size, 8*size, 16*size...

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
Xiang Xiao 56b2e7254a fs/poll: Compute tick from millisecond by MSEC2TICK
reduce duplicate code

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
buxiasen 94e34d0020 clk: fix reg operation not compatible with 64bit
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-17 00:05:18 +08:00
Zhe Weng 504af7a1fa drivers/virtio-net: Support VIRTIO_F_ANY_LAYOUT
According to Virtual I/O Spec:
When using legacy interfaces, transitional drivers which have not negotiated VIRTIO_F_ANY_LAYOUT MUST use a single descriptor for the struct virtio_net_hdr on both transmit and receive, with the network data in the following descriptors.

https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2280006 (Section 5.1.6.6)

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-16 21:15:31 +08:00
Ville Juven 073bb31c3b mm/map/vm_region.c: Fix formatting error
mm/map/vm_region.c:131:7: error: If statement followed by garbage
2024-08-16 09:50:23 -03:00
Ville Juven 971ca501b9 mm/map/vm_region.c: Fix usage of void* arithmetics
Fixes build error:
map/vm_region.c: In function 'vm_map_region':
map/vm_region.c:128:16: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
  128 |   return vaddr + (MM_PGMASK & paddr);
      |                ^
cc1: all warnings being treated as errors
2024-08-16 09:50:23 -03:00
Jouni Ukkonen 9c2af7284b arch/arm64/imx93: Add more base addresses
mem slice and src base address added

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-08-16 19:39:02 +08:00
Gao Feng 87ff0ddf6d xtensa/esp32s3: reserve memory for a mutex struct depending on the OS
Enabling CONFIG_PRIORITY_INHERITANCE config causes a build error

Based on Nuttx OS reserve memory for mutex struct.

Pass build based on
 - CONFIG_PRIORITY_INHERITANCE y
 - CONFIG_SEM_PREALLOCHOLDERS 0/8
2024-08-16 15:25:20 +08:00
fanjiangang 5e9358b782 make/disassembly: generate disassembly file
Create the nuttx.asm in the disassembly format using the objdump program.

NOTE:
'>', objdump doesn't take arguments for output file,
but result is printed to standard out, and is redirected.

Signed-off-by: fanjiangang <fanjiangang@lixiang.com>
Signed-off-by: chao an <anchao@lixiang.com>
2024-08-16 15:22:25 +08:00
Gao Feng ddbbdd7fd3 xtensa/esp32s3: partition name duplicate and free 2024-08-16 15:11:14 +08:00
Jinliang Li a5bfbca869 arm/armv8-r: invalidate d-cache on boot
Pass CP15_CACHE_INVALIDATE argument with r1 register to cp15_dcache_op_level.
cache level is 0(L1 D-Cache) with r0 register.
prototype:
void cp15_dcache_op_level(uint32_t level, int op)

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-08-16 13:41:19 +08:00
Jinliang Li 0e825b230d arm/armv8-r: add cp15 ops for mpu
Add some cp15 definitions for mpu configuration

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-08-16 13:27:31 +08:00
Jinliang Li 0fddb71478 serial/uart_16550: include stdint.h in uart_16550.h
stdint.h is needed in uart_16550.h for some types, e.g. uint32_t,
uintptr_t. Otherwise there will be building issue unless that stdint.h
is added before uart_16550.h by all files which needs uart_16550.h.

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-08-16 13:26:40 +08:00
xuxin19 b64fb09e6c cmake:bugfix fix CMake LTO build block
it was wrong in https://github.com/apache/nuttx/pull/12423/files#r1618852245
EXTRA_FLAGS is useful in LTO for pass option tu lto linker

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-15 18:01:50 +08:00
Alan C. Assis a409c42d13 Doc: Fix broken SPI Tool documentation 2024-08-15 13:36:50 +08:00
Alexis Guijarro f05c85e622 arm/stm32h7x3x_rcc.c: Add External Power Supply option to stm32h7x3x targets 2024-08-15 02:52:45 +08:00
pengyiqiang 08cdff2046 arch/sim/Kconfig: set SIM_FBBPP to 32 by default
32bpp is the most commonly used option and should be used as the default

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-08-15 02:38:31 +08:00
Tiago Medicci 3ae30d00ea docs: Improve information about debugging for Espressif SoCs
Provide more information on how to properly use OpenOCD and gdb to
debug Espressif SoCs on NuttX.
2024-08-15 02:38:09 +08:00
xuxin19 b3f1871bc3 sched:fix windows sim build error
nuttx\sched\signal\sig_timedwait.c(253,13): error C2059: syntax error:'<parameter-list>'
nuttx\sched\signal\sig_timedwait.c(321,44): error C2182: '$S1': illegal use of type 'void'
nuttx\sched\signal\sig_timedwait.c(321,50): error C2059: syntax error:':'

nuttx\sched\tls\tls_initinfo.c(68,39): error C2036: 'void *': unknown size
nuttx\sched\sched\sched_get_tls.c(76,44): error C2036: 'void *': unkown size

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 363cd1c17a windows sim:convert pointer type to char* fix windows net build error
nuttx\include\nuttx\net\netfilter\ip6_tables.h(299,24): error C2036: 'void *': unknown size

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi cedb7f97de compiler.h: fix windows netfilter build error
nuttx\net\netfilter\ipt_sockopt.c(389,7): error C2059: syntax error: ')'
nuttx\net\netfilter\ip6t_sockopt.c(387,7): error C2059: syntax error: ')'

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 538582ede1 convert pointer string to number in base 16
Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 7ce5241f0e types.h: fix windows build error
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(605,39): error C2371: 'wint_t': redefinition; different basic types
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(606,39): error C2371: 'wctype_t': redefinition; different basic types

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 7c56e917e7 libc:add missing source to fix windows build error
nuttx_all.lib(netlib_setipv4dnsaddr.obj) : error LNK2019: unresolved external symbol _bzero referenced in function _netlib_set_ipv4dnsaddr

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 46f3477d2f compiler.h: fix windows build error
warning C5101: use of preprocessor directive in function-like macro argument list is undefined behavior

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi f512f5e8a9 windows sim:add MSCV atomic support for fix windows build error
VC\Tools\MSVC\14.40.33807\include\vcruntime_c11_stdatomic.h(36,24): error C2061: syntax error: identifier 'atomic_bool'
VC\Tools\MSVC\14.40.33807\include\vcruntime_c11_stdatomic.h(36,24): error C2059: syntax error: ';'
VC\Tools\MSVC\14.40.33807\include\vcruntime_c11_stdatomic.h(37,23): error C2061: syntax error: identifier 'atomic_char'
VC\Tools\MSVC\14.40.33807\include\vcruntime_c11_stdatomic.h(37,23): error C2059: syntax error: ';'
VC\Tools\MSVC\14.40.33807\include\vcruntime_c11_stdatomic.h(38,30): error C2061: syntax error: identifier 'atomic_schar'
VC\Tools\MSVC\14.40.33807\include\vcruntime_c11_stdatomic.h(38,30): error C2059: syntax error: ';'

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi b65efdba12 sim_hostmemory.c: fix windows build error
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(39,40): error C2146: syntax error: missing ')' before identifier 'exec'
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(39,35): error C2081: 'bool': name in formal parameter list illegal
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(39,40): error C2061: syntax error: identifier 'exec'
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(39,40): error C2059: syntax error: ';'
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(39,44): error C2059: syntax error: ')'
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(40,1): error C2449: found '{' at file scope (missing function header?)
nuttx\arch\sim\src\sim\win\sim_hostmemory.c(42,1): error C2059: syntax error: '}'

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 4cd66fa7cc windows sim:add CONFIG_SYSTEM_TIME64 fix windows build error
nuttx\arch\sim\src\sim\sim_checkhostfstypes.c(80,1): error C2338: static_assert failed: 'sizeof(((struct nuttx_stat_s *)0)->st_atim) == sizeof(((struct stat *)0)->st_atim)'
nuttx\arch\sim\src\sim\sim_checkhostfstypes.c(81,1): error C2338: static_assert failed: 'offsetof(struct nuttx_stat_s, st_mtim) == offsetof(struct stat, st_mtim)'
nuttx\arch\sim\src\sim\sim_checkhostfstypes.c(81,1): error C2338: static_assert failed: 'sizeof(((struct nuttx_stat_s *)0)->st_mtim) == sizeof(((struct stat *)0)->st_mtim)'
nuttx\arch\sim\src\sim\sim_checkhostfstypes.c(82,1): error C2338: static_assert failed: 'offsetof(struct nuttx_stat_s, st_ctim) == offsetof(struct stat, st_ctim)'

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
xuxin19 b325ae6391 cmake: add_application supports only registration but not compilation
for sources that have implemented multiple prog_main,
there is a situation where you don't need to add source files but need to register.
the add_application method is enhanced so that it can be registered without entering SRCS.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 16:05:27 +02:00
Yanfeng Liu 41dba46c1d arch/riscv: fix IRQ_SOFT for non-SMP
This fixes software interrupt number for non-SMP cases

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-14 20:59:52 +08:00
xuxin19 819685fbec cmake:bugfix enable ARCH_STRING_FUNCTION CMake build fail
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 20:58:59 +08:00
xuxin19 7502c9c334 cmake:bugfix add sched include search path for fs
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 20:58:59 +08:00
xuxin19 b073b3efc1 cmake:bugfix SIM_ASAN cannot automatically link libasan in cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 20:58:59 +08:00
xuxin19 cd46d27489 cmake:Remove Unix-specific code and replace it with cmake script to support cross-platform
the Unix-specific commands used in the CMake implementation of savedefconfig are not
supported on the Windows platform, which will cause compatibility issues.

replace it with CMake implementation, which can be cross-platform and has been verified on Windows.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 14:02:28 +08:00
xuxin19 af10e1b470 lib_ustname:keep the incrementally compiled version time updated
fix phoney target mismatch issue, always rebuild ustname

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-13 19:42:32 +08:00
zhangshuai39 a1f9a6624e net/tun:Remove unused variables in read & write
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
2024-08-13 16:34:14 +08:00
simbit18 155517b5fc arch/sim/src/cmake/Toolchain.cmake: macOS fix unknown options: --gc-sections
fix
ld: unknown options: --gc-sections

added -> add_link_options(-Wl,-dead_strip)
2024-08-12 15:10:01 -03:00
Yanfeng Liu f5b2fc371e riscv/qemu-rv: use cluster PLIC/CLINT configs
This uses cluster speficic PLIC, CLINT and ACLINT devices in NuttX.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-12 20:43:05 +08:00
Yanfeng Liu 6db85498a2 riscv/qemu-rv: add cluster PLIC/CLINT configs
This adds cluster specific configs for PLIC, CLINT and ACLINT
devices.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-12 20:43:05 +08:00
anjiahao 2ff2b82437 coredump:coredump_set_memory_region to set memory region
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
anjiahao 8d0d1f7571 coredump:Add coredump success log printing to remind you to use coreudmp
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
anjiahao 5f4c1721ff coredump:support coredump aligned access registers
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
anjiahao aee17d6cc2 kasan:fix bug write error is recognized as read error
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:00:04 +08:00
anjiahao 8c8ccbf039 mps3-an547:support mps3-an547 reset
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 01:59:35 +08:00
anjiahao ce6d308cef armv8-m:fix log warnning
armv8-m/arm_securefault.c:72:11: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
   72 |   sfalert("\tCFSR: %08x HFSR: %08x DFSR: %08x\n", getreg32(NVIC_CFAULTS),
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 01:52:35 +08:00
yanghuatao fecc5091af toolchain/ghs: Fix SP_DSB warnings
"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 252: warning #76-D:
          argument to macro is empty
        SP_DSB();
               ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 261: warning #76-D:
          argument to macro is empty
    SP_DMB();
           ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 252: warning #76-D:
          argument to macro is empty
        SP_DSB();
               ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 261: warning #76-D:
          argument to macro is empty
    SP_DMB();
           ^

"/mnt/yang/qixinwei_vela_warnings/nuttx/include/nuttx/spinlock.h", line 296: warning #76-D:
          argument to macro is empty
        SP_DSB();
               ^

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-11 14:28:12 -03:00
guoshichao d76218e817 greenhills: fix the moblib asm compile error
CC:  assert/lib_assert.c [asarm] (error #2179) modlib/modlib_globals.S 61: unexpected token type (char) encountered; expected type (identifier)
  .size \ globalNames , . - \ globalNames
--------^

[asarm] (error #2179) modlib/modlib_globals.S 67: unexpected token type (char) encountered; expected type (identifier)
  .size \ nglobals , . - \ nglobals
--------^

[asarm] (error #2179) modlib/modlib_globals.S 72: unexpected token type (char) encountered; expected type (identifier)
  .size \ global_table , . - \ global_table
--------^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-11 14:28:12 -03:00
guoshichao ed9d57b501 greenhills: fix the arch_setjmp.S build error
CC:  bch/bchlib_read.c [asarm] (error #2067) machine/arm/gnu/arch_setjmp.S 34: unknown instruction
  .syntax unified
--^

[asarm] (error #2230) machine/arm/gnu/arch_setjmp.S 62: bad directive
  .type setjmp , function
-----------------^

[asarm] (error) errors during processing

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-11 14:28:12 -03:00
guoshichao 693e869404 arm-m/barrier: fix green hills build ARM_ISB error
according to armv6-m/armv7-m arch reference manual:
the three ISB {<opt>}, DSB {<opt>}, DMB {<opt>} instructions <opt>
field are defined as:
Specifies an optional limitation on the ISB/DSB/DMB operation. Allowered
values are:
Full system ISB/DSB/DMB operation, encoded as option=='1111'. Can be
omitted.
All other encodings of the options are RESERVED.
the "#opt" field of "isb #opt"

So we could remove the options field in Armv7-m platform.
The following are the build error with greenhills compiler:

CC:  common/arm_exit.c [asarm] (error #2071) /tmp/gh_001h70j1.si 92: bad parameter
  isb 15
------^

[asarm] (error #2071) /tmp/gh_001h70j1.si 112: bad parameter
  isb 15
------^

[asarm] (error) errors during processing

According to armv8-m arch reference manual:
the ISB/DMB instruction's "opt" encoding rule is same as
armv6-m/armv7-m, but the "DSB" instruction is different, in armv8-m, the
"DSB {<opt>}" field has two valid encoding options: 0b0000, 0b0100.
and all other encoding options are reserved.

In Armv7-a/Armv8-a, the dsb/dmb option field has 8 valid state value.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-11 14:28:12 -03:00
fangxinyong 6da525704d toolchain/ghs: fix the inline assembly code register alloc compile error
The following are the compile error that reported
by GreenHills compiler:

"/mnt/yang/qixinwei_commit/nuttx/include/arch/syscall.h", line 156 (col. 17): error #2036-D:
          cannot allocate "reg0" to specified caller-saved register

 "/mnt/yang/qixinwei_commit/nuttx/include/arch/syscall.h", line 157 (col. 17): error #2036-D:
          cannot allocate "reg1" to specified caller-saved register

Then we fix this greenhills compilation error by explicitly specifying
the registers in the clobber list in the inline assembly code.
This fix is successful in compiling on the
nuttx/boards/arm/mps/mps2-an500/configs/nsh platform and passes
the ostest test.
However, if we keep the implementation the same for both the default
and Greenhills compilers, the default compiler will report the
following two issues:
1. the "sys_call6" function will report compile error when
compiling on "./vendor/qemu/boards/smartspeaker/configs/smartspeaker-knsh"
platform, the detailed error info:

CC:  proxies/PROXY_mq_getattr.c In file included from /home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/sys/syscall.h:35,
                 from /home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/syscall.h:30,
                 from proxies/PROXY_mmap.c:5:
In function 'sys_call6',
    inlined from 'mmap' at proxies/PROXY_mmap.c:9:22:
/home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/arch/syscall.h:297:3: error: 'asm' operand has impossible constraints
  297 |   __asm__ __volatile__
      |   ^~~~~~~

2. when running on qemu-armv7-a platform, the modification to
"smh_call()" function will make the system fail to boot up, so
we need to keep the default compiler implementation and greenhills
compiler implementation separate

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
(cherry picked from commit cb48b749b1c9cad8cfb96bff7c5e9b6ebf20fc8a)
2024-08-11 14:28:12 -03:00