Commit graph

24187 commits

Author SHA1 Message Date
hujun5
61f0c97193 wqueue: wqueue remove csection
reason:
We decouple semcount from business logic
by using an independent counting variable,
which allows us to remove critical sections in many cases.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-15 17:26:07 +08:00
wangzhi16
e211904640 Use small lock to protect usbdev and endpoint in arch renesas.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-15 17:15:49 +08:00
wangzhi16
ac2b495945 Use small lock to protect usbdev and endpoint in arch mips
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-15 17:14:23 +08:00
hujun5
e908fb6d51 armv7a/r: fix regression from https://github.com/apache/nuttx/pull/14596
reason:
In kernel mode, sighand_test() may failed.
because nxsig_unmask_pendingsignal may change tcb->xcp.regs,and we should update return value(regs).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-15 17:13:29 +08:00
Jukka Laitinen
8d635ed0bf arch/arm64/src/common/arm64_addrenv_pgmap.c: Add normal region flags to kernel page mappings
In up_addrenv_kmap_pages, the MMU_MT_NORMAL_FLAGS are needed for the MMU
mappings in order for the memory & caches to function normally

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-01-15 17:10:57 +08:00
wangzhi16
4558db18e4 Use small lock to protect usbdev and endpoint in sim.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-15 17:04:58 +08:00
Yanfeng Liu
95f11e02c1 arch/arm/qemu: select NEON at processor level
This moves ARM_HAVE_NEON from QEMU ARM family level down to the
processor level as not all processors have it (e.g. Cortex R5).

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-15 16:54:10 +08:00
wangzhi16
007a3fffac Use small lock to protect usbdev and endpoint in AVR.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-15 10:05:16 +08:00
Kyle Wilson
9701b0f660 Fix memory map for EMAC, ICACHE, and DCACHE.
It was dis overed during debug of the ethernet driver that the EMAC base was incorrect. After examination, it was determined that ICACHE and DCACHE also had incorrect base addresses. This commit fixes the base addresses according to the reference manual.
2025-01-15 00:07:43 +08:00
Huang Qi
b1d97688b7 arch/risc-v: Remove riscv_mhartid
Summary:
This commit removes the riscv_mhartid function and replaces all its
usages with up_cpu_index. The functionality is consolidated into
up_cpu_index which provides a more consistent API for getting the
current CPU/hart ID across different execution modes (machine/supervisor).

Impact:
- Removes riscv_mhartid.S and its references from build systems
- Updates all arch-specific code to use up_cpu_index instead
- Adds more detailed documentation for up_cpu_index behavior
- Changes the implementation of up_cpu_index to use percpu scratch
register in supervisor mode

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-14 11:48:40 -03:00
Huang Qi
6e82ca3013 arch/risc-v: Decouple ARCH_RV_CPUID_MAP and up_cpu_index()
Summary:
- Separated CPU index functionality from CPU ID mapping configuration
- Moved CPU ID mapping functions to new riscv_cpuidmap.c file
- Made up_cpu_index() implementation dependent on ARCH_USE_S_MODE
- Updated build system to handle new file organization

Impact:
- Improves code organization by separating concerns between basic CPU index
functionality and advanced CPU ID mapping features
- Makes CPU index functionality available independently of CPU ID mapping
- Reduces conditional compilation complexity in header files
- Better aligns with RISC-V architecture modes (M-mode vs S-mode)

