Commit graph

60363 commits

Author SHA1 Message Date
ouyangxiangzhen
bbb4cc4f6f timers/arch_alarm: Replace relative oneshot API.
This commit replaced the relative oneshot API with the absolute API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
4b31291043 timers/oneshot: Add clkdev fast-path.
This commit add fast-path for oneshot clkdev APIs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
9569129862 timers/oneshot: Add new start_absolute interface.
Current timer hardware supports both absolute and relative count timers. Without an absolute count timer interface, setting an alarm timer might incur additional overhead in obtaining the current time, resulting in performance degradation and inaccurate timing.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
6dcb8270e3 timers/oneshot: Add new clkdev interfaces.
This commit introduce new clockdevice interfaces for oneshot.
- It can represent both `timer` and `alarm`.
- It simplifies the implementation of timer driver. Timer driver do not need considering the time conversion between clock count, tick and timespec.
- It sets timer align to the tick boundary to improve timer accuracy.
- It can avoid using 64-bit division during timer expiration interrupt, improves performance and reduces interrupt latency.
- It considers almost all multiplication overflow problems in time conversion without processing at the driver.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
06fe9f076e timers/oneshot: Introduce count-based interfaces.
This commit introduced count-based oneshot interfaces.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
c6139f89c8 timers/oneshot: Improve tick-compatiable interfaces.
This commit improved tick-compatiable interfaces.

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
Antoine Juckler
224afcb77b drivers/eeprom/spi_xx25xx: Multi-device SPI bus support
Adds a device ID to ee25xx_initialize, which is stored in the
ee25xx_dev_s structure. This ID is used when calling SPI_SELECT.

The implementation is based on the handling of the chip select in
mtd/ramtron.c

This change is NOT backward compatible: the function signature has changed

Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
2025-11-18 09:37:07 -03:00
Antoine Juckler
81550800d4 drivers/mtd/at25ee: Multi-device SPI bus support
Adds a device ID to at25ee_initialize, which is stored in the
at25ee_dev_s structure. This ID is used when calling SPI_SELECT.

The implementation is based on the handling of the chip select in
mtd/ramtron.c

This change is NOT backward compatible: the function signature has changed

Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
2025-11-18 09:37:07 -03:00
Alan Carvalho de Assis
34febea2df drivers/sensors: Fix Kconfig
As reported by a user in Discord channel selection BMI160 with SPI
interface still showing the I2C configuration. This patch fixes it.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-11-18 09:16:12 -03: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
9e573371bb Documentation: Add GPT information to RA4M1 documentation
- Updated information about the RA4M1 microcontroller capabilities, including the General Purpose Timer (GPT).
- Added information about the PWM driver support for the Arduino R4 Minima board using the GPT timer.

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-11-17 09:01:31 -03:00
leocafonso
80b9fc30de boards/arduino-r4-minima: Add PWM support using GPT timer
- Added PWM support on Arduino R4 Minima board.
This board has 5 PWM channels available using the GPT timer from the RA4M1 microcontroller.
- Added a pwm config file to enable PWM supporting GTP2 GTIOCB on P102.

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-11-17 09:01:31 -03: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
dd88c99863 timers/clkcnt: Fix the assertion if max_tick > CLOCK_MAX.
This commit fixed the assertion if max_tick > CLOCK_MAX when the clock_t is
32-bit.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 14:15:44 +08:00
ouyangxiangzhen
575844ad39 clkcnt: Add clockcount abstraction.
This commit added the clkcnt abstraction.
Clkcnt is used to abstract the cycle counter of hardware timer, which can represent almost all existing timers. Time conversion through API provided by clkcnt can avoid any timing conversion problem (multiplication overflow, division precision loss, etc.).

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 14:15:44 +08:00
ouyangxiangzhen
152c66de05 compiler: Support pure function attributes and compile-time constant condition.
This commit added support for pure function attributes and compile-time
constant condition.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 14:15:44 +08: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
donghaokun
f2d0d5b45f Documentation: Add documentation for NSH_BUILTIN_AS_COMMAND
This patch adds the description for NSH_BUILTIN_AS_COMMAND including its advantage and disadvantage.
NSH_BUILTIN_AS_COMMAND is an optional configuration in nsh. It allows nsh builtin apps to run directly like nsh command without creating a thread. This is done in pull request https://github.com/apache/nuttx-apps/pull/3168

Signed-off-by: Haokun Dong <donghaokun@lixiang.com>
2025-11-15 10:49:58 -05:00
simbit18
6161fececf tools/checkpatch.sh: Improved error display on GitHub
The improvement includes symbols that help employees visualise any errors detected during the PR check phase (check.yml).

Error ->  U+274C  Cross Mark
             https://en.wikipedia.org/wiki/X_mark

Checks pass -> ✔️ U+2714 Heavy Check Mark
             https://en.wikipedia.org/wiki/Check_mark

These characters are emojis that are recognized by the Unicode standards which define what each character represents.

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-11-14 16:50:25 -03:00
Matteo Golin
858619ec29 docs/platforms/raspberrypi-4b: Document cgol configuration
Documents the newly added `cgol` configuration for playing with Conway's
Game of Life.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-11-14 16:57:10 +01:00
Matteo Golin
c38e8dd061 boards/raspberrypi-4b: Add CGOL configuration
Adds another configuration which includes the CGOL game application.
This gives users something animated and interesting to see on the HDMI
video output, since the frame-buffer example is not as interesting.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-11-14 16:57:10 +01:00
Matteo Golin
058c7a8353 docs/applications/games/cgol: Documentation for CGOL game
Added documentation for the new Conway's Game of Life application.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-11-14 16:57:10 +01:00
Filipe Cavalcanti
caa3772d50 boards/risc-v/esp32c3: remove CXX initialization from BLE defconfig
Espressif common initialization and lib_cxx_initialize are having
conflicts and multiple linker script issues.
Removing CXX_INITIALIZE solves those problems with no side effects.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-11-14 23:53:14 +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
wangchengdong
1b58a449c5 sched/clock: Make g_system_ticks a static variable
Make g_system_ticks a static variable, as it is only accessed by
    clock_get_sched_ticks().

    This change improves code modularity and enhances safety, since
    clock_get_sched_ticks() performs proper synchronization when
    reading g_system_ticks.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-11-13 18:40:16 -03:00
simbit18
1b58dd92d8 boards/arm/kinetis: CMake added NXP KWIKSTIK-K40 and PJRC Teensy 3.x boards
CMake added boards:

  - NXP KWIKSTIK-K40

 -  PJRC Teensy 3.x

Signed-off-by: simbit18 <simbit18@gmail.com>
2025-11-13 14:13:16 -05: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