Commit graph

24339 commits

Author SHA1 Message Date
Jukka Laitinen
fdaeb00910 arch/imx9/enet: Move imx9_phy_boardinitialize to "ifup" phase
Move the board-specific phy initialization from early boot into ifup phase. The
board specific phy initialization may need to implement delays, or bus
communication, for example via i2c bus.

These OS services are not necessarily available yet in arm64_netinitialize, and
PHY initialization is not necessary until the driver actually starts using it.
In addition, this allows the board to reset the ethernet phy at every ifup,
if needed for error recover.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-02-01 09:41:50 -03:00
Jukka Laitinen
15fa005e5b arch/imx9/enet: Correct configuration flag IMX9_ENET1_PHYINIT
The function is for any ethernet interface, given as paramter to the function,
it is not for ENET1 only. The correct name is already used
in the code, but the Kconfig had it wrong.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2026-02-01 09:41:50 -03:00
aviralgarg05
a4315fbb45 arch/arm/src: Fix Ethernet RUNNING status regression in IMXRT and STM32(F7/H7).
Add missing netdev_carrier_on() and netdev_carrier_off() calls to
imxrt_enet.c, stm32f7/stm32_ethernet.c, stm32h7/stm32_ethernet.c,
and stm32/stm32_eth.c. This ensures the interfaces correctly report
IFF_RUNNING status, as required by recent networking stack changes.

Verification:
- imxrt_enet.c pass ./tools/checkpatch.sh.
- stm32f7/stm32_ethernet.c pass ./tools/checkpatch.sh.
- stm32h7/stm32_ethernet.c pass ./tools/checkpatch.sh.
- stm32/stm32_eth.c pass ./tools/checkpatch.sh.
- Manual compilation verification for IMXRT1060 driver.
- Addresses CI failures in arm-13 job (STM32H7).

Signed-off-by: Aviral Garg <gargaviral99@gmail.com>
2026-02-01 01:12:18 +08:00
wangmingrong1
28026af824 arch/sim: Add sigdelset to nuttx-names.in
sigdelset is used in up_enable_irq: sigdelset(&act.sa_mask, SIGSTOP);

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-01-31 14:14:32 +08:00
nope
f375093a25 arch/esp32s3/spi: make sure spi don't send wrong bytes when dma is enabled
SPI transmits incorrect bytes when DMA is enabled and `txbuffer` of
`esp32s3_spi_dma_exchange()` is NULL, causing mounted FAT32 SD cards
to fail with -ENODEV during read operations.

Signed-off-by: liu <liu334275@gmail.com>
2026-01-31 02:50:52 +08:00
paolo
c63b0510fb rp23xx/rp23xx-rv: Fix GPIO interrupt handler for RP2350B variant.
The GPIO interrupt handler had hardcoded values that only worked
correctly for RP2350A (30 GPIOs). For RP2350B (48 GPIOs):

- Loop count was hardcoded to 6 registers but should be computed
  based on RP23XX_GPIO_NUM (4 for RP2350A, 6 for RP2350B)
- Reserved bits mask was always applied at register index 3, but
  for RP2350B register 3 contains valid GPIOs 24-31. This caused
  interrupts for GPIOs 30-31 to be incorrectly discarded
- PWM port validation rejected valid ports 8-11 on RP2350B which
  has 12 PWM slices instead of 8

Changes:
- Add RP23XX_GPIO_NREGS macro to compute number of interrupt registers
- Use conditional compilation to only mask reserved bits on RP2350A
  where the last register has 6 valid GPIOs (bits 0-23)
- Fix PWM port validation to allow 12 ports on RP2350B

Signed-off-by: paolo <paolo.volpi@gmail.com>
2026-01-31 02:43:51 +08:00
humzak711
46e03d0471 arch/x86_64: use pause to reduce power consumption in spin wait loops
Signed-off-by: humzak711 <humzak711@gmail.com>

This commit defines the UP_WFE() macro as the 'pause' instruction for
x86_64. This optimization reduces power consumption and prevents
pipeline flushes caused by memory ordering violations during contended
spinlock acqusitions
2026-01-30 08:09:44 -03:00
Peter van der Perk
79ce1647da arch/arm: GPIO IMX9 Add support for IRQ line1 and GPIO5
Adds support to select irq line 1 to share the same GPIO with Linux
Also added GPIO5 definiton for IRQ

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-28 21:13:31 +08:00
Peter van der Perk
99501bba9a arch/arm: LPSPI imx9 add support for 2nd CS
If pinconfig are defined for CS1 then configure CS

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-28 21:13:19 +08:00
zhenwei fang
2614693bc0 mps:fix AN524 Kconfig symbol (MPS3, not MPS2)
The code currently checks CONFIG_ARCH_CHIP_MPS2_AN524, but
the corresponding Kconfig option is ARCH_CHIP_MPS3_AN524(i.e.
 CONFIG_ARCH_CHIP_MPS3_AN524) in arch/arm/src/mps/Kconfig

