Commit graph

16233 commits

Author SHA1 Message Date
simbit18
7c6cb4ffe1 arch/arm: Aligned Cmake with Make
- use chip specific vectors to allow smpcall update regs apache#14363

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-12-22 16:21:31 +01:00
Mathias Duckeck
4a032cb608 arch/arm/samv7: allow all values for count in read
The parameter count of read had to be a multiple of 4, otherwise the
result was truncated. Now all values are possible.

Signed-off-by: Mathias Duckeck <mathias.duckeck@avat.de>
2025-12-22 21:27:54 +08:00
adriendesp
ec04ef9ccf arch/arm/xmc4 : various fixes and clean
- Fix EtherCAT signals drive strengh (from errata PORTS_CM.H002), caused bus faults.
- Changed xmc4_ecat.c for compile time pin definition.
- Fixed xmc4_ecat.c register not written (reset value already used).
- Removed EXTCLK for xmc4800 as pin is used for ECAT.
- Clean xmc4 familly board.h and clocks config.

Signed-off-by: adriendesp <adrien.desproges@gmail.com>
2025-12-03 13:47:34 +08:00
simbit18
bb66e96023 arch/arm/src/stm32l4: Removed repeated addition of CONFIG_STM32L4_IWDG
- Removed

   if(CONFIG_STM32L4_IWDG)
      list(APPEND SRCS stm32l4_iwdg.c)
   endif()

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-12-03 08:36:06 +08:00
simbit18
0af53187b5 arch/arm/src/kl: CMake build implemented for NXP KL Series Arm MCUs
- added NXP KL Series Arm MCUs

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-12-02 02:42:55 +08:00
Michal Lenc
5743edd0e9 arch/arm/src/samv7/sam_qspi_spi.c: add support for SPI_SETDELAY
This commit adds support for SPI_SETDELAY operation on SAMv7 QSPI
peripheral running in SPI mode. The logic is the same as for standard
SPI peripheral, just different registers. The change allows to set
custom delays between transfers, chip selects and so on.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-11-27 22:46:03 +08:00
Max Kriegleder
a9ecff5f1c arch/arm/{nrf52|nrf53|nrf91}/i2c: fix I2C bus getting stuck during read
During I2C read, one-too-many byte is read, which can lead to the I2C bus
getting stuck. This is likely due to the STOP condition being set at the
wrong time or being missed completely. The chip offers a shortcut, such
that the STOP condition is set automatically after the last byte is being
written/read.

Signed-off-by: Max Kriegleder <max.kriegleder@gmail.com>
2025-11-24 14:57:10 +01:00
ouyangxiangzhen
b540618e9f driver/timers: Simplify the up_timer_initialize.
This commit simplified the up_timer_initialize.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-24 19:43:07 +08:00
buxiasen
8cb0e654a3 arch/armv8-r/timer: fix the UINT64_MAX mask cause tick mode no isr
When TICKLESS not enabled, up_alarm_set_lowerhalf will call start, if we
overwrite the compare register will cause TICK mode no longer isr.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-11-24 19:43:07 +08:00
husong1
482de93342 arch/arm: Fix the arm timer's maximum delay to be a 64-bit integer.
This commit fixed the arm generic timer's maximum delay.

Signed-off-by: husong1 <husong1@xiaomi.com>
2025-11-24 19:43:07 +08:00
husong1
80463c8b06 arch/armv7r: Add armv7r clkdev timer driver.
This commit added armv7r clkdev timer driver.

Signed-off-by: husong1 <husong1@xiaomi.com>
2025-11-24 19:43:07 +08:00
ouyangxiangzhen
996f110925 arch/arm: Add clkdev driver for generic timer.
This commit added clkdev driver for arm generic timer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-24 19:43:07 +08:00
SPRESENSE
b2b045252d arch: cxd56xx: Fix failure to get RTC time in multi-core environment
In multi-core environment where NuttX runs on each core, if one core
sets the RTC time, the RTC value gotten on other cores is incorrect.

This is caused by clock_gettime(CLOCK_MONOTONIC) function used to get
elapsed time, which uses a core-specific global varaiable g_basetime
as the base time.

