Commit graph

16316 commits

Author SHA1 Message Date
simbit18
b4be9a495a arch/arm/src/s32K3xx: CMake build implemented for NXP S32K3 Family
- added NXP S32K3 Family

Signed-off-by: simbit18 <simbit18@gmail.com>
2026-02-06 15:27:50 -03:00
wangmingrong1
0832cdca1c toolchain/arm/clang:Update clang compilation specifications
Delete the specified --config, clang can automatically find the library file through the set -march, -mcpu, and -mfpu
Otherwise, different versions of clang support different special cfg settings.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-02-04 02:33:36 +08:00
hujun5
63aefd9975 arch/armv7-r: userspace PMU access
This change enables performance monitoring unit (PMU) access from userspace
on ARMv7-R architecture by adding CONFIG_ARCH_HAVE_PERF_EVENTS_USER_ACCESS
support and building PMU code for userspace when needed.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-02-02 16:20:39 +01:00
wangzhi16
a53d58c5c3 arm/phy62xx: Critical Section Optimization.
The benefits of doing this are:

1. It makes the code logic clearer, with different resources protected by different locks.

2. It improves system responsiveness and avoids contention issues caused by acquiring the same large lock.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-02-02 21:17:20 +08:00
wangzhi16
44f2f6f8f1 arm/rtl8720c: Critical Section Optimization.
Replace critical_section with spinlock or mutex.
The benefits of doing this are:

1. It makes the code logic clearer, with different resources protected by different locks.

2. It improves system responsiveness and avoids contention issues caused by acquiring the same large lock.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-02-02 21:17:20 +08:00
zhanghongyu
a7567677a8 netdev_driver: add carrier_on to xxx_ifup where carrier_on is absent
since the judgment for network card selection was changed from IS_UP to
IS_RUNNING, drivers that lack carrier_on need to add the carrier_on
operation; otherwise, network access issues will occur.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-02-02 13:23:05 +08:00
Adwait Godbole
5024a67514 arch: stm32: fix undeclared page variable in flash write
Fix a compilation error in stm32f10xxf30xx_flash.c where the variable
`page` is used without being declared in up_progmem_write().

The issue appears when STM32_FLASH_DUAL_BANK is enabled.

The page is now derived locally from the flash base address and
page size macros, avoiding any dependency on PROGMEM helpers when
selecting the flash bank.

Signed-off-by: Adwait Godbole <adwaitngodbole@gmail.com>
2026-02-01 23:23:32 +08: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
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
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
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
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
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
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
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
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
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
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
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
pangzhen1
f766dc6c08 arch/arm: Add arm memmanage fault skip operation
In some scenarios (e.g. testing, debugging, etc.) where we want to trigger a memmanage fault without panic the system, we can use this Memory Management Fault skip operation.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-22 19:43:22 +08:00
hujun5
6f03601169 arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures
Rename STACK_ALIGNMENT macro to STACKFRAME_ALIGN throughout the codebase
to provide clearer naming semantics. The new name better reflects the macro's
purpose of frame alignment rather than general stack alignment.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-22 15:37:24 +08:00
Jean THOMAS
6581e312f5 stm32: disable UART up_putc when semihosting
Do not compile up_putc functions in stm32_serial.c to avoid conflicts
with implementation from arm_semi_syslog.c when semihosting is enabled.