Signed-off-by: zhenwei fang <fangzhenwei@bytedance.com>
2026-01-28 18:20:11 +08:00
hujun5
bb562cf8bf arch/armv8-r64: userspace PMU access
Enable ARCH_HAVE_PERF_EVENTS_USER_ACCESS capability for Cortex-R82 to
allow userspace applications to directly access hardware performance
counters. Move up_perf_gettime() outside kernel-only block so it can
be called from userspace for efficient profiling.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-27 21:57:37 +08:00
ganjing
206aaa8612 arch/sim: improve heap management on Simulator
and proper accounting of heap metadata

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-01-27 21:27:53 +08:00
ganjing
e941b18e29 mm/umm: Allow customizing the implementation of umm heap
and migrate arch/sim from the customized mm_heap to
umm_heap, so the default mm_heap implementation can
still be used(e.g. shared memory in OpenAMP).

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-01-27 21:27:53 +08:00
wangzhi16
364a633ec3 sched/signal: Optimize code logic
Adjust the up_schedule_sigaction function to facilitate subsequent spinlock optimization work.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-27 21:24:31 +08:00
xuxin19
80505da579 cmake(bugfix):remove unused libmad link in SIM build
libmad has been ported into apps
and does not require linking to the host.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-27 20:54:26 +08:00
xuxin19
19d6806dbe cmake(bugfix):fix armv8m missing compile option in CMake
fix typo

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-27 20:54:26 +08:00
wangchengdong
d9a0cf46ac arch/risc-v: fix timer initialization for SMP using mtimer
Correct timer initialization issue in SMP mode using mtimer to ensure
  per-hart timers are properly set up during boot.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-27 19:34:45 +08:00
wangzhi16
c7e7711db5 sched/spinlock: Call spinlock nopreempt when need disable context switch.
Using spin_lock_irqsave_nopreempt and spin_unlock_irqrestore_nopreempt to replace the following case.
flags = spin_lock_irqsave(lock);
sched_lock();
.....
spin_unlock_irqrestore(lock, flags);
sched_unlock();

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-27 19:33:58 +08:00
liwenxiang1
6d9ed4217a shced/irq: Add up_irq_to_ndx interface
Use architecture-specific up_irq_to_ndx() interface to map IRQ numbers to vector table indices

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-27 10:34:13 +08:00
nuttxs
fa2d2b8898 boards/xtensa: fixes for compilation and start-up issues when legacy
boot mode is configured

1. Explicitly define the .rtc_reserved section to ensure RTC data
that requires fixed address is correctly placed and does not
conflict with other sections
2. When legacy boot is configured, vecbase must also be set and
clear the BSS section
3. Cache must be disabled during Flash operations, so all
Flash-operation-related functions must be placed in IRAM
(internal RAM). Update the linker script for legacy boot mode

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2026-01-26 19:22:14 -03:00
Alexey Matveev
d57899847a arch/stm32: Add counter reset function
Added stm32_cap_rstcounter() function to reset the capture counter
by generating an update event. The function is integrated into the
capture operations structure and exposed via STM32_CAP_RSTCOUNTER
macro. Also added TI3 and TI4 input mappings for extended capture
channel support.

