Commit Graph

24035 Commits

Author SHA1 Message Date
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
Jukka Laitinen
f641298d9e arch/imx9: Enable manual control for LPSPI PCS signals
Add a function imx9_lpspi_select_cs to assert CS at the start of
an SPI transfer and keep it asserted until called again to
de-assert it. This can be called by board-provided imx9_lpspi_select,
in case the CS needs to be controlled via the LPSPI block and not
GPIO.

The TCR register CONT (continue) bit is asserted to prevent CS toggling
during the transfer, and the PCS bits are set to mark the correct CS

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-19 12:28:32 -03:00
Jukka Laitinen
fbd27c045b arch/imx9: Correct LPSPI TCR register PCS bit definitions
According to the TRM, only bits 24-25 are reserved for chip select, and
the maximum number of internal chip selects is 3 (on LPSPI4 bus only).

Fix the TCR_PCS_MASK and remove extra definitions.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-19 12:28:32 -03:00
ouyangxiangzhen
ff5944d8fc arch/tricore: Add the clkdev driver for tricore.
Some checks failed
Build Documentation / build-html (push) Has been cancelled
This commit added the clkdev driver for tricore.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
v-tangmeng
a221df7175 arch/xtensa/esp32[-s2|-s3]: add USE_NXTMPDIR_ESP_REPO_DIRECTLY
Directly downloading the Git repository is inconvenient for local debugging.
This will allow to automatically download external packages from the Internet.
If not set, the repo need to be download will need to provide them manually,
otherwise an error will occur and the build will be aborted.

Add `USE_NXTMPDIR_ESP_REPO_DIRECTLY`, with this we can use
`USE_NXTMPDIR_ESP_REPO_DIRECTLY=y make` which can directly use esp-hal-3rdparty
under nxtmpdir without CLONE, CHECK_COMMITSHA, reset, checkout and update. Just
`cp -rf nxtmpdir/esp-hal-3rdparty chip/$(ESP_HAL_3RDPARTY_REPO)`.

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2025-11-18 21:46:50 +08:00
ouyangxiangzhen
7e7828b3f6 timers/oneshot: Remove oneshot tick API.
This commit removed all oneshot tick API for new clkdev API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01: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
f70ec7384b arch/risc-v: 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
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
ouyangxiangzhen
ec45923cbe arch/arm64: 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
ouyangxiangzhen
c9f9e1e35f arch/intel64: add timer initialization for the secondary CPUs.
This commit added timer initialization for the secondary CPUs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
liwenxiang1
27959044c3 arch/intel64: Change the name of the global TSC variable.
This commit changed the name of the global TSC variable.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-11-17 10:25:37 +08:00
liwenxiang1
5697e4fabb arch/intel64: Macro definition use positive check
This commit added macro definition using positive checking.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-11-17 10:25:37 +08:00
liwenxiang1
62a2f5c2f6 arch/intel64: Add TSC adjust setting for SMP
This commmit added TSC adjust setting for SMP.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
946ac39c7a arch/intel64: Fix updating MSR_IA32_TSC_ADJUST.
If the initial value of the MSR_IA32_TSC_ADJUST register is not 0 (may be modified by BIOS or bootloader), it may cause timing errors. This commit addressed the issue.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
7185f41356 arch/intel64: Support MSR_IA32_TSC_ADJUST.
On newer x86 CPUs, the MSR_IA32_TSC_ADJUST register is utilized to fine-tune the offset of the Time Stamp Counter (TSC). This commit introduces support for MSR_IA32_TSC_ADJUST and enhances the TSC tickless
driver, optimizing its performance.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
8957740117 arch/intel64: Disable set_pcid if CPU does not support.
This commit disabled `set_pcid` function if CPU does not support.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
9364d0aa37 arch/risc-v: simplify mtimer driver.
This commit simplified RISC-V mtimer driver.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
932f890267 arch/arm64: add timer initialization for the secondary CPUs.
This commit added timer initialization for the secondary CPUs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
0b34c167e5 arch/arm64: tick alignment work-around for the generic timer.
This commit aligned the arm64 generic timer count to the tick boundary. Notice that this is just a work-around. We should pass both the current system ticks and the delay ticks as input parameters. But we only have the delay tick here due to the oneshot interfaces.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
songjunfan
5e17b5f6ec arch/arm64_boot.c: Fixed the boot stage stuttering issue on iMX8QM.
Before we disable dcache, we should flush all dcache.

Signed-off-by: songjunfan <songjunfan@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
“duanqinshuo”
0b9c86905b arch/tricore: Fix specific definitions in the generic UART module
We found that specific chip pin definitions were used in the generic UART source file. Since pin definitions vary across different chips, the UART pin definitions have been moved to the corresponding chip-specific directory.