Testing:
GitHub CI and local testing

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-14 20:19:37 +08:00
Yanfeng Liu
d385d9f7d2 arm/common: fix KERNEL build vfork
This fixes vfork test for kernel build, checked with qemu-armv7a:nsh
and qemu-armv7a:knsh

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-14 20:12:31 +08:00
YAMAMOTO Takashi
b88aba5ddc esp32s2: apply wifi deadlock fix from esp32s3
cf. https://github.com/apache/nuttx/pull/15445
2025-01-14 19:29:28 +08:00
YAMAMOTO Takashi
c954af0de1 esp32: apply wifi deadlock fix from esp32s3
cf. https://github.com/apache/nuttx/pull/15445
2025-01-14 19:29:28 +08:00
YAMAMOTO Takashi
7a54488dbb esp32c6: apply wifi deadlock fix from esp32s3
cf. https://github.com/apache/nuttx/pull/15445
2025-01-14 19:29:28 +08:00
YAMAMOTO Takashi
93dbdd4a62 esp32c3: apply wifi deadlock fix from esp32s3
cf. https://github.com/apache/nuttx/pull/15445
2025-01-14 19:29:28 +08:00
YAMAMOTO Takashi
847c1a6151 esp32c3-legacy: apply wifi deadlock fix from esp32s3
cf. https://github.com/apache/nuttx/pull/15445
2025-01-14 19:29:28 +08:00
chenrun1
a87c194b40 goldfish_memorymap:Resize VIRT_FLASH_PSECTION
Sumamry:
  Adjust VIRT_FLASH_PSECTION from 0x00000000-0x08000000 -> 0x00600000-0x08000000
  The above changes avoid the problem of directly restarting when the process accesses/executes at address 0x0 without causing assert

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2025-01-14 19:28:54 +08:00
wangmingrong1
df7d062713 kasan/kconfig: Add config CONFIG_MM_KASAN_INSTRUMENT
It will be used to distinguish between hardware KASan and software KASan. Hardware KASan does not need to use plug-in

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-14 14:01:48 +08:00
chao an
c94a99326e arch/arm: read STM32L4_GTIM_CNT_OFFSET should use same lock
Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-14 08:38:06 +08:00
chao an
c6126bcdc4 arch/arm: fix regression by spinlock change
| commit c96b8cdfdd
| Author: hujun5 <hujun5@xiaomi.com>
| Date:   Mon Dec 23 16:59:20 2024 +0800
|
|     use small lock in following files:

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-14 08:38:06 +08:00
chao an
3d3db4a375 arm/imx9: sched_unlock should called after spin_unlock()
fix deadlock if sched_unlock switch out to other task

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-14 08:36:53 +08:00
chao an
a9ec6e9b3a arch/arm64: fix typo spin_lock_irqsave -> spin_unlock_irqrestore
should be spin_unlock_irqrestore

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-14 01:11:44 +08:00
hujun5
bac838b888 armv7a: Amp mode support
reason:
In AMP mode, we can also use SGI as an inter-core interrupt,
and ensure that arm_gic0_initialize is called only once.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-14 00:50:59 +08:00
Eren Terzioglu
2bc36544d9 esp32[c3]: Fix build errors when using mcuboot 2025-01-13 23:59:14 +08:00
wangmingrong1
0fda25fc96 arm64: assert support dump sctlr_el1 register
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-13 17:25:41 +08:00
liwenxiang1
2454c2b76d arch/x86_64:Resolve the issue of abnormal interrupt numbers triggered when KASAN is enabled
When assembly code calls a C function, it needs to save the context. After enabling KASAN, the inserted __asan_load8_noabort function uses the rsi register, causing the value of rsi in the interrupt handler to be modified, which results in an incorrect interrupt number.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-01-13 09:08:37 +01:00
Ian Douglas Scott
351db57e35 arch/arm/rp23xx: Set priority for svcall exception
Fixes https://github.com/apache/nuttx/issues/15503.

Signed-off-by: Ian Douglas Scott <ian@iandouglasscott.com>
2025-01-13 12:38:43 +08:00
wangmingrong1
2149d89336 macro/align: Use ALIGN_UP and ALIGN_DOWN uniformly
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-12 16:48:35 +08:00
Yanfeng Liu
71a4e86718 risc-v/Toolchain.defs: guard -r in LDELFFLAGS
This guards use of `-r` in LDELFFLAGS in risc-v common/Toolchain.defs so
that it is only used when BINFMT_ELF_RELOCATABLE is selected.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-01-12 16:47:54 +08:00
Leo Chung
63c8de5f03 sim: Fixes the linker 'noexecstack' warning
Signed-off-by: Leo Chung <gewalalb@gmail.com>
2025-01-12 16:17:52 +08:00
Yanfeng Liu
ff488133c9 qemu-armv7a: allows ELF_EXECUTABLE
This allows using BINFMT_ELF_EXECUTABLE for qemu-armv7a target.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-11 18:54:36 +08:00
Yanfeng Liu
48846954d8 arm/Toolchain.defs: skip -r for ELF_EXECUTABLE
This avoids using `-r` option when linking executable programs.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-11 18:54:36 +08:00
Kyle Wilson
558fe83f6d Add Timer Support to STM32H5 ADC Driver
Added support for using timers with ADCs. Updated Kconfig to support TRGO2, although driver support for TRGO and TRGO2 not developed yet. Updated hardware/stm32_tim.h with missing CCER bits needed for compilation.
2025-01-11 12:04:48 +08:00
hujun5
69ee240b45 rp2040_pio: remove spin_lock_irqsave(NULL) in arch/arm/src/rp2040/rp2040_pio.c
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-10 22:35:14 +08:00
wangzhi16
b9837bed08 use small lock to protect g_ram_vectors, involving armv6-m, armv7-m, armv8-m.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:33:23 +08:00
wangzhi16
d84ba608a1 use small lock in following files:
arch/arm/src/am335x/am335x_can.c
    arch/arm/src/am335x/am335x_gpio.c
    arch/arm/src/am335x/am335x_i2c.c
    arch/arm/src/am335x/am335x_irq.c
    arch/arm/src/am335x/am335x_serial.c
    arch/arm64/src/imx9/imx9_gpio.c
    arch/arm64/src/imx9/imx9_lpi2c.c
    arch/arm64/src/imx9/imx9_lpspi.c
    arch/arm64/src/imx9/imx9_usbdev.c
    arch/x86_64/src/intel64/intel64_tsc_tickless.c

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:32:23 +08:00
Huang Qi
58c95f5d85 armv7-a/Toolchain.defs: Update LLVM arch type to thumbv7a
Changed the LLVM architecture type from thumbv7 to thumbv7a in
Toolchain.defs to better match the ARMv7-A architecture specification.