Signed-off-by: Alexey Matveev <tippet@yandex.ru>
2026-01-26 19:13:22 -03:00
Eren Terzioglu
2dbdcd603f arch/xtensa: Fix esp32s2 SPI errors
Fix esp32s2 SPI DMA and SPI3 errors

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-01-27 03:09:34 +08:00
hujun5
226443fb81 tricore: support SYSCALL_HOOKS
Enable SYSCALL_HOOKS architecture capability for TriCore platform.
This allows runtime interception and hooking of system calls on
TriCore architecture, enabling profiling, tracing, and debugging features.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 21:22:34 +08:00
Yanfeng Liu
8f0e30b07c libc/perf: userspace PMU access
Add ARCH_HAVE_PERF_EVENTS_USER_ACCESS capability to allow applications
to directly access hardware perf counters via perf_gettime() from
userspace, enabling performance monitoring and profiling without syscalls.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2026-01-26 21:14:38 +08:00
zhangyuan29
197ed9fc94 sched/clock: add perf overflow offset for clock perf
dd ARCH_PERF_COUNT_BITWIDTH configuration to support architectures
with different perf counter bit widths (TriCore 31-bit, others 32-bit),
enabling proper overflow correction across diverse platforms.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2026-01-26 21:14:38 +08:00
hujun5
6c18cfd472 fvp: change memory map and Optimize MPU configuration
Extract fixed MPU region configuration into arm64_mpu_init_regiions() function to
allow board-specific initialization. Refactor memory layout to minimize fixed region
requirements and improve dynamic MPU configuration flexibility for FVP platform.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 20:59:04 +08:00
hujun5
4d956952c1 arch/arm64/src/common/arm64_mpu.h: simplified macro definition
Reduce macro definition duplication by consolidating REGION_*_ATTR macros into a unified
SHAREABLE_MSK definition. This improves code maintainability and reduces configuration
complexity while preserving all attribute functionality.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 20:59:04 +08:00
hujun5
41847b7445 arm64_mpu: Make the MPU interface of cortex-r82 consistent with other archs.
Refactor mpu_modify_region() and mpu_configure_region() functions to use direct parameters
(base, size, flags) instead of struct pointers. This ensures consistent interface across
all ARM64 MPU implementations including Cortex-R82, improving code uniformity.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 20:59:04 +08:00
hujun5
386457440a arm64_mpu.h: rename some MPU ATTR
Rename MPU region attribute macros (REGION_RAM_ATTR → REGION_RW_NA_ATTR,
REGION_URAM_ATTR → REGION_RW_RW_ATTR) to explicitly indicate access permissions.
Add new REGION_RO_RO_ATTR and REGION_RO_NA_ATTR macros for read-only region definitions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 20:59:04 +08:00
hujun5
0383808b32 arm64/gic: remove GIC single security state configuration check
According to ARM GIC documentation, GICD_CTLR.DS bit is read-only and cannot be
modified by software. Remove the unnecessary runtime check that attempts to set this bit
for CONFIG_ARCH_SINGLE_SECURITY_STATE configuration, simplifying the GIC initialization flow.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 19:43:54 +08:00
hujun5
e9c33195a3 arm64: add mpu_usedregion interface
Add mpu_usedregion() function to query the number of MPU regions currently in use.
This interface complements existing mpu_allocregion() and mpu_freeregion() functions,
allowing callers to determine the occupancy of the MPU region pool.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 19:43:54 +08:00
hujun5
7d30afa589 arm64: enable mpu background region
Enable SCTLR_EL1.BR bit to activate MPU background region support. This simplifies MPU
configuration by providing a default MAIR attribute for unmapped regions, reducing the
need for exhaustive region coverage and improving MPU flexibility.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 19:43:54 +08:00
Gao Jiawei
564c9d7dcd arm: systick: fix off-by-one in SysTick RELOAD programming
ARM specifies that SysTick RELOAD must be programmed with N-1 to get a period of N CPU cycles.
Adjust the timeout/reload conversions accordingly: subtract 1 when writing RELOAD and add 1 back when converting RELOAD to a timeout/interval.
Also clamp RELOAD to the valid 24-bit range (1..0x00ffffff) for Armv7-M/Armv8-M to avoid invalid values.
Reference: https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/System-timer--SysTick/SysTick-Reload-Value-Register

Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
2026-01-26 19:34:00 +08:00
hujun5
78d05ff811 arm64: remove busy wait flag
Replace CONFIG_ARM64_SMP_BUSY_WAIT_FLAG_ADDR with global variable g_smp_busy_wait_flag for
SMP CPU synchronization. This improves flexibility over fixed memory addresses and aligns
with standard kernel variable patterns for multi-core startup.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 16:27:19 +08:00
hujun5
415be7f5b3 fvp-v8r: protect build support
Enable fvp_userspace.c compilation when
CONFIG_BUILD_PROTECTED is enabled, providing user-space
isolation support for FVP platform. Include
board memory map definitions for protected build
configuration and update MPU regions for
kernel/user space separation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 16:27:19 +08:00
hujun5
be9d0665e4 arm64: support protectbuild
Add CONFIG_BUILD_PROTECTED support alongside
CONFIG_BUILD_KERNEL for saved register
pointers and task startup functions. Fix
arm64_fork() to properly handle Thumb bit masking.
Enable weak_function for up_allocate_kheap()
to support board-specific heap allocation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-26 16:27:19 +08:00
Max Kriegleder
c5d57fab83 arch/arm/nrf{52|53|91}: fix timer timeout value (overflow issue)
When setting the timeout value, an overflow occurs. Also, if
NRF52_TIMER_PER > 1000000, the macro will evaluate to zero in
its current form.