Co-authored-by: Chengdong Wang <wangchengdong@lixiang.com>
Signed-off-by: Qinshuo Duan <duanqinshuo@lixiang.com>
2025-11-14 01:48:17 +08:00
hujun5
f1506c6212 fiq: fix some FIQ config in arm64/armv7-r/armv8-r
1. up_irq_save should not mask fiq if CONFIG_ARCH_HIPRI_INTERRUPT=y
2. up_irq_save should mask fiq if CONFIG_ARCH_TRUSTZONE_SECURE=y
3. up_irq_save should mask irq if CONFIG_ARCH_TRUSTZONE_SECURE=n
4. add up_secure_irq in arm64
5. add ARCH_HAVE_TRUSTZONE support for ARCH_CORTEX_R82

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-11-12 20:39:54 +08:00
Jani Paalijarvi
97c228c517 arch/arm64/src/imx9/imx9_flexspi_nor.c: Implement MTDIOC_RESET command
MTDIOC_RESET ioctl command executes "Reset Enable" and "Reset Memory"
commands to enter a power-on reset condition.

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2025-11-12 20:39:00 +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
haitomatic
6b45617064 arch/risc-v/mpfs: Remove strict CAN frame data length check.
Some checks failed
Build Documentation / build-html (push) Has been cancelled
In MSS CAN transmit function, the check of net pkt data len is not neccessary. Since there are cases that the pkt len can exceed the expected 16 bytes of can_frame but the pkt is still valid. Such a case is when CONFIG_NET_CAN_RAW_TX_DEADLINE is enabled which has pkt len to become 32 bytes due to cmsghdr overhead.

Signed-off-by: haitomatic <hai.to@unikie.com>
2025-11-11 22:16:51 +08: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
Matteo Golin
310a808d3d rpi4b/framebuffer: Introduce frame buffer support to the RPi4B
Introduces a very basic frame buffer driver implementation for the RPi4B
which is registered at startup and works with frame buffer graphics
examples (and LVGL). Graphics are displayed on the HDMI0 and HDMI1
output, depending which one is plugged into the display. I have not
tested using both at once, nor does the driver account for that. They
are both referred to as display 0, plane 0 since the RPi4B frame buffer
interface does not seem to have a way of distinguishing.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-11-09 16:48:14 -03:00
hujun5
aff64bb3dc arm64: add demo for gdbstub
Some checks failed
Build Documentation / build-html (push) Has been cancelled
Gdbstub demo::
   The Qemu version must be above 9.2 to support two serial ports.

   One window:
   ./tools/configure.sh qemu-armv8a:gdbstub; make -j25
   qemu-system-aarch64 -cpu cortex-a53 -nographic -machine virt,virtualization=on,gic-version=3 -net none -kernel ./nuttx -serial mon:stdio -serial pty
   char device redirected to /dev/pts/27 (label serial1)
   - Ready to Boot Primary CPU
   - Boot from EL2
   - Boot from EL1
   - Boot to C runtime for OS Initialize

   Another window:
   gdb-multiarch nuttx -ex "target remot /dev/pts/27"
   GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
   Copyright (C) 2024 Free Software Foundation, Inc.
   License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
   This is free software: you are free to change and redistribute it.
   There is NO WARRANTY, to the extent permitted by law.
   Type "show copying" and "show warranty" for details.
   This GDB was configured as "x86_64-linux-gnu".
   Type "show configuration" for configuration details.
   For bug reporting instructions, please see:
   <https://www.gnu.org/software/gdb/bugs/>.
   Find the GDB manual and other documentation resources online at:
   <http://www.gnu.org/software/gdb/documentation/>.

   For help, type "help".
   Type "apropos word" to search for commands related to "word"...
   Reading symbols from nuttx...
   Remote debugging using /dev/pts/26
   gdb_get_registers (state=0x403e1590) at gdbstub/lib_gdbstub.c:1020
   1020              reg = state->running_regs;
   (gdb) c

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-11-09 22:45:26 +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
xiezhanpeng3
6238da1355 arch/tricore: remove magic number in tr3xx uart config
Replace magic number with macro for better code readability.

Signed-off-by: xiezhanpeng3 <xiezhanpeng3@lixiang.com>
2025-11-04 20:32:20 -05:00
wangchengdong
c342c0851f xtensa/esp32s2: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in xtensa/esp32s2 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
97b24a1a0b xtensa/esp32: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in xtensa/esp32 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
53dd00328d renesas/rx65n: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in renesas/rx65n 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
6c28a2b749 arm64/imx9: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt
Replace the spinlock/sched_lock pair in arm64/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
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