Commit graph

57090 commits

Author SHA1 Message Date
hujun5
cbd07a86c9 s32k1xx_serial: arch/arm/src/s32k1xx/s32k1xx_serial.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 22:16:45 +08:00
cuiziwei
ae5c7a7fd8 libcxxabi: Soft link the libcxxabi header file to nuttx/include.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-12-05 21:56:23 +08:00
wangmingrong1
75fc19d729 virtio: Fix the problem of incorrect setting of virtio queue address under tags kasan
There is also a printing error due to https://github.com/apache/nuttx/pull/15043:
Configuration/Tool: rv-virt/virt_nsh
In file included from virtio/virtio-mmio.c:29:
virtio/virtio-mmio.c: In function 'virtio_mmio_init_device':
Error: virtio/virtio-mmio.c:826:14: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     uint32_t {aka long unsigned int}
virtio/virtio-mmio.c:826:24: note: format string is defined here
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |                       ~^
      |                        |
      |                        int
      |                       %ld
cc1: all warnings being treated as errors
make[1]: *** [Makefile:109: virtio-mmio.o] Error 1
make[1]: Target 'libdrivers.a' not remade because of errors.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 21:23:30 +08:00
hujun5
1ab1dbc0f0 wm8776: use small lock in drivers/audio/wm8776.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 21:22:32 +08:00
buxiasen
617fee66ff Revert "arm/rp2040: use custom vectors to make smp_call work with exception_common"
This reverts commit 9464afe7c3.
2024-12-05 20:42:22 +08:00
buxiasen
108aaf8bbb Revert "arm/lc823450: use custom vectors to make smp_call work with exception_common"
This reverts commit c2cb58ff31.
2024-12-05 20:42:22 +08:00
buxiasen
9473cee85b Revert "arm/cxd56: use chip specific vectors to allow smpcall update regs"
This reverts commit 4a1afab88e.
2024-12-05 20:42:22 +08:00
buxiasen
af3c159cff arm-v6/7/8m: sigaction forward to pendsv
For exception directly, tcb->xcp.regs should not be used.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-05 20:42:22 +08:00
buxiasen
55822753be arm-v6/7/8m: sigaction should use running_task
Nested irq possible cause readytorun not match with regs

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-12-05 20:42:22 +08:00
wangmingrong1
909bf2dbb4 kasan/globals: fix compile error
../../../mm/kasan/global.c:58:44: error: type of 'g_global_region' does not match original declaration [-Werror=lto-type-mismatch]
   58 | extern const struct kasan_global_region_s *g_global_region[];
      |                                            ^