Signed-off-by: Jean THOMAS <jean@lambdaconcept.com>
2026-01-22 03:49:05 +08:00
yukangzhi
3448e84a4c arch/arm: armv8-r PL at startup needs to be checked
When the system startup from the PL1 SYS mode, the initialization
of the PL2 HYP register needs to be skipped. Put the Hypervisor
initialization code together and skip it all at once.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-21 19:21:43 +08:00
hujun5
63e59e26c0 arch: move some macros to public code.
Move stack alignment and kernel stack macros from architecture-specific internal
headers to public include/nuttx/irq.h. Consolidates duplicate definitions across
17 architecture families, reducing code duplication while enabling common code
to access these core alignment utilities without architecture dependencies.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-20 01:53:08 +08:00
xuxin19
df6505567c elf(bugfix):fix elf compile link error when enable LTO
fix compilation errors when enabling the LTO linker

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
00e79122af cmake(enhance):cmake support DYNLIB build
add `DYNLIB` option for nuttx_add_application for dynamic loadable lib

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
a7c6f589f9 cmake(bugfix):fix sim loadable elf build support
1.add sanity check for START_OBJS
2.make laodable -e entry setting in each arch elf.cmake
3.add sim elf.cmake

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
63dc48e713 cmake kernel build(bugfix): remove unused section in elf link
this will reduce the size of elf

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
6fa3031d9b cmake(feat):define elf option and enable apps module build
1.define elf option setting function ext;
2.unify loadable elf and kernel elf build config

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
xuxin19
b7582b8da1 cmake(feat):implements KERNEL mode in CMake build
1.add application link dependencies for all elf
2.add a global custom target to hold proptry in the toolchain file
3.add startup obj target
4.fix cpp lds error with kernel mod link elf lds

usage:
./build.sh qemu-armv7a:knsh --cmake
elf install in ${CMAKE_BINARY_DIR}/bin

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-01-19 14:45:37 +08:00
hujun5
8bb250a4c0 arch: move STACK_ALIGNMENT to irq.h
Move STACK_ALIGNMENT macro definitions from architecture-specific internal
headers to public irq.h headers. This enables common code to directly access
STACK_ALIGNMENT without requiring internal header inclusion, improving code
organization and reducing header dependencies. Applies to all architectures:
ARM, ARM64, AVR, HC, MIPS, or1k, Renesas, RISC-V, SIM, SPARC, TriCore, x86,
x86_64, Xtensa, Z16, and Z80.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-19 14:43:43 +08:00
wangzhi16
8c8e837230 arch/*_rptun.c: port all the chip's rptun driver to new rptun framework
New rptun framework need provide the carveout device to provide
the share memmory.

And need add the cpuname feature for rpmsg virtio device to let
rpmsg virtio can know remote cpuname.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
hujun5
a640dd49d2 armv7-a/arm_addrenv_pgmap.c: add up_addrenv_find_page and up_addrenv_user_vaddr
Add two new address environment utility functions in arm_addrenv_pgmap.c:
- up_addrenv_find_page(): Find physical page mapped to user virtual address
  from address environment page directory (stub implementation for future use)
- up_addrenv_user_vaddr(): Check if virtual address is in user space by calling
  arm_uservaddr(). Enables common code to query user address space boundaries
  on ARMv7-A architecture.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-18 23:06:13 +08:00
wangchengdong
09b99e5b90 arch/arm: Add support to disable signals actions related data struct
Add support to disable signals actions related struct

Co-authored-by: guoshichao <guoshichao@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-18 08:24:13 -03:00
Alexey Matveev
1b993875b5 arch/stm32: Fix stm32-capture if timer don't support GTIM_CCER_CC1NP
Fix: Some STM32 chips don't support GTIM_CCER_CC1NP; use HAVE_GTIM_CCXNP guards to exclude it. Adds/updates #ifdef HAVE_GTIM_CCXNP guards so GTIM_CCER_CC1NP is only included when supported, preventing register writes on chips without it.

Signed-off-by: Alexey Matveev <tippet@yandex.ru>
2026-01-18 11:40:32 +08:00
hujun5
657ac8317e arch: fix addrenv_switch changing this_task causing exceptions
After addrenv_switch(), the current running task (this_task) may change due to
deferred work execution. Update all architecture interrupt, syscall, and exit
handlers to re-fetch tcb = this_task() after addrenv_switch(). Ensures scheduler
and context operations use the correct TCB, preventing context corruption and
exceptions across SMP and memory-protected builds.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-17 18:23:06 -03:00
ligd
113bb02568 checkstack: fix access overflow when checkstack
We should check length first, and then check the value

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-01-17 18:04:28 -03:00
hujun5
f4cbc1455f arm: use global variables for CPU startup addresses
Replace direct labels for CPU startup routines with indirection through global
variables. Export cpu1_start, cpu2_start, cpu3_start as global objects containing
addresses to __cpu1_start, __cpu2_start, __cpu3_start respectively. Use load-then-
branch-exchange (ldr r1, =cpu*_start; ldr r1, [r1]; bxeq r1) instead of direct beq
jumps. Enables flexible control of CPU startup positions and supports future AMP/
dynamic loading scenarios.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 14:05:24 -03:00
hujun5
c1884b8a4f arm: add CONFIG_NCPUS for AMP mode support
Add new CONFIG_NCPUS configuration option to support both SMP and AMP modes.
Replace SMP-specific CONFIG_SMP_NCPUS checks with generic CONFIG_NCPUS in ARM
boot code (ARMv7-A, ARMv7-R, ARMv8-R). CONFIG_NCPUS defaults to SMP_NCPUS when
SMP is enabled, or 1 otherwise, enabling multi-CPU support regardless of SMP mode.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 14:05:24 -03:00
hujun5
6f87c092a1 arm: support AMP mode with GIC SGI inter-core interrupts
Enable SGI (Software Generated Interrupts) usage in AMP mode for inter-core
communication. Modify arm_cpu_sgi() to use SGI_TGTFILTER_LIST for both SMP and
AMP modes instead of requiring CONFIG_SMP. Add CPU0-only guard checks using
sched_getcpu() to ensure arm_gic0_initialize() executes only once on CPU0 during
initialization in both SMP and AMP configurations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 14:05:24 -03:00
Jiri Vlasak
f49e61bf76 kinetis/enet: Set carrier on/off on ifup/ifdown
We need IFF_IS_RUNNING(dev->d_flags) to be true for ethernet device to
work properly. However, dev->d_flags are not set anywhere in the
Kinetis' ethernet code.

This change updates kinetis_ifup and kinetis_ifdown procedures to call
netdev_carrier_on and netdev_carrier_off to set dev->d_flags.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-01-16 13:55:13 -03:00
Peter van der Perk
8c77fccaef imx95-m7: Fix Kconfig for flexcan typo
Fixes typo in flexcan2, which renders it unusable

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-16 13:49:25 -03:00
guoshichao
5a9f6efddb ghs: update the compile option to recommended options
add new build option config that recommended from other mass-produced
products

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 21:57:00 +08:00
guoshichao
eda1969888 ghs.cmake: add preprocess command to the .ld script generate procedure
Modify nuttx_generate_preprocess_target() to inject
$<TARGET_PROPERTY:nuttx_global,NUTTX_CPP_COMPILE_OPTIONS> into the
preprocessing command, ensuring that linker script preprocessing uses
the same C preprocessor flags as the rest of the build (e.g., -D defines,
include paths).

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 20:32:05 +08:00
lipengfei28
e70c31162a arch/arm: add api to config irq type
arm add api to config irq type

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-16 20:26:14 +08:00
guoshichao
ba63a4d234 ghs: fix the UsageFault:INVSTATE error triggered by exception_common
when we build with greenhills compiler, if the exception_common function
is put into a separate section: ".text.exception_common", then the
address of exception_common function is an even number, for example "0x16a6c",
in this case, it will trigger the UsageFaults:INVSTATE error.
The reason for this error is that in the GHS compiler, a section declared
through the ".section" directive must specify at least the "a" attribute.
Otherwise, this section will not be linked into the final file, and this
is why the address of exception_common function is invalid.
The following is the official explanation in the GHS compiler documentation:
"The reason for this error is that in the GHS compiler, a section
declared through the .section directive must specify at least the "a"
attribute. Otherwise, this section will not be linked into the final
file. The following is the official explanation in the documentation:
"Sections that are intended be part of the final linked output should
have at least the `a` attribute"
and for GHS compiler, the .text section is recommended specify the
attribute of `ax`.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 09:41:13 +08:00