Commit graph

58641 commits

Author SHA1 Message Date
raiden00pl
0a23b0c14e arch/stm32{f0l0g0|f7|h5|h7|l4}/stm32_adc.c: add support for batch DMA transfer
Add an option that configure the number of regular group conversions
that will trigger a DMA callback transfering data to the upper-half driver.

By default this value is 1 and the driver behaves the same as before
the change. Increasing this value allows to reduce the number of
DMA interrupts and achieve higher sampling rates.

DMA support for H5 and H7 is not complete so this change has no effect,
but for consistency they have also been modified.

The naming between ports has also been unified:

- dmabuffer -> r_dmabuffer
- nchannels -> rnchannels
- chanlist -> r_chanlist
- jchanlist -> j_chanlist

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-16 21:58:47 +08:00
Michal Lenc
01bfa1a500 fs/vfs/fs_close.c: avoid double free if CONFIG_FS_NOTIFY is set
Double free occurred in lib_put_pathbuffer if CONFIG_FS_NOTIFY option
was enabled. The second if statement has to be called only if the
close operation returned error. The bug was introduced in 14f5c48
and was causing misc/lib_tempbuffer.c:141 debug assertion.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-06-16 20:23:53 +08:00
liwenxiang1
81f27bd602 drivers/segger:Add config option to allow defining the macro as variable
we are using segger RTT protocol over shared memory for two core log/trace: one is NuttX another Linux/Windows. But the base address of shared memory can only be known at runtime, so we change SEGGER_RTT_UNCACHED_OFF from macro to global variable, and update to the correct g_segger_offset after the shared memory is initialized by:
g_segger_offset = (uintptr_t)ishmem - (uintptr_t)&_SEGGER_RTT;

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-06-16 14:56:06 +08:00
dongjiuzhu1
b0904e7c39 fs/shm: add O_CLOEXEC when allocate new struct fd to avoid lost flags.
fix bug about ltp_interfaces_shm_open_11_1

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-15 07:12:44 -03:00
dongjiuzhu1
5fd1ab8e0f fs/fcntl: using ioctl to implement FIOGCLEX/FIOCLEX/FIONCLEX
these command FIOGCLEX/FIOCLEX/FIONCLEX are related to struct fd,
so need to use ioctl to implement.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-15 07:12:44 -03:00
Jukka Laitinen
42b1ac90fb drivers/segger: Change SEGGER_RTT_LOCK into rspinlock
The SEGGER_RTT_LOCK needs to be recursive, otherwise system will
deadlock in SMP

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-15 00:07:26 +08:00
liwenxiang1
2fa5811f7c drivers/segger:Replace the included header file
The trunk branch fails to compile

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-06-15 00:07:26 +08:00
liwenxiang1
525fcb4a45 drivers/segger: move g_segger_lock to segger.c
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-06-15 00:07:26 +08:00
raiden00pl
2f625acbe1 arch/stm32{f0l0g0|f7|h5|h7}: add support for ADC trigger from TIMER TRGO
Add support for ADC trigger from TIMER TRGO event

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-14 10:46:24 -03:00
raiden00pl
b37e8ecf3c boards/nucleo-f446re: fix adc example
fix adc example for nucleo-f446re:

- the second ADC channel should be different from first channel
- enable ADC SCAN mode so we get convertion on CH0 and CH1
- disable software trigger from application, we use hardware triggering
from timer

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-14 10:44:37 -03:00
Filipe Cavalcanti
2912b3347c arch/risc-v: decouple common source for Espressif's MCUBoot port
Decouples the NuttX build from the MCUBoot common source on RISC-V Espressif
devices. Allows using different branches for each.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-06-14 17:11:58 +08:00
Filipe Cavalcanti
294848e623 arch/xtensa: decouple common source for Espressif's MCUBoot port
Decouples the NuttX build from the MCUBoot common source on Xtensa
devices. Allows using different branches for each.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-06-14 17:11:58 +08:00
Alessio Tudisco
cd5ad0f165 chore: update gitignore for .idea folder 2025-06-13 12:11:06 -03:00
raiden00pl
89e8c0c425 arch/stm32f0l0g0/adc: add timer trigger support
add ADC external trigger from TIMER for stm32-m0 chips

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-13 12:10:13 -03:00
raiden00pl
64c7354853 boards/nucleo-c0{71rb|92rc}: add clock definition for timers
add clock definitions for TIMERS in nucleo-c071rb adn nucleo-c092rc

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-13 12:10:13 -03:00
SPRESENSE
2fa3b72b3c fs/smartfs: Fix a fatal bug about sector writing after seek
When writing to the next sector after the forward position has been written
by seek, the old sector buffer is used, which may corrupt the file system.
Therefore, the sector buffer must always be updated after a writing by seek.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-06-13 20:42:36 +08:00
xuxingliang
28b2e01c22 nxgdb: fix style issue
Fix style issue reported after upgrading flake8 to 7.2.0

1 file would be left unchanged.
/home/nuttx/tools/pynuttx/nxgdb/utils.py:237:5: F824  is unused: name is never assigned in scope
    global g_type_cache
    ^
/home/nuttx/tools/pynuttx/nxgdb/utils.py:294:5: F824  is unused: name is never assigned in scope
    global long_type
    ^

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-06-13 20:37:04 +08:00
chenzhijia
341292064d nxgdb/utils.py: Fix source gdbinit.py script error report
Registering NuttX GDB commands from /home/mi/code/stable_oh2/nuttx/tools/pynuttx/nxgdb
set pagination off
set python print-stack full
"handle SIGUSR1 "nostop" "pass" "noprint"
Load macro: /tmp/6024dea73606400ae39a7b7da42cecbf.json
Please pip install debugpyIgnore module: elf, error: 'NoneType' object has no attribute 'code'
Traceback (most recent call last):
  File "/home/mi/code/stable_oh2/nuttx/tools/pynuttx/nxgdb/_init_.py", line 54, in init_gdb_commands
    module = importlib.import_module(f"{_package_}.{m}")
  File "/usr/lib/python3.10/importlib/_init_.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/mi/code/stable_oh2/nuttx/tools/pynuttx/nxgdb/elf.py", line 35, in <module>
    CONFIG_ARCH_USE_SEPARATED_SECTION = has_field("struct module_s", "sectalloc")
  File "/home/mi/code/stable_oh2/nuttx/tools/pynuttx/nxgdb/utils.py", line 488, in has_field
    return get_type_field(obj, field) is not None
  File "/home/mi/code/stable_oh2/nuttx/tools/pynuttx/nxgdb/utils.py", line 267, in get_type_field
    while t.code in (gdb.TYPE_CODE_PTR, gdb.TYPE_CODE_ARRAY, gdb.TYPE_CODE_TYPEDEF):
AttributeError: 'NoneType' object has no attribute 'code'
No symbol g_version found in memory, skipping version check

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2025-06-13 20:37:04 +08:00
xuxingliang
00304a18ed nxgdb/fs: fix exception when failed to parse symbol
Parse struct fields to determine array length.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-06-13 20:37:04 +08:00
Jukka Laitinen
5aa45e328e arch/riscv/ricv_exception.c: Dump the process name at exception in user space
This helps in debugging loaded elf files in CONFIG_BUILD_KERNEL. If a user space exception occurs,
one would beed the process name in order to debug the correct process/elf file.

Only dumping the pid and name of the crashed task/thread doesn't help, since different processes
may have helper threads with the same name.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-13 20:36:30 +08:00
Matteo Golin
a5f43aa8e8 docs/syslog: Add documentation for RFC 5424 support
Introduces two documentation additions. First, the RFC 5424 support is
documented on the main syslog documentation page, with information about
how to use it effectively. Second is the application documentation for
the `syslogd` application addition, which enables easy use of the new
RFC 5424 support.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-06-13 20:26:57 +08:00
Matteo Golin
4ccc3d4c96 drivers/syslog: Add RFC 5424 protocol support
Initial implementation of RFC 5424 support (syslog protocol). Allows
users to force-format the syslog output in a RFC 5424 compatible way,
making NuttX systems 'originators' that are able to interface with
syslog 'collectors' and 'relays' (useful for logging to syslog servers).

In addition to regular formatting options for syslog output, users can
also add structured data (currently only timeQuality is implemented,
assuming no sync and no timezone is no known). Facilities and severities
now also follow RFC 5424. Support for additional features (like
more sdata elements, msgid, etc.) will need to be built into the syslog
implementation if desired.
2025-06-13 20:26:57 +08:00
dongjiuzhu1
cf1e92e5a2 driver/optee: fix compile break
update api name accroading to new implementation.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-13 20:14:48 +08:00
Michal Lenc
1cbebc0302 arch/arm/src/samv7/sam_start.c: init perf events if enabled
__start should call up_perf_init, initialization of hardware performance
counter, if CONFIG_ARCH_PERF_EVENTS option is set. This allows the
usage of ARM cycle count register DWT_CYCCNT in benchmark
measurements instead of software clock.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-06-12 16:57:21 -03:00
Ville Juven
d8c907dfc7 imx9/lpuart: Fix SMP deadlock with imx9_txint
A deadlock occurs for priv->lock when uart_xmitchars is called from
within imx9_txint. This is because uart_xmitchars does a callback to
imx9_txint and tries to acquire the lock again.

However, there is no reason to hold the lock over uart_xmitchars, as it
has its own lock for mutual exclusion. Only the UART device needs to
be protected, and priv->lock does that.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 15:28:18 -03:00
Ville Juven
c17f99438e imx9/smp: Add boiler plate code to enable SMP with iMX9.X
This adds SMP support for iMX9.X CPUs

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 15:28:18 -03:00
p-szafonimateusz
36aefeadfe Documentation: review supported POSIX interfaces in NuttX
Add a page in the documentation listing supported and unsupported POSIX options.
This is the first step to support POSIX Application Environment Profiles.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-06-12 10:13:52 -03:00
Anthony Tran
e82d69533c riscv qemu-rv: fix kernel mapping by enabling CONFIG_MM_KMAP in knsh defconfig 2025-06-12 10:11:57 -03:00
dependabot[bot]
85f8304227 build(deps): bump tornado from 6.4.2 to 6.5.1 in /Documentation
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4.2 to 6.5.1.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.4.2...v6.5.1)

Updates by cederom:
* keep python 3.8 for tornado as used by gh ci, dependabot updated to 3.9.

---
updated-dependencies:
- dependency-name: tornado
  dependency-version: 6.5.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-12 19:09:47 +08:00
Alessio Tudisco
78dffd72f8 arch/arm/stm32f7: Add missing RCC include
Adds "stm32_rcc.h" include into "stm32_capture.c" to fix the compile error related to undeclared RCC stuff.
2025-06-12 19:09:34 +08:00
dongjiuzhu1
7927c8d105 tools/pynuttx: update fs.py base on new structure fd and file
Update the Python script based on the PR "Separate file
descriptors from file descriptions" in fs/vfs.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
Ville Juven
b8e30b54ec fs/vfs: Separate file descriptors from file descriptions
This patch is a rework of the NuttX file descriptor implementation. The
goal is two-fold:

1. Improve POSIX compliance. The old implementation tied file description
to inode only, not the file struct. POSIX however dictates otherwise.
2. Fix a bug with descriptor duplication (dup2() and dup3()). There is
an existing race condition with this POSIX API that currently results
in a kernel side crash.

The crash occurs when a partially open / closed file descriptor is
duplicated. The reason for the crash is that even if the descriptor is
closed, the file might still be in use by the kernel (due to e.g. ongoing
write to file). The open file data is changed by file_dup3() and this
causes a crash in the device / drivers themselves as they lose access to
the inode and private data.

The fix is done by separating struct file into file and file descriptor
structs. The file struct can live on even if the descriptor is closed,
fixing the crash. This also fixes the POSIX issue, as two descriptors
can now point to the same file.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
a12d21e830 fs/file: unify prefix about file_xxx api, like file_open, file_ioctl
old:
fs_getfilep, fs_putfilep, fs_reffilep
new:
file_get, file_put, file_ref

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
9ca5c1d9c6 fs/file: unify prefix f_ for member locked
update locked to f_locked

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
70fc5c3e77 fs/dup: remove unnecessary backup about fdcheck_tag and fdsan_tag
1. The call to file_close_without_clear in file_dup3 does not clear
the tag information, so there is no need to back it up.
2. file_dup3 don't need to copy tag information, tag is only valid for fd.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
3bc3092e6a fs/fs: remove unnecessary FS_REFCOUNT config
Previously, this config was added to ensure that the size of the struct
file remained unchanged, thereby preventing the Flash memory of
resource-constrained MCUs from being unnecessarily increased.

However, we have now refactored the relationship between struct fd and struct file,
reducing their memory footprint in both Flash and RAM.
Consequently, this config can be removed.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
Ville Juven
1e787ea280 nuttx/fs: Reorganize the code for close, dup, et. al.
Currently the code is dumped into one massive file; fs_files. Move the
different logical parts into their own files.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
Ville Juven
3fe1d1a54d fs/pseudofs: Add missing bumping of inode refcount
When a new pseudofile is created, the inode reference count needs to
be bumped to protect the node.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
2025-06-12 18:12:42 +08:00
raiden00pl
c37a270cda arch/stm32f0l0g0/stm32_tim.c: fix compilation when TIM6/TIM7 is missing
Fix compilation when TIM6/TIM7 is missing for stm32-m0.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-12 10:00:30 +08:00
raiden00pl
5437dabbff arch/stm32f0l0g0: remove references to CONFIG_STM32F0L0G0_FORCEPOWER
this is copy-paste from stm32, but CONFIG_STM32F0L0G0_FORCEPOWER
is not used in stm32f0l0g0

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-12 09:59:53 +08:00
Ville Juven
840ae60b60 nuttx/spinlock: Define empty macro for spin_unlock
So that the same code can be used with and without spinlocks.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-11 23:39:21 +08:00
Niccolò Maggioni
2d2defb8a0 docs: Fix pipenv lockfile for older Python versions
CI uses Python 3.8

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-06-11 23:11:08 +08:00
Niccolò Maggioni
2399702a28 docs: Update the ELF guides
Rewrite parts of the two ELF guides to use scripts included in the
export archive and modernize some deprecated tools and Bash idioms.

Also add the new sphinx_collapse extension to the docs build config.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-06-11 23:11:08 +08:00
Niccolò Maggioni
d651726b57 docs: Add missing CFLAGS to the ELF guides
As reported in apache/nuttx-apps#1828

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-06-11 23:11:08 +08:00
robert
be8471625f Add BLE config to esp32-sparrow 2025-06-11 15:48:25 +08:00
ouyangxiangzhen
19eac98526 sched: Add comments for wd_start_next and work_queue_next.
This commit added comments for newly added APIs wd_start_next and
work_queue_next.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
ouyangxiangzhen
df183b6682 sched/wqueue: Remove the work_queue_period.
For simplicity, better performance and lower memory-overhead, this commit replaced the periodical workqueue APIs with the more expressive work_queue_next. The work_queue_next restarts work based on the last expiration time.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
ouyangxiangzhen
efe2af643f sched/wdog: Replace periodcial timer with the wd_start_next.
This commit replaced periodical timer with the wd_start_next to improve the timing accuracy.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
ouyangxiangzhen
9d1b958524 sched/wdog: Remove the wd_start_period.
For better simplicity, this commit replaced the periodical wdog APIs with the more expressive wd_start_next. The wd_start_next restarts watchdog timer based on the last expiration time.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
wangjianyu3
5e94d4482b fs/vfs: check buffer count and pointer for iovec
There are iovecs provided by user such as readv().

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-06-10 09:58:25 +08:00