kasan_globals.tmp:3:21: note: 'g_global_region' was previously declared here
    3 | const unsigned long g_global_region[] = {
      |                     ^
lto1: all warnings being treated as errors

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 20:37:47 +08:00
wangmingrong1
e2729f58d4 arm64/qemu: Enable lto compilation by default
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 20:36:37 +08:00
wangmingrong1
ee20aa888b kasan/lto: Turn off lto by default anyway
Of course, there is an error here, that is, the conditional judgment of
  ifeq ($(CONFIG_LTO_NONE),n)
    CFLAGS += -fno-lto
  endif
 is wrong, it should be judged as "ifneq ($(CONFIG_LTO_NONE),)"

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 20:36:37 +08:00
Ville Juven
fed3da9f03 mm_grantable.c: Fix infinite loop due to memory fragmentation
The search algorithm does not work with the ctz approach at all, if there
is a free range of granules that does not fit a specific allocation (i.e.
the granule allocation is fragmented) it will cause an infinite loop as
the algorithm will try to find free space from the same (free) starting
granule, causing an infinite loop.

The clz approach works for all cases, it will find the last used granule
and the search will continue from the next free granule.

Also, offsetting a full GAT must be sizeof(gat[0] - 1), which is 31 in
this case. The reason is that the upper level search function increments
the value by +1.
2024-12-05 20:36:04 +08:00
chenxiaoyi
f313ee5715 xtensa: inline up_switch_context
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 20:32:45 +08:00
zhangyuan29
060fda032b drivers/net: change netdev_lower_quota_load to macro.
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-05 13:26:22 +08:00
wangmingrong1
79758c5150 arm64/lto: Fix link error after opening lto
CPP:  /mnt/vela/github/NX/nuttx/boards/arm64/qemu/qemu-armv8a/scripts/dramboot.ld-> /mnt/vela/github/NX/nutLD: nuttx
Please update the link script, section ['.kasan.global'] cannot be found
`.eh_frame' referenced in section `.text.frame_dummy' of /mnt/vela/github/Toolchains/arm64-gcc-13/bin/../lib/gcc/aarch64-none-elf/13.2.1/crtbegin.o: defined in discarded section `.eh_frame' of /mnt/vela/github/Toolchains/arm64-gcc-13/bin/../lib/gcc/aarch64-none-elf/13.2.1/crtbegin.o
`.eh_frame' referenced in section `.text.frame_dummy' of /mnt/vela/github/Toolchains/arm64-gcc-13/bin/../lib/gcc/aarch64-none-elf/13.2.1/crtbegin.o: defined in discarded section `.eh_frame' of /mnt/vela/github/Toolchains/arm64-gcc-13/bin/../lib/gcc/aarch64-none-elf/13.2.1/crtbegin.o
Memory region         Used Size  Region Size  %age Used

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 13:23:59 +08:00
wangmingrong1
fe5ee0c6ac arm64/toolchain: Fix toolchain judgment after opening lto
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 13:23:13 +08:00
hujun5
3e3701b272 riscv: Some judgments are missing
This commit fixes the regression from https://github.com/apache/nuttx/pull/14984

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 00:07:38 +08:00
zhangyuan29
1dc1e65202 arch/xtensa: use arch atomic when enable iram heap
S32C1I instructions may target cached, cache-bypass,
and data RAM memory locations. S32C1I instructions
are not permitted to access memory addresses in data ROM,
instruction memory or the address region allocated to
the XLMI port. Attempts to direct the S32C1I at these
addresses will cause an exception.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-05 00:05:15 +08:00
hujun5
dabf589940 remove redundant judgments *running_task != NULL
reason:
In irq, g_running_tasks is always valid.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 22:50:08 +08:00
wangmingrong1
cc88063646 debug symbol level: Use config instead
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-04 22:36:45 +08:00
zhangyuan29
dcea1b90e7 arch_atomic: only support atomic_xx and atomic64_xx function
Modify the kernel to use only atomic_xx and atomic64_xx interfaces,
avoiding the use of sizeof or typeof to determine the type of
atomic operations, thereby simplifying the kernel's atomic
interface operations.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-04 14:03:14 +01:00
wangmingrong1
eed302b8bb virtio: Add virtio version check
In the source code of qemu or linux, there is a check for the virtio version
/* Check device version */
priv->version = readl(priv->base + VIRTIO_MMIO_VERSION);
if (priv->version < 1 || priv->version > 2) {
	debug("(%s): version %d not supported!\n",
	udev->name, priv->version);
	return 0;
}
/* Check device ID */
uc_priv->device = readl(priv->base + VIRTIO_MMIO_DEVICE_ID);
if (uc_priv->device == 0) {
	/*
	* virtio-mmio device with an ID 0 is a (dummy) placeholder
	* with no function. End probing now with no error reported.
	*/
	return 0;
}

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-04 19:49:26 +08:00
Masayuki Ishikawa
6e8375f97b arch: lc823450: Add missing license info to lc823450_symbols.ld
Summary:
- The file includes symbol information provided by ON Semiconductor.
- The license information is the same as lc823450_sdc.c

Impact:
- None

Testing:
- lc823450-xgevk:rndis (build only)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2024-12-04 12:04:38 +01:00
chao an
93a34b1992 drivers/timers: export arch timer api to support higher resolution
Before:
[  384.149000] [CPU0] [ 5] Hello World!
After:
[  384.149947] [CPU0] [ 5] Hello World!

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-04 10:52:26 +01:00
hujun5
79a1ebb9cd rp23xx: use small lock in arch/arm/src/rp23xx/rp23xx_usbdev.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 14:48:48 +08:00
hujun5
bc844509e2 addrenv: Ensure that the transmission parameter of addrenv_switch is not NULL
reason:
avoid obtaining this_task multiple times.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 14:20:12 +08:00
hujun5
5ed007a0f3 bt_atomic: use atomic macro to replace wireless/bluetooth/bt_atomic.c
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-04 13:54:45 +08:00
Tiago Medicci Serrano
5358f5b940 libm: Do not link the toolchain's libm unless explicitly selected
Fix CMake-based build system to include the toolchain's libm only
when `CONFIG_LIBM_TOOLCHAIN` is selected. Before this commit, if
the user selected `CONFIG_LIBM_NEWLIB`, for instance, the build
system would still link the toolchain's libm functions instead of
the ones provided by newlib.

PS: this commit applies the same changes previously introduced for
the other architectures.
2024-12-04 09:30:33 +08:00
Tiago Medicci Serrano
5456668ae8 libm/newlib: Add arch-specific source code first to CSRCS
Source code under `newlib/newlib/newlib/libm/machine/$(ARCH)/*.c`
should be added before common source code from `../../common/*.c`.
Take `newlib/newlib/newlib/libm/machine/riscv/s_fma.c` as an
example:

```

double
fma (double x, double y, double z)
{
        double result;
        asm ("fmadd.d %0, %1, %2, %3" : "=f" (result) : "f" (x), "f" (y), "f" (z));
        return result;
}

```

Note that the common `s_fma.c` will be included by the source file
directly. The order of adding the files to CSRCS matters here.

Although the CMake-based build system does not have the same build
problem of including the a source-file with the same in the wrong
order, this commit also changes the order of inclusion for CMake
too to keep it consistent.
2024-12-04 02:10:41 +08:00
Tiago Medicci Serrano
80dd961f23 libm: Do not link the toolchain's libm unless explicitly selected
Fix CMake-based build system to include the toolchain's libm only
when `CONFIG_LIBM_TOOLCHAIN` is selected. Before this commit, if
the user selected `CONFIG_LIBM_NEWLIB`, for instance, the build
system would still link the toolchain's libm functions instead of
the ones provided by newlib.
2024-12-04 02:06:17 +08:00
hujun5
d5fba177b1 cxd56xx: use small lock in arch/arm/src/cxd56xx/cxd56_nxaudio_src.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-03 23:51:47 +08:00
wangmingrong1
893e67745b gcc/gcov: Add instrumentation function
Some functions will insert these functions:
void __gcov_execve(void)
{
}
void __gcov_execv(void)
{
}
void __gcov_fork(void)
{
}

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-03 23:51:12 +08:00
hujun5
4f3f9751c1 fix compile error
lcd/st7565.c:107:4: warning: #warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255" [-Wcpp]
  107 | #  warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255"
      |    ^~~~~~~
chip/lc823450_cpuindex.c:36: warning: "CORE_COREID" redefined
   36 | #define CORE_COREID (LC823450_CORE_BASE + 0x0)
      |
In file included from /home/hujun5/downloads1/vela_sim/nuttx/arch/arm/src/common/arm_internal.h:37,
                 from chip/lc823450_cpuindex.c:29:
/home/hujun5/downloads1/vela_sim/nuttx/arch/arm/src/chip/chip.h:48: note: this is the location of the previous definition
   48 | #define CORE_COREID         (LC823450_CORE_BASE + 0)
      |
chip/lc823450_cpuindex.c:37: warning: "CORE_COREID_ID" redefined
   37 | #define   CORE_COREID_ID  (0x1 << 0)
      |
/home/hujun5/downloads1/vela_sim/nuttx/arch/arm/src/chip/chip.h:49: note: this is the location of the previous definition
   49 | #define CORE_COREID_ID      (1 << 0)

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-03 18:27:54 +08:00
hujun5
2b22ee03d6 arm: remove g_running_tasks[this_cpu()] = NULL
reason:
We hope to keep g_running_tasks valid forever.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-03 18:27:54 +08:00
hujun5
03af486d68 arm: remove up_set_current_regs/up_current_regs
reason:
up_set_current_regs initially had two functions:

1: To mark the entry into an interrupt state.
2: To record the context before an interrupt/exception. If we switch to
   a new task, we need to store the upcoming context regs by calling up_set_current_regs(regs).

Currently, we record the context in other ways, so the second function is obsolete.
Therefore, we need to rename up_set_current_regs to better reflect its actual meaning,
which is solely to mark an interrupt.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-03 18:27:54 +08:00
wangmingrong1
95ed02ec22 arm64/qemu: Add 9pfs configuration
Convenient for qemu debugging and adding ci check
We can learn to use the following command to mount 9pfs on qemu64:

qemu-system-aarch64 -cpu max -nographic \
        -machine virt,virtualization=on,gic-version=3,mte=on \
        -fsdev local,security_model=none,id=fsdev0,path=/xxxx -device virtio-9p-device,id=fs0,fsdev=fsdev0,mount_tag=host \
        -chardev stdio,id=con,mux=on, -serial chardev:con \
        -mon chardev=con,mode=readline  -kernel ./nuttx/nutt

mkdir mnt
mount -t v9fs -o trans=virtio,tag=host mnt

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-03 18:19:09 +08:00
wangmingrong1
77d993623c boards/mte: Dependencies changed, so need to delete it now
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-03 15:45:53 +08:00
stbenn
9b52710691 board/nucleo-h563zi: Add HSE option
Add an option to use HSE on the Nucleo-H563ZI with board modification. This is enabled through board Kconfig.
It supplies the same PLL output frequencies using the HSE instead of HSI, for significantly more precise clocks.
2024-12-03 09:39:13 +08:00
chao an
5cd3eed323 arm64/imx8: fix build break
Error: chip/imx8qm_lowputc.S:23:1: error: "/*" within comment [-Werror=comment]
   23 | /****************************************************************************
      |
Signed-off-by: chao an <anchao@lixiang.com>
2024-12-03 09:38:35 +08:00
gaohedong
9fb84700a8 com/can: Remove unnecessary judgment logic
The feature of preventing the same ID frame rotation should be done in the lowerhalf, not in the upperhalf.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2024-12-03 08:48:18 +08:00
Tiago Medicci Serrano
1dd8178bdc float.h: Define FLT_ROUNDS if not defined by toolchain previously
This value is necessary to build third-party applications on NuttX.
If not defined previously by the toolchain, define it at NuttX's
`lib/float.h`.
2024-12-03 08:38:58 +08:00
Kyle Wilson
e1e1d534af Add STM32H5 FDCAN Hardware File
Adding the STM32H5 FDCAN Hardware definitions. The register set is identical to the STM32G4. No major changes other than changing G4 to H5 and removing ifdef requirement for STM32G4.

Fixed style issues
2024-12-03 08:33:31 +08:00
Kyle Wilson
d417e1525b First commit of STM32H5 SPI Hardware file.
This file is heavily based on the STM32H7 implementation. CFG1_BPASS and UDRCFG were the main differences.
2024-12-03 08:32:50 +08:00
hujun5
3a4b8edf2c riscv: remove up_set_current_regs/up_current_regs
reason:
up_set_current_regs initially had two functions:

1: To mark the entry into an interrupt state.
2: To record the context before an interrupt/exception. If we switch to a new task, we need to store the upcoming context regs by calling up_set_current_regs(regs).

Currently, we record the context in other ways, so the second function is obsolete. Therefore, we need to rename up_set_current_regs to better reflect its actual meaning, which is solely to mark an interrupt.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-02 22:46:04 +08:00
cuiziwei
7bc4671a76 libcxx/CMakeLists.txt: Remove unnecessary flags.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-12-02 22:44:41 +08:00
wangjianyu3
d59e6d98d5 include/usbdev_trace: Fix argument and return value of macro usbtrace_enumerate()
Errors

  1. Not return int value

     usbmsc_main.c: In function 'msconn_main':
     usbmsc_main.c:645:55: error: expected expression before ';' token
       645 |       ret = usbtrace_enumerate(usbmsc_enumerate, NULL);

  2. Error argument number

     CC:  usbmsc_main.c usbmsc_main.c: In function 'msconn_main':
     usbmsc_main.c:645:54: error: macro "usbtrace_enumerate" passed 2 arguments, but takes just 1
       645 |       ret = usbtrace_enumerate(usbmsc_enumerate, NULL);

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-12-02 22:43:51 +08:00
Alin Jerpelea
879d38d511 arch/arm64: 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-12-02 22:43:23 +08:00
Alin Jerpelea
7428644711 arch/avr: 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-12-02 22:43:23 +08:00
Alin Jerpelea
6e268f3c45 arch/ceva: 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-12-02 22:43:23 +08:00