This change ensures proper code generation and optimization for
Cortex-A series processors when using the Thumb instruction set.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 21:21:26 +08:00
wangzhi16
f179cb81b5 use small lock to protect register about l2cc, involving the following files:
arch/arm/src/armv7-a/arm_l2cc_pl310.c
arch/arm/src/armv7-r/arm_l2cc_pl310.c
arch/arm/src/armv8-r/arm_l2cc_pl310.c

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2025-01-10 21:20:52 +08:00
Huang Qi
6dbdfb3cd5 arch/arm: Add LLVM configuration to CMake
Added LLVM-specific configuration variables to ARM architecture CMake files:
- LLVM_ARCHTYPE for architecture variant (thumbv6m, thumbv7a, etc)
- LLVM_CPUTYPE for CPU target (cortex-m0, cortex-a5, etc)
- LLVM_ABITYPE for ABI (eabi/eabihf)

These changes enable LLVM/Clang toolchain support while maintaining
compatibility with existing GCC configurations. The LLVM variables
are set based on the same architecture/CPU/FPU configurations used
for GCC flags.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 16:58:01 +08:00
Huang Qi
f2934935d0 armv7-a.cmake: Improve FPU options table formatting and readability
Reformatted the FPU options table to use a clearer markdown-style table format
with proper alignment and column headers. Added visual separators (~~~) to make
the table stand out from surrounding code. Improved consistency in column widths
and fixed line wrapping for better readability.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 16:58:01 +08:00
Kyle Wilson
9783c88425 Initial STM32H5 Timers Commit
Used the STM32H7 as a reference.

Removed APB enabling from stm32h5xx_rcc.c. This is done in timer initialization, like STM32H7.

Also removed LPTIM. Will add later.

tim_lowerhalf: Timers 9, 10, and 11 removed. Timers 15,16, and 17 added.

Removed low-power timers from Kconfig. Not implemented yet.

Style Updates

Added stm32_tim_enable and stm32_tim_disable to Timer operations.
2025-01-10 09:40:10 +01:00
wangmingrong1
e5e9032ea0 arm64/vector: Reduce two useless instructions
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-10 14:59:20 +08:00
wangmingrong1
d22e6d7489 arm64/sctlr: Allows thread to independent control the switch of sctlr
The method is the same as the method of saving the current DAIF state of the thread
It will pave the way for the future implementation of hwasan's memory management
Allows each thread to independently control the mte switch function

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-10 14:59:20 +08:00
Huang Qi
1b8d5a4367 arch/risc-v: Refactor LLVM CPU type handling in Toolchain.cmake
- Replace direct string comparisons with regex pattern matching for ARCHCPUEXTFLAGS
- Change from using LLVM_CPUFLAGS list to setting LLVM_CPUTYPE directly
- Simplify CPU type detection logic while maintaining same functionality
- Use more consistent string variable naming convention

This change makes the CPU type detection more flexible and maintainable
while keeping the same behavior for supported RISC-V configurations.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-10 02:06:19 +08:00
Huang Qi
cfd0cc0d1a Remove duplicate includes across multiple files
This commit cleans up redundant header file includes throughout the codebase.
 The changes include:

 - Removing duplicate #include directives that were present in the same file
 - Consolidating includes that were split across multiple lines unnecessarily
 - Removing unused includes that were no longer needed
 - Fixing some formatting issues with includes

 The changes improve code organization and maintainability by:
 - Reducing unnecessary dependencies
 - Making include dependencies more explicit
 - Following consistent include patterns
 - Removing dead code

 No functional changes are made - this is purely a code cleanup commit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-09 23:30:23 +08:00
jerryslhao
bb4eb12fa3 arch/arm/stm32:add stm32g4 spi driver.
Signed-off-by: jerryslhao <jerryslhao@gmail.com>
2025-01-09 09:25:10 +01:00
nuttxs
cb980cc977 arch/esp32s3_partition: Read data from SPI Flash
at designated address (with decryption)
2025-01-09 07:52:40 +08:00
raiden00pl
b3120e535b arch/arm/stm32{|f0l0g0|f7|h5|h7}/i2c: raise compilation error when configuration is invalid
Raise compilation error when I2C configuration is invalid.
It's better to catch invalid clock configuration during compilation instead of
producing binary that doesn't work as expected anyway.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-01-09 07:49:39 +08:00
Huang Qi
00794b92c4 arch/risc-v: Improve LLVM CPU type detection with findstring
Use findstring instead of direct equality checks for LLVM_CPUTYPE
conditions to better handle ARCHCPUEXTFLAGS that may contain additional
ISA extensions. This makes the CPU type detection more robust when
dealing with extended instruction sets while still ensuring the required
base ISA extensions are present.

For example, ARCHCPUEXTFLAGS="imc_zicsr_zifencei" will now correctly
match as sifive-e20 rather than failing the exact match check.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-08 23:58:19 +08:00