Signed-off-by: Max Kriegleder <max.kriegleder@gmail.com>
2026-01-26 10:55:28 +08:00
simbit18
92bb15b85f arch/arm/src/S32K1xx: CMake build implemented for NXP S32K1 Family
- added NXP S32K1 Family

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-01-26 10:42:24 +08:00
yukangzhi
b7fd8a268d arch/tricore: add NMI trap handler (weak)
Add support for handling non-maskable interrupts (NMI) on TriCore
platforms. The NMI trap handler `tricore_nmitrap()` is provided as a weak
function that prints diagnostic information and invokes a panic with
register context. The main trap dispatcher will invoke `tricore_nmitrap`
when an NMI trap class is detected.

This change improves diagnostics when watchdog-induced NMIs or other
non-maskable exceptions occur during runtime.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-24 23:32:03 +08:00
pangzhen1
7acb0df84f arch/arm: Add the macro definitions for CFI instructions for greenhills compiler
Add the macro definitions for CFI instructions for greenhills compiler

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-24 19:32:25 +08:00
trns1997
9159f6e353 build/cmake: Add toolchain C++ library linking for all platforms.
Extend CONFIG_LIBCXXTOOLCHAIN support to all remaining platforms
in CMake builds by explicitly locating and linking libstdc++.a
from the toolchain. This prevents build failures caused by STL
header/library mismatches where toolchain headers are included
without the corresponding library.
* Adds nuttx_find_toolchain_lib() calls for all platforms.
* Aligns CMake behavior with Make build system.

Signed-off-by: trns1997 <trns1997@gmail.com>
2026-01-24 19:30:21 +08:00
yukangzhi
b82ad5c495 arch/tricore: disable CPU and system watchdogs during startup
Some Aurix Boot-FW configurations leave watchdogs enabled by default,
which can cause unexpected resets during early bring-up. This change
explicitly disables the CPU and system watchdogs during core0 startup to
ensure reliable system initialization.

- For TC3XX chips, call `IfxScuWdt_disableCpuWatchdog()` and
  `IfxScuWdt_disableSafetyWatchdog()`.
- For TC4XX chips, call `IfxWtu_disableCpuWatchdog()` and
  `IfxWtu_disableSystemWatchdog()`.

This is a low-risk startup change and does not alter watchdog behavior
after system initialization.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-24 19:29:31 +08:00
liwenxiang1
b1fe00fa1e arch/acpi:Fix issue 02 Compile acpidump crash problem
At certain optimization levels, GCC/Clang may insert UD2 if it detects undefined behavior (such as integer overflow or illegal pointer access), causing the program to crash immediately instead of executing unpredictable code.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-01-24 19:28:22 +08:00
humzak711
e47a0dd228 arch/x86_64: optimize assembly instructions for size and performan
Signed-off-by: humzak711 <humzak711@gmail.com>

arch/x86_64: optimize assembly instructions for size and performance
2026-01-24 17:24:41 +08:00
yinshengkai
5892554984 arch/arm64: fix backtrace return address precision
The return address stored in the frame should point to the instruction
after the call. To get the actual call site, we need to subtract the
instruction size (sizeof(void *)) from the saved return address.

This ensures that backtrace addresses correctly point to the calling
instruction rather than the next instruction.

Signed-off-by: yinshengkai <yinshengkai@bytedance.com>
2026-01-23 16:33:01 +08:00
chenxiaoyi
dbbcd7c88c arch/xtensa: remove the use of XCHAL_SYSCALL_LEVEL
After PR#14672, there is no use of XCHAL_SYSCALL_LEVEL.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2026-01-23 10:52:43 +08:00
chenxiaoyi
775c95a599 arch/xtensa: delete XCHAL_SYSCALL_LEVEL macro definition
After PR#14672, there is no use of XCHAL_SYSCALL_LEVEL.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2026-01-23 10:52:43 +08:00
hujun5
a3273e6a96 arch: Add stack alignment and stack size checking when CONFIG_TLS_ALIGNED=y
Add validation to ensure allocated stack size does not exceed TLS_MAXSTACK when
CONFIG_TLS_ALIGNED is enabled, and verify proper stack alignment using STACK_ALIGN_MASK
across all architectures. This improves stack safety and prevents potential TLS overflow conditions.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 22:18:11 +08:00
ouyangxiangzhen
d404b15d8f arch/x86_64: Fix compilation error.
This commit fixed a compilation error about the undefined sizeof(struct tls_info_s).

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-22 22:14:00 +08:00
Bartosz Wawrzynek
64d2b822f8 arch/arm/src/nrf: Remove return status from void functions
Remove return status from void tickless_rtc functions in nrf52, nrf53,
and nrf91 boards. Also add missing newline at end of nrf91_modem_os.c.

Signed-off-by: Bartosz <bartol2205@gmail.com>
2026-01-22 22:07:53 +08:00