To fix this, update the g_basetime from the backup SRAM that can be
shared between cores in setting/getting the RTC time.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-11-20 20:56:05 +08:00
ouyangxiangzhen
fc28b93224 timers/oneshot: Remove all callback and args.
This commit remove all callback and args in the APIs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
5c113f79b7 timers/oneshot: Remove all private callback.
This commit removed all private callback and handle it on the upperhalf
of oneshot.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
b53141049d arch/arm: revert oneshot drivers to timespec API.
This commit reverted oneshot drivers to timespec API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
leocafonso
2667f51c82 arch/ra4: Add PWM driver support for RA4M1
- Added PWM driver support for the RA4M1 microcontroller using the GPT timer.
- This driver supports Saw-wave mode and one of the two output channels (A or B).
- Added necessary configurations in CMakeLists.txt, Kconfig, and Make.defs.
- Created new header file for GPT.

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-11-17 09:01:31 -03:00
ouyangxiangzhen
d322bdb1ee arch/arm: Simplify arm_cpu_boot.
This commit simplified arm_cpu_boot.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
b2f1d2fee0 arch/arm: Simplify ARM generic timer drivers.
This commit simplified ARM generic timer drivers.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
44aac0c3db arm/armv8-r: Rename arm_arch_timer to arm_timer.
This commit renamed arm_arch_timer to arm_timer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
wangchengdong
63f081cbf2 arm/lc823450: Use clock_systime_ticks() to access system ticks
Use clock_get_sched_tclock_systime_ticks() to access system ticks
     in order to fix the build error and improve code safety.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-11-13 18:40:16 -03:00
