Commit graph

60363 commits

Author SHA1 Message Date
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
wangchengdong
26af1fadc9 arch: Enable event module for pcduino-a10 and smartl-c906
Enable the event module on pcduino-a10 and smartl-c906 boards
   to allow event tests to be executed on both ARM and RISC-V
   architectures.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-11-04 21:43:59 +08:00
wangchengdong
522f32f7ef sched/event: Fix uninitialized need_switch flag issue in event_post()
The `need_switch` flag was not initialized in `event_post()`. Since it is
    a local variable, it could contain a random non-zero value, leading to
    incorrect behavior.
    In addition, this patch also fixes an issue where the event clearing
    operation in `event_post()` was not performed correctly.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-04 21:43:59 +08:00
haitomatic
e7ad870f18 arch/risc-v/mpfs: Add MSS CAN driver.
Refactor to  become lower half driver.

Signed-off-by: Hai To <hai.to@tii.ae>
2025-11-03 17:14:53 -03:00
haitomatic
967238ba2c arch/risc-v/mpfs: Add MSS CAN driver.
The Nuttx MSS CAN driver has an exclusive interface to the integrated MSS CAN peripheral residing in Polarfire SoC FPGAs. There are two CAN block 0 and 1 that can be configured for use. In normal mode (non AMP), CAN0 and CAN1 block base register addresses are 0x2010C000UL and 0x2010D000UL.

Signed-off-by: Hai To <hai.to@tii.ae>
2025-11-03 17:14:53 -03:00
Jukka Laitinen
e45f91f350 sched/signal/sig_dispatch.c: Remove DEBUGASSERT(!sched_idletask())
The DEBUGASSERT is wrong in two cases;
1) In SIM, which does sim_timer_update from the idle task, and the sim timer runs on signals
2) If signal is dispatched from within an interrupt

In these cases, if there are not available items for pending signals, return
the nxsig_tcbdispatch with -EAGAIN instead of asserting.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-02 16:46:18 -03:00
Jukka Laitinen
5961b8bd1a binfmt: Add a configuration flag to store the module filename
This flag can be used to store the filename of a loaded module or
executable in binfmt. The filename is useful for example in debugging.
For example, gdb or a jtag debugger can be configured to automatically
fetch the symbols for the currently executing module.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-01 22:59:47 +08:00
chao an
62660a692d sched/task: move lock to mhead scope
1. rename mutex_lock to mhead_lock to declare purpose of lock
2. move lock to mhead scope

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-11-01 22:52:07 +08:00
wangchengdong
5a6242aac8 Documentation: Remove nxevent_tickwait_wait() description
Remove the nxevent_tickwait_wait() description from events.rst,
    since this API was removed during the event module refactoring.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-10-31 19:56:32 -03:00
wangchengdong
d8304979b4 tools/nxgdb: Add gdb and statenames for TSTATE_WAIT_EVENT
This patch add new taskstate entry in tools/pynuttx/nxgdb/thread.py
   and in sched_get_stateinfo.c/g_statenames for the new added task
   state: TSTATE_WAIT_EVENT

   test log is:
     nsh> ps
       PID  PPID GROUP PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK    USED FILLED COMMAND
         0     0     0   0 FIFO     Kthread   - Ready              0000000000000000 0001008 0000196  19.4%  Idle_Task
         1     0     0 192 FIFO     Kthread   - Waiting  Semaphore 0000000000000000 0001984 0000016   0.8%  hpwork 0x70000100 0x7000014c
         2     0     2 100 FIFO     Task      - Running            0000000000000000 0002008 0000740  36.8%  nsh_main
         4     0     0 100 FIFO     Kthread   - Waiting  Event     0000000000000000 0000984 0000012   1.2%  event_wait_task

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00
wangchengdong
de5973268b [!] sched/event: Remove wait object dependency from event implementation
The current event implementation relies on a dedicated wait object,
    which introduces several issues:
        1. Increases memory usage
        2. Complicates the event logic
        3. Makes the API design less clean, as it requires a separate
                nxevent_tickwait_wait() function

    This patch removes the event’s dependency on the wait object
    and eliminates the nxevent_tickwait_wait() API accordingly.

    BREAKING CHANGE: this commit removed the nxevent_tickwait_wait function
    so the related docs should be updated accordingly

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00
wangchengdong
94cfb1180b sched/event: Implement nxevent_timeout with nxevent_wait_irq
Implement nxevent_timeout with nxevent_wait_irq to remove
   code duplication

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00
wangchengdong
39f54c1524 sched/event: Add nxevent_wait_irq() to handle the task cancel
If the thread is blocked waiting on a event, then the
    thread must be unblocked from the evnet to handle
    the task cancellation.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00
wangchengdong
735e489070 [!] sched/event: Replace semaphore with direct scheduler operations in event
The current event implementation uses semaphores for wait and post
    operations. Since semaphores are relatively heavy-weight and intended
    for resource-based synchronization, this is suboptimal.

    So this patch replaced the semaphore-based mechanism with direct
    scheduler operations to improve performance and reduce memory footprint.

    This patch also introduce a new task state TSTATE_WAIT_EVENT to indicate
    the task is waiting for a event.

    BREAKING CHANGE:  This commit introduced a new task state TSTATE_WAIT_EVENT
    so apps/nshlib/, procfs/ and tools/pynuttx/nxgdb/ are needed to be updated accordingly.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00
wangchengdong
5fa8634ce7 sched/event: Restore critical section protection for event wait and post
Restore the use of critical sections to provide mutual exclusion
    between event wait and post operations. This allows replacing the
    heavier semaphore-based mechanism with direct scheduler operations
    for synchronization.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00
