Commit graph

58632 commits

Author SHA1 Message Date
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
wangjianyu3
89df084b0e fs/vfs: check if all iov_base are accessible
Check if all `iov_base` are inside accessible address space.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-06-10 09:58:25 +08:00
raiden00pl
13fba11e9b boards/nucleo-c092rc: add FDCAN examples
add FDCAN examples for nucleo-c092rc based on
SocketCAN interface and CAN character driver interface.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-09 15:26:12 -03:00
raiden00pl
ba00fa6478 arch/stm32c0: add FDCAN support
add FDCAN support for stm32c0 family.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-09 15:26:12 -03:00
Kerogit
25876e327e arch/avr: fix atomic load functions from arch_atomic.c
For AVR, atomic functions generated by LOAD macro turn into load surrounded
by up_irq_save and up_irq_restore. The generated code was incorrect as can
be seen from disassembly of __atomic_load_4:

in   r18, 0x3f ; store interrupts enabled flag
cli            ; disable interrupts
out  0x3f, r18 ; restore the flag
movw r30, r24  ; copy parameter (address) to pointer register
ld   r22, Z    ; indirect load to return value registers
ldd  r23, Z+1
ldd  r24, Z+2
ldd  r25, Z+3
ret            ; return

The interrupts are disabled to be immediately re-enabled, the load only takes
place after that.

Both up_irq_save and up_irq_restore are defined in inline assembly. Other
architectures (x86/486, Risc-V) mark this assembly with clobbers: memory.
Doing the same thing for AVR alleviates the problem:

in      r18, 0x3f ; store interrupts enabled flag
cli               ; disable interrupts
movw    r30, r24  ; copy address
ld      r22, Z    ; load
ldd     r23, Z+1
ldd     r24, Z+2
ldd     r25, Z+3
out     0x3f, r18 ; restore interrupts enabled flag
ret               ; return

Besides compiling the code and checking the assembly, this was tested
with a custom stress application on AVR128DA28.

Assembly of up_irq_enable is marked in the same way with regards to clobbers.

This patch also removes two functions that are not called from anywhere
(up_irq_disabled, putsreg)

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2025-06-09 21:42:21 +08:00
raiden00pl
13ac3d5e57 arch/arm/src/stm32f0l0g0: UID support for F0, L0 and C0
add UID support for F0, L0 and C0

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-06-09 08:33:42 -03:00
dongjiuzhu1
a5485d6c53 net/utils: avoid unalign access g_tcp_connections_buffer
the address is 0x3c270203, cause unaligned access usage Fault
(gdb) p g_tcp_connections
$1 = {pool = 0x3c270203 <g_tcp_connections_buffer> <error: Cannot access memory at address 0x3c270203>,
prealloc = 8, dynalloc = 1, nodesize = -376, sem = {semcount = 32767, flags = 0 '\000',
waitlist = {head = 0x0, tail = 0x0}}, freebuffers = {head = 0x0, tail = 0x0}}

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-09 08:04:21 -03:00
kywwilson11
60c9c66839 Added support obtaining the unique id for the stm32g0x1.
Changed copyright to apache copyright. Altered stm32_uid function to take uint32_t pointer instead of a twelve byte uint8_t array. Refined code in stm32_uid.c.

Fixed style and indentation.

Signed-off-by: kywwilson11 <kwilson@2g-eng.com>
2025-06-09 09:49:26 +02:00
Peter van der Perk
e9b7dee55a arch/arm/imxrt: Serial add RXDMA support for singlewire mode
In singlewire mode the ops were only for non-dma usecases. But if rxdma is enabled we can use that.
For TXDMA it's not possible because we've to change pin direction immediately after transmission is done.
2025-06-09 09:45:42 +02:00
Jukka Laitinen
dd07367f4e arch/riscv/Kconfig: Remove select "ARCH_PERF_EVENTS" from Kconfig
There is no more linking error for MPFS after the flagging is corrected in
drivers/timers/arch_alarm.c

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-06 17:31:10 +08:00