xiezhanpeng3
2ce0c128f9 toolchain/ghs: Adapt .macro syntax for GHS compiler
The GHS compiler uses different .macro syntax. Without this change,
the GHS compiler reports error like:
[asarm] (error #2014) nuttx/arch/arm/src/armv8-r/arm_vectors.S 155: expected a register
  vstmdb \ out ! , { s0 - s31 }
---------^

And:
[asarm] (error #2179) nuttx/arch/arm/src/armv8-r/arm_vectors.S 141: unexpected token type (comma) encountered; expected type (char)
  .macro savefpu , out , tmp
-----------------^

Co-authored-by: Chengdong Wang <wangchengdong@lixiang.com>
Signed-off-by: xiezhanpeng3 <xiezhanpeng3@lixiang.com>
2025-11-14 01:49:09 +08:00
xiezhanpeng3
c9eeb4cb14 toolchain/ghs: change alignment syntax for GHS
The .align N syntax in GHS means the alignment is N Bytes. In GCC
compiler, it means 2**N Bytes. Therefore, .align 32 in GHS and
.align 5 in GCC are equivalent.

Co-authored-by: Chengdong Wang <wangchengdong@lixiang.com>
Signed-off-by: xiezhanpeng3 <xiezhanpeng3@lixiang.com>
2025-11-14 01:49:09 +08:00
xiezhanpeng3
e0e8a6e852 toolchain/ghs: _hyp_vector_start uses b . syntax for both GCC and ghs
The $+0x0 is not accepted by Ghs compiler. Therefore, we change it to a
more common syntax " b   ." for endless self loop.

Signed-off-by: xiezhanpeng3 <xiezhanpeng3@lixiang.com>
2025-11-14 01:49:09 +08:00
xiezhanpeng3
ecef24ea33 toolchain/ghs: greenhills compiler does not recognize .syntax unified
The GreenHills Compiler uses Unified Assembler Language by default and
it does not recognize .syntax unified instruction. Therefore, remove
them if GHS compiler is used.

Co-authored-by: Chengdong Wang <wangchengdong@lixiang.com>
Signed-off-by: xiezhanpeng3 <xiezhanpeng3@lixiang.com>
2025-11-14 01:49:09 +08:00
xiezhanpeng3
1d9e160f97 toolchain/ghs: add Greenhills compiler support for .type directive for arm-v8r
The GreenHills Compiler uses different grammer for the .type directive
in asm, this patch adds support for the grammer for arm-v8r.
Similar change for arm-v7r was done in pull request #12883.

Co-authored-by: Chengdong Wang <wangchengdong@lixiang.com>
Signed-off-by: xiezhanpeng3 <xiezhanpeng3@lixiang.com>
2025-11-14 01:49:09 +08:00
trns1997
22bc630d9f drivers/kinetis/spi: Fix Kinetis DSPI transfers in non-FIFO mode.
Fix a transfer issue in the Kinetis DSPI driver when operating
with transmit and receive FIFOs disabled (`MCR[DIS_TXF]=1`,
`MCR[DIS_RXF]=1`). In this mode, the DSPI module behaves as a
simple double-buffered SPI interface without TX staging.

When FIFOs are disabled, `PUSHR` acts as a single 32-bit
command/data register. Partial (16-bit) writes to its upper or
lower halves can result in incomplete or corrupted transfers.
This patch ensures the full 32-bit packet is prepared and
written in a single operation.

* Resolves broken SPI transactions with LAN9252 (EasyCAT).
* Improves reliability in non-FIFO DSPI configurations.
* No impact on DMA or FIFO-enabled modes.

Signed-off-by: trns1997 <trns1997@gmail.com>
2025-11-12 11:24:03 +01:00
simbit18
eca3942320 arch/arm/src/kinetis: CMake build implemented for NXP Kinetis MCUs
- added NXP Kinetis MCUs

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-11-11 22:15:52 +08:00
“duanqinshuo”
cc2cb394fa arch/arm: Solving the ghs compiler not recognizing 0b prefix representing binary
This patch solving the ghs compiler not recognizing 0b prefix representing binary

Signed-off-by: Qinshuo Duan duanqinshuo@lixiang.com
2025-11-09 00:12:14 +08:00
wangchengdong
5b4d2dda9d arm/stm32: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm/stm32 with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 22:46:15 +08:00
wangchengdong
028f4cd952 arm/sam34: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm/sam34 with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 22:46:15 +08:00
wangchengdong
3b77128e65 arm/s32k3xx: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm/s32k3xx with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 22:46:15 +08:00
wangchengdong
72fcae36c2 arm/s32k1xx: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm/s32k1xx with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 22:46:15 +08:00
wangchengdong
268e67ce3d arm/kinetis: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm/kinetis with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 22:46:15 +08:00
wangchengdong
8978be2939 arm/imx9: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm/imx9 with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 22:46:15 +08:00
Peter van der Perk
e6c982892b imxrt: make DTCM heap size configurable
By default, the full configured DTCM region is assigned to the heap for
dynamic allocation. In scenarios requiring deterministic memory regions
for static buffers or control structures, you can reduce the heap
allocation to reserve part of DTCM for manual/static use.
This kconfig symbol allows to limit the size.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-10-30 10:07:08 -04:00
kywwilson11
94e12d0142 arch/arm/stm32h5: Use au_receive_batch in adc_dmaconvcallback
The adc_dmaconvcallback routine was far too slow and inefficient. This was not caught until recently when I was testing faster sample rates. When in circular mode for the adc (dma and constant conversions), the adc_dmaconvcallback function would overwhelm the OS and lock it up. I looked into this and did a lot of testing. First I tried minimally improving the dma callback by removing the % operator from the algorithm, this was slow and inefficient. I also tried increasing the batch size considerably as well as the fifo size. This helped but the OS would still lockup with the fastest sample rate (5 Msps). au_receive_batch was the solution. In order to use this, I needed to change the dmabuffer to be of type uint32_t to match the data pointer in au_receive_batch. I also needed to create a channel buffer, which is initialized once in adc_setup. stm32_gpdma_cfg_s->tr1 needed to be updated for the uint32_t dmabuffer. Once I made changes to use au_receive_batch, I could reliably use the fastest sample rate without locking up the OS. Calling au_receive for every single conversion in a batch is far less efficient than calling au_receive_batch. I also snuck in some changes for the ADC watchdog defines and guards. These were fixes that were tested while testing these changes.

Signed-off-by: kywwilson11 <kwilson@2g-eng.com>
2025-10-29 13:37:14 +08:00
Stepan Pressl
cf0d962d9c samv7/mcan,emac: revision logic based on sam_has_revb_periphs
The sam_has_revb_periphs function is used to configure
the peripherals correctly.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-10-27 00:09:11 +08:00
Stepan Pressl
9fc84c250d samv7/sam_chipid: add sam_has_revb_periphs function
This function can identify (during the runtime) whether the chip
is revB or revA. Bear in mind PIC32CZ2051CA70 is always revB.
Allows to have one binary compatible with SAMV7 and PIC32.

Thanks to Pavel Pisa and Michal Lenc for the suggested code.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-10-27 00:09:11 +08:00
Lars Kruse
8c91052433 boards/arm/rp2040: allow flash write operation on rp2040 in SMP mode
Previously the function "up_cpu_pause" was used for preventing all other
CPUs from executing code from flash.
The above function was removed in d8cb7759.

Now flash operations work on rp2040 in SMP mode by blocking all but the
current CPU for the duration of the critical function (write or erase).

Closes: #16203

Signed-off-by: Lars Kruse <devel@sumpfralle.de>
2025-10-26 08:07:08 -03:00
kywwilson11
35d1aaafda arch/arm/stm32h5: STM32H5 PWM Driver (STM32H7 port)
Adding the stm32h5 pwm driver. This is almost an exact copy of the stm32h7 pwm driver. I confirmed the timers for the h5 are version v2 and added the preprocessor definition. This commit was tested on a stm32h5 nucleo-h563zi development board. Necessary board files and a pwm config have been added. Added pin mappings for all timer outputs.

Signed-off-by: kywwilson11 <kwilson@2g-eng.com>

Added documentation regarding nucleo-h563zi:pwm config.

Removed CONFIG_STM32H5_PWM guard at the top. Fixed IRQs for tim1 and tim8. Added H5 to list of Timer IP v2 timers.

Conditionally compile stm32_serial.c.

Add stm32_pwm.c to CMakeLists.txt
2025-10-25 12:48:34 +08:00
simbit18
678cd54aa8 arch/arm/src/stm32h5: CMake build implemented for STM32H5 MCU series
- added STM32H5 MCU series

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-24 12:17:07 -04:00
kywwilson11
aa8fb9ae2e arch/arm/stm32h5: Add defines for ADC_HAVE_WDG
AWD defines needed by stm32_adc.c were missing from PR #17007. This commit adds them in.

Signed-off-by: kywwilson11 <kwilson@2g-eng.com>
2025-10-23 20:46:20 +08:00
Alexander Lerach
a9b258aa68 arch/arm/stm32h7: Fix UART TX DMA getting stuck
When closing a serial port an ongoing TX DMA transfer will be stopped. This can cause
one (or multiple) the following:

- dev->dmatx.length != 0
- dev->dmatx.nlength != 0
- stm32_dmaresidual returning a non-zero residual

This is caused by length/nlength not being set to 0 at startup or during closing.
In addition the DMA_SxNDTR register is not set to 0 at startup or during closing.

This commit solves the issue by setting the variables and register to 0 during closing.

Signed-off-by: Alexander Lerach <alexander@auterion.com>

arch/arm/stm32h7: Add review feedback regarding style

Removed non-needed spaces.
Aligned style of documentation.

Signed-off-by: Alexander Lerach <alexander@auterion.com>
2025-10-21 01:10:05 +08:00
chao an
a8af5f3d0e style/spell: fix spell checker error
To make checker happy:

arch/arm/src/sama5/sam_classd.c:997: nd ==> and, 2nd
arch/arm/src/sama5/sam_classd.c:1362: levl ==> level
drivers/sensors/apds9922.c:286: persistance ==> persistence

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-17 14:05:02 +08:00
chao an
87f134cfaa sched/sleep: replace all Signal-based sleep implement to Scheduled sleep
Nuttx currently has 2 types of sleep interfaces:

1. Signal-scheduled sleep: nxsig_sleep() / nxsig_usleep() / nxsig_nanosleep()
Weaknesses:
a. Signal-dependent: The signal-scheduled sleep method is bound to the signal framework, while some driver sleep operations do not depend on signals.
b. Timespec conversion: Signal-scheduled sleep involves timespec conversion, which has a significant impact on performance.

2. Busy sleep: up_mdelay() / up_udelay()
Weaknesses:
a. Does not actively trigger scheduling, occupy the CPU loading.

3. New interfaces: Scheduled sleep: nxsched_sleep() / nxsched_usleep() / nxsched_msleep() / nxsched_ticksleep()
Strengths:
a. Does not depend on the signal framework.
b. Tick-based, without additional computational overhead.

Currently, the Nuttx driver framework extensively uses nxsig_* interfaces. However, the driver does not need to rely on signals or timespec conversion.
Therefore, a new set of APIs is added to reduce dependencies on other modules.

(This PR also aims to make signals optional, further reducing the code size of Nuttx.)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-17 14:05:02 +08:00
Alan Carvalho de Assis
744ce66135 arch/stm32: Only compile stm32_serial.c when STM32_USART is enabled
When SEMIHOST_SYSLOG is enabled it creates its own up_putc() function
however the stm32_serial.c also creates this same function, even
when all STM32_USARTs are disabled. Fix patch fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-10-14 08:36:44 -04:00
Alan Carvalho de Assis
5d784a2abc arm/common: Fix arm_nputs.c to avoid mult. up_nputs() definitions
When SEMIHOST_SYSLOG is enabled up_nputs() could be defined twice.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-10-14 08:36:44 -04:00
guoshengyuan1
79711737bc arch/init: call up_color_intstack before up_irq_enable
Make sure interrupt stack is colored before IRQ is enabled.

Currently, after calling irq_initialize in nx_start to
enable interrupts, there is still a period of execution
path before the interrupt stack is colored.

Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
2025-10-14 17:42:01 +08:00
Stepan Pressl
cb2d591b42 stm32/stm32_usbdev.c: include arch/board/board.h
Without this, the compilation would fail for F302 chips.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-10-13 14:45:34 -04:00