wangchengdong
76dcec8f4b Documentation: Add description for early_syslog()
Add documentation describing the purpose and behavior of early_syslog(),
   which provides a minimal logging facility available during early system
   initialization or system down.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 08:29:17 -03:00
wangchengdong
378a827a7a sched/syslog: Add early_syslog() for early boot or system down debugging
Introduce early_syslog() to enable basic logging during the very early
    boot or system down stages, when the full syslog subsystem is not yet
    available.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 08:29:17 -03:00
wangchengdong
a04f257d4b sched/wqueue: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in the sched wqueue module with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 15:02:56 +08:00
wangchengdong
a49a5fd27f sched/clock: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in the sched clock module with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 15:02:56 +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
Huang Qi
2ecd2722cd boards/esp32s3: Increase LCD PWM frequency to reduce LCD flicker
Increase LCD PWM frequency from 100Hz to 10kHz to eliminate visible flicker
on the lckfb-szpi ESP32S3 board. The higher frequency provides smoother
backlight control and improves display visual quality.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-10-29 14:10:28 -04:00
simbit18
0625efa965 boards/risc-v: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-29 22:04:25 +08:00
simbit18
4ed99d6146 boards/arm64: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-29 22:04:25 +08:00
simbit18
e86c048d15 boards/arm/gd32f4: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-29 22:04:25 +08:00
Filipe Cavalcanti
680766d304 arch/xtensa: update SPI Flash driver for ESP32-S2|S3
Updates the SPI Flash driver used for user storage MTD.
Moves ESP32 and ESP32S3 to use common driver.
Updates KConfig options to keep backwards compatibility.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-10-29 09:44:55 -04:00
Filipe Cavalcanti
4ccae59e69 arch/risc-v: update SPI Flash driver for ESP32-C3|C6|H2
Updates the SPI Flash driver used for user storage MTD.
Updates board linker script and bring up.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-10-29 09:44:55 -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
Matteo Golin
11e81d1a89 docs/platforms/arm64/bcm2711: microSD documented, improvements
The documentation is now updated to reflect the new EMMC support. I have
also improved the format to match the standard board documentation
template, and included better support descriptions for features that
have varying levels of implementation.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-10-28 16:21:53 -03:00
Matteo Golin
d13b10843a bcm2711/sdio: Support for EMMC interfaces on the BCM2711
This initial implementation sets up support for the EMMC interfaces on
the BCM2711. Only EMMC2 is tested since it is the interface of interest
(connects to uSD card). MMCSD communication is functional and the boot
partition of the SD card can be mounted and interacted with.
Insertion/removal interrupts do not fire after initial boot, and
sdstress fails with any byte size larger than 1023. 32GB card works
perfectly, while 64GB card exhibits strange behaviour when interacting
with VFAT filesystem.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-10-28 16:21:53 -03:00
simbit18
4e65e8a1f7 arch/tricore/src/tc397/CMakeLists.txt: nxstyle fix Relative file path
-fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-28 13:38:04 -04:00
simbit18
dfc9f6c2a2 boards/arm: nxstyle fix Relative files path
- fix Relative file path does not match actual file.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-28 13:38:04 -04:00
wangchengdong
ace17ad902 sched/sched: Use nxsched_wakeup() to implement nxsched_timeout()
Refactor nxsched_timeout() to use nxsched_wakeup() in order to
    eliminate code duplication and improve maintainability.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-28 10:43:24 +08:00
wangchengdong
5beb4ae6d5 sched/sched: Introduce nxsched_wakeup()
Add a new function nxsched_wakeup() to the scheduler,
    which allows waking up a sleeping task before its timeout.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-28 10:43:24 +08:00
wangchengdong
201406b22b sched/sched: Reuse nxsig_wait_irq() in nxsig_timeout()
Currently, there is duplicated code in nxsig_wait_irq() and nxsig_timeout().
    This patch updates the input parameters of nxsig_wait_irq() so that it can
    be reused in nxsig_timeout(), reducing code duplication and improving
    maintainability.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-10-27 10:05:45 -03:00
wangchengdong
6913e52ac3 sched/signal: Remove redundant code in nxsig_wait_irq()
nxsig_wait_irq() is always invoked within an existing critical section,
    and the task state is already verified, similar to nxsem_wait_irq().
    Therefore, the additional critical section protection and task state
    check inside the function are redundant and have been removed.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-10-27 10:05:45 -03:00
dependabot[bot]
6e7a498787 build(deps): bump actions/download-artifact from 5 to 6
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 19:47:03 +08:00
dependabot[bot]
817a063b9b build(deps): bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 19:46:58 +08:00
Alan Carvalho de Assis
8cb1fd713e drivers/usbhost_hub: Add support to Multiple TT HS HUB
This is the case for USB2517 USB HUB. Also improved the driver to
avoid mistakes: initially I changed g_id[3], but the in register
there is another field where we need to pass this size again. So
it is better to use ARRAY_SIZE() macro to avoid mistakes.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-10-27 18:24:42 +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
Kevin Witteveen (MartiniMarter)
32a8caf66b documentation: JPEGResizeTool application and libjpeg
Signed-off-by: Kevin Witteveen (MartiniMarter) <kevinwit1999@gmail.com>
2025-10-26 09:44:46 -04: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
simbit18
14a0780ff5 board/arm/stm32h5: Added CMake build for NUCLEO-H563ZI board
- CMake added board STM32 NUCLEO-H563ZI

https://www.st.com/en/evaluation-tools/nucleo-h563zi.html

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-10-24 12:17:07 -04:00