Commit graph

63147 commits

Author SHA1 Message Date
zhekunren
078782846e net/tcp: add configurable delayed ACK threshold
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
The delayed ACK logic previously sent an ACK for at least every second
received segment (hard-coded threshold of 2 per RFC 1122).  Add the
NET_TCP_ACK_FREQUENCY Kconfig option (range 1-255, default 2) to make
this threshold configurable at build time.

The delayed ACK timer still forces an ACK after at most 0.5 seconds, so
RFC 1122 timing compliance is preserved regardless of the configured
threshold.  The default value of 2 keeps the exact current behavior:
the new condition rx_unackseg >= FREQ - 1 is equivalent to the previous
rx_unackseg > 0, and the counter increment degenerates to the previous
rx_unackseg = 1 assignment.

Signed-off-by: zhekunren <zhekunren@qq.com>
Assisted-by: GLM-5.2 <noreply@z.ai>
2026-09-08 09:00:19 +08:00
Michal Lenc
af2a8c6412 drivers/mtd/gd25.c: ensure the device is not in power down mode
Commit 2a7cf05 added support for QSPI control but removed functions
gd25_purdid (leave power down state) and gd25_pd (enter power down).
It's likely ok to avoid putting the device in power down state after
every operation, but we need to wake it up from the power down state
before first accessing it.

Without the fix the flashes used with NuttX prior to 2a7cf05 commit
don't work anymore as they are in power down state. The fix ensures
we wake from this state during the initialization.

Also fixes various coding style errors.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-09-08 08:59:33 +08:00
zhangyu117
9b9d87b69c arch/atomic: remove up_testset in spinlock
Remove the per-arch testset implementation from the spinlock layer.

The testset abstraction predates the unified spinlock.h API and is no
longer used now that all arches provide spin_lock_irqsave()/
spin_unlock_irqrestore() directly.  Drop the per-arch *_testset.{c,S}
implementations and spinlock.h files for arm, sim, sparc, tricore,
x86_64, and xtensa, along with the CXD56_TESTSET,
CXD56_TESTSET_WITH_HWSEM, and CXD56_ATOMIC_WITH_HWSEM Kconfig options
in arch/arm/src/cxd56xx, and simplify the CXD56 semaphore pool loop
in cxd56_sph.c to a single unconditional range.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-09-08 08:58:54 +08:00
ouyangxiangzhen
f1837981fa style: add missing blank line after declarations
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Fix checkpatch "Missing blank line after declarations" errors in
drivers/timers/arch_timer.c and sched/sched/sched_processtickless.c.
These are pre-existing issues, not introduced by the recent tickless
RR series.

Assisted-by: Zhipu GLM-5.3
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
ouyangxiangzhen
75bc159896 sched/tickless: Fix SCHED_RR timeslice accounting on preemption
In tickless mode, the scheduler timer is stopped whenever the currently
running task requires no time slicing (CLOCK_MAX).  When a SCHED_RR task
was later switched in, nothing re-armed the timer, so the task could run
indefinitely without round-robin rotation.

Also, when a SCHED_RR task was preempted, its timeslice counter was not
decremented for the time already consumed, effectively giving the task
"bonus" CPU time when resumed.

Solve both by performing RR accounting on context switches:

- nxsched_suspend_roundrobin() charges the elapsed execution time
  against the timeslice of the RR task being switched out
- nxsched_resume_roundrobin() restarts the scheduler timer for the
  remaining timeslice of the RR task being switched in, so the timer
  is always armed while an RR task is running

This also removes the previous workaround in nxsched_process_timer
that triggered the scheduler on every timer tick.

Assisted-by: Zhipu GLM-5.3
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
ouyangxiangzhen
be9200f95a sched/sched: Fix roundrobin scheduler timer if SCHED_TICKLESS enabled
In tickless mode, the scheduler timer is stopped whenever the currently
running task requires no time slicing (CLOCK_MAX).  When a SCHED_RR task
was later switched in, nothing re-armed the timer, so the task could run
indefinitely without round-robin rotation.

Reassess the scheduler timer in nxsched_switch_context() before the
context switch when the task being switched in uses round-robin
scheduling, so that the timer is always armed while an RR task is
running.  Hooking into nxsched_switch_context() covers all context
switch paths (task context switch, interrupt exit, syscall and task
exit) since every architecture calls it on every switch.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
ouyangxiangzhen
f134a5678d sched/hrtimer: Fix reprogram with wrong expiration when reinserting hrtimer
In hrtimer_start_absolute, when a pending hrtimer is removed (was the
head) and reinserted with a later expiration time, the reprogram flag
remains true but the hrtimer is no longer the earliest timer in the
queue. The old code passed hrtimer->expired to hrtimer_reprogram, which
was incorrect. Use hrtimer_get_first()->expired to ensure the hardware
timer is reprogrammed with the actual earliest timer's expiration time.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
ouyangxiangzhen
b438b7a083 timers/clkcnt: Round-up when converting nsec to cnt
Use round-up logic in clkcnt_delta_time2cnt() to prevent
timer sleep duration being too short due to truncation.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
ouyangxiangzhen
9ab05ec3f5 drivers/timers: fix UB and mask width in up_timer_getmask
The mask computation introduced by "fix infinite loop in
up_timer_getmask when maxticks == CLOCK_MAX" has two problems:

1. If maxticks == 0, flsx(0) expands to __builtin_clz(0), which is
   undefined behavior, and the shift count becomes 8 * sizeof(clock_t)
   = 64 for a 64-bit clock_t, which is undefined behavior as well.
   The loop-based code that was replaced kept *mask = 0 in this case.

2. CLOCK_MAX is INT64_MAX, i.e. 63 one bits, not a full-width bit
   pattern. The resulting mask is always one bit narrower than the
   one produced by the original loop; e.g. a 32-bit timer got
   0x7fffffff instead of 0xffffffff, so counter deltas >= 2^31 were
   truncated in the clock timekeeping code.

Fix this by keeping *mask = 0 when maxticks == 0 and by deriving the
mask from the full-width unsigned constant (uint64_t)-1, which
restores the all-ones semantics of the original loop and still covers
the maxticks == CLOCK_MAX case.

Also initialize maxticks in arch_timer.c: if the lower half does not
implement the maxtimeout ops, the value is left untouched and would
otherwise be read uninitialized.

Assisted-by: Zhipu GLM-5.3
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
ouyangxiangzhen
72db205050 drivers/timers: fix infinite loop in up_timer_getmask when maxticks == CLOCK_MAX
When maxticks equals CLOCK_MAX (all bits set), the loop that builds
the mask by (*mask << 1) | 1 never terminates because the shifted
value wraps around to the same mask value, making next > maxticks
always false.
Replace the loop with a single flsx-based expression that computes
the mask directly, which naturally covers the CLOCK_MAX case.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-09-07 10:17:46 -03:00
yushuailong
170d02da21 sched/critmonitor: Restore the target run start time.
The context-switch merge assigned the current timestamp to run_time instead of run_start. This overwrote the accumulated runtime and left the next elapsed-time calculation with a stale start value when critical-monitor CPU load accounting was disabled.

Store the timestamp in run_start under the thread runtime monitor configuration, matching the former resume path.

Fixes: b2a69ba781 ("sched: merge nxsched_suspend/resume_critmon")
Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
2026-09-07 21:06:53 +08:00
yushuailong
23d2eb96f3 tools/pynuttx: Update the preemption field annotations.
The struct tcb_s premp_* members were renamed to preemp_*, but the GDB TCB protocol retained the old annotations.

Update the annotations to match the current structure field names.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
2026-09-07 21:06:53 +08:00
yushuailong
ba77d2b708 sched/critmonitor: Fix the preemption start field name.
The premp_start member was renamed to preemp_start, but the old name was reintroduced when the critical monitor switch paths were merged.

Use the current struct tcb_s field name so configurations with preemption monitoring enabled build successfully.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
2026-09-07 21:06:53 +08:00
yushuailong
4d14db131c sched/critmonitor: Fix declaration spacing.
Add the blank lines required between local declarations and statements so sched_critmonitor.c passes nxstyle.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
2026-09-07 21:06:53 +08:00
raiden00pl
eb2226dccc tools/nxstyle: whitelist S2OPC identifiers
Whitelist the S2OPC and OPC UA prefixes plus the mixed-case
structure fields used by the NuttX port and server example.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-09-07 21:05:55 +08:00
Justin Hammond
c47d7151d7 arch/risc-v/eic7700x: Maintain the data cache through the L3 controller.
The EIC7700X is not cache coherent.  No device that moves data on its
own snoops the harts' caches or is snooped by them, so a buffer handed
to a device needs the cache maintained around the transfer.  The harts
are coherent with each other; it is DMA that is not.

The RISC-V standard offers no way to do that here: the Zicbom extension
this core does not implement is the portable answer, and there is no
other.  Maintenance is instead a store to the L3 controller carrying the
physical address of a cache block.  That store is the only operation the
hardware offers: it writes back and invalidates together, so a block
cannot be dropped without being written out first.  Everything built on
top is shaped by that, which is why a range being invalidated has to own
whole blocks.

The L3 is inclusive of the L1 data cache and back invalidates it, so one
store per block maintains the whole hierarchy, with nothing to do per
hart.  The block size is 64 bytes, which is what makes the descriptor
rules in the storage and network drivers what they are.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-07 10:03:52 -03:00
Justin Hammond
1686bb6c9e arch/risc-v/eic7700x: Add CPU core clock control.
Drives the speed of the four application cores.  The rate is set to any
of the operating points the vendor validates, all of which share a core
voltage, so this touches no regulator.

The cores run from the PLL being reprogrammed, so they park on a slower
clock first, through a selector the vendor names as glitch free.  While
parked the PLL is stopped, given new dividers, restarted and watched
until it locks; if it never locks the cores stay parked, since returning
them to an unlocked PLL does not fail safely.

Above a gigahertz the bus ratio must be two to one before the cores
return: the bus fabric does not reach beyond about eight hundred
megahertz.  That is the one step in the sequence software cannot recover
from, so the mux is moved before the ratio.

The rate is measured rather than derived.  The cores are counted against
the crystal derived time counter and the result reported beside what the
clock tree computes, because the manual and the vendor's code number the
CPU PLL's outputs differently.  The core selector's parent is
cpupll_fout1, and the three CPU PLL outputs are marked
CLK_GET_RATE_NOCACHE since this driver reprograms that PLL at run time.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-07 10:03:33 -03:00
Jacob Dahl
304cbb1372 arch/arm/stm32h7: poll MDIO completion in microseconds, not 5 ms steps
stm32_c22_read() and stm32_c22_write() waited for the MACMDIOAR busy bit
with up_mdelay(5) between checks. A Clause 22 frame takes about 30 us,
so the first check always sees the bus busy and every PHY register
access costs a 5 ms busy-wait, roughly 150 times the transfer.

stm32_phyinit() waits for link-up with PHY_RETRY_TIMEOUT (6552) MSR
reads. With no cable attached that is 33 s of CPU spent in
up_mdelay() inside ifup, with the network lock held: on an STM32H753
the netinit thread pinned the core at 44% for the first 65 s after
boot and every socket operation on other threads blocked until it gave
up. Before the MDIO bus refactor, stm32_phyread() polled the busy bit
in a tight loop.

Poll every 10 us instead, with the timeout expressed in microseconds so
the total bound stays at 10 ms, and report the timeout from the result
rather than the loop counter so a transfer that completes on the last
iteration is not logged as timed out.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-07 09:57:52 -03:00
Hritik Naik
2a6a86cb68 fs/procfs: fix buffer overflow in mount_sprintf
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
vsnprintf() returns the total formatted string length even when truncated to info->line. Passing this untruncated length to procfs_memcpy causes a read beyond the 64-byte line staging buffer.

Fixes #20011

Signed-off-by: Hritik Naik <hritiknaik16@gmail.com>
2026-09-06 12:16:02 -03:00
Abhishek Mishra
e6d8fe32ea Documentation/applications: document how to test tflite-micro.
Add a Testing section for sim:tflm and document Makefile tflm_hello,
AllocateTensors, and generic ops so the in-tree docs match the apps
TFLM changes.

Assisted-by: Cursor:Grok-4.6
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-09-06 21:12:43 +08:00
Megha Rajput
05cc04e306 net: preserve checksum state for empty fragments
Some checks failed
MemBrowse Memory Report / changes-filter (push) Has been cancelled
MemBrowse Memory Report / load-targets (push) Has been cancelled
MemBrowse Memory Report / identical (push) Has been cancelled
MemBrowse Memory Report / analyze (push) Has been cancelled
checksum() accesses data[0] and calculates an invalid last_byte
pointer when processing an empty fragment with odd state set.

Return early when len is zero to preserve the checksum state and
avoid accessing data from an empty fragment.

Assisted by: GitHub Copilot
Signed-off-by: Megha Rajput <i.meghar.2408@gmail.com>
2026-09-05 10:36:43 +08:00
wangjianyu3
71499bd66e boards/rp2040: support reboot bootloader via reset_usb_boot()
Add reset_usb_boot ROM function typedef and wire it into
board_reset() so that 'nsh> reboot bootloader'
(BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER) on RP2040 boards enters
BOOTSEL USB mass-storage mode directly, matching the behavior
already available on rp23xx boards.  All other status values keep
the existing up_systemreset() behavior.

This affects all boards under boards/arm/rp2040/common (pico,
pico-w, feather-rp2040, xiao-rp2040, w5500-evb-pico, etc.) since
the change is in the shared board_reset() implementation.

Assisted-by: GitHubCopilot:claude-4.6-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-09-05 10:36:07 +08:00
jsanchez-2g
6b5673a433 stm32g0: Add flash bank swap support
Add APIs to toggle the dual-bank flash mapping and reload the option bytes. Reject bank swapping when BOOT_LOCK is enabled and leave the swap operation as a no-op on single-bank devices.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: jsanchez-2g <jsanchez@2g-eng.com>
2026-09-05 10:34:48 +08:00
Justin Hammond
4a5852f02c boards/risc-v/eic7700x: Correct the UART reference clock.
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
The console divisor was computed from 198144000, a figure with no source
in the manual, the vendor tree or Linux, all of which give the low speed
peripheral clock as 200 MHz.  The clock tree now reports lsp_uart0_pclk
at 200 MHz, and section 12.4.3.2 makes that clock the UART's baud
reference.

Also enable the fractional divisor.  These are DesignWare UARTs with DLF
implemented, four bits wide at offset 0xc0, which is where
UART_DLF_OFFSET lands once scaled by this board's register increment.
Section 12.4.3.2 works the same example at the same 200 MHz.

At 115200 the error goes from 1.41% to 0.006%.  The old figure with the
old divisor was tolerable; the margin only gets worse at higher rates.

DEBUG_CLK and DEBUG_CLK_ERROR are enabled so a clock that fails to
register is reported.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-04 15:56:37 -03:00
Justin Hammond
2114981067 boards/risc-v/eic7700x: Report the clock tree at startup.
The architecture registers the clock tree before the board runs, and every
driver the board brings up afterwards depends on it.  Report what
registered, so a tree that came up short is visible without a debug build.

eic7700x_clk_count() supplies the numbers; /proc/clk has the tree itself.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-04 15:56:37 -03:00
Justin Hammond
0a85476f7c arch/risc-v/eic7700x: Describe the clock tree the boot loader leaves.
Nothing in this port knew what any clock ran at, so a driver needing a
rate had to carry a hard coded one, which is wrong the moment the boot
loader changes.

Register the Clock and Reset Generator with the NuttX clock framework:
the PLLs, muxes, dividers and gates covering the low speed peripherals,
the U84 cluster, the RTC and timers, the NOC, boot SPI, SCPU, LPCPU, DDR
and TCU, the high speed peripherals, the always on DMA and secure blocks,
the GPU, DSP, die to die link and NPU, and the video input, output and
codec paths.  The tree is visible through /proc/clk.

Registration writes nothing: the tree comes up describing what the boot
loader left behind.  A clock moves only when a driver asks, by enabling a
gate, setting a divider or reparenting a mux.  A mux carrying a clock the
system is running on will speed up on request and refuses to slow down,
because that changes the timing every driver downstream was configured
for while they are using it.

The PLL post divider fields do not sit where the TRM's register diagram
puts them; they are ordered here to match the rates the tree reports.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-04 15:56:37 -03:00
Justin Hammond
01106b4784 arch/risc-v/eic7700x: Add the blank lines nxstyle asks for.
Two declarations in eic7700x_start.c are followed immediately by a
statement, which nxstyle reports as "Missing blank line after
declarations".  Both predate this series and are already in master, but
CI runs checkpatch over the whole range rather than per commit, so any
change touching this file is reported against them.

Whitespace only, no functional change.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-09-04 15:56:37 -03:00
Marco Casaroli
0d31418ba8 arch, boards, cmake: Build C++ ELF modules without __cxa_atexit.
A C++ module with a static object does not link.  GCC registers each such
object's destructor with __cxa_atexit(dtor, obj, &__dso_handle), and
__dso_handle comes from crtbegin, which a module does not link:

  hello++3.cxx:119: undefined reference to `__dso_handle'

It is reachable today with CONFIG_PIC, where a module is linked as an
executable and the symbol has to resolve.  Without it the link is
relocatable, the symbol stays undefined and nothing complains until
something makes it resolve.

-fno-use-cxa-atexit registers the destructors with atexit() instead, which
puts them in .fini_array.  That is also where libelf_uninit() looks for them
when the module is unloaded, so the flag that makes the link work is also
the flag that makes the destructors run.

The option goes wherever CXXELFFLAGS is defined, which is the architecture
Toolchain.defs and the boards that reassign it.  The toolchains that are not
GCC or Clang are left alone: ceva, tricore, z16 and the z80 family.

The CMake build sets it once, next to where the architecture elf.cmake is
included.  A generator expression keeps it off the C compiles, because the
option is valid for C++ alone and GCC warns about it otherwise, and the
compiler id gates it so that a toolchain which is neither GCC nor Clang does
not see it.  It cannot go in the toolchain file itself: CMake reads that file
again inside try_compile, in a project that has not included the NuttX
extensions, so the call is an unknown command there.

Reproduced with apps/examples/elf on mps3-an547:picostest with CONFIG_PIC
enabled: hello++3 fails to link before and links after.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-09-04 15:44:24 -03:00
Megha Rajput
c5619cb3fe fs/inode: propagate inode search errors
inode_reserve() previously continued processing all negative return
values from inode_search(). Only -ENOENT indicates that the target
inode is absent and creation may continue.

Propagate other search errors through the existing cleanup path to
avoid continuing inode creation with invalid insertion metadata.
Assisted-by: GitHub Copilot
Signed-off-by: Megha Rajput <i.meghar.2408@gmail.com>
2026-09-04 13:50:54 -03:00
AlmAck
784c6519de arch/arm/nrf53: enable the application core flash cache
The nRF5340 application core comes out of reset with its flash cache
disabled and nothing in the tree turns it on.  nrf53_start() does call
nrf53_enable_icache(), but that drives NVMC ICACHECNF and is gated on
NRF53_FLASH_PREFETCH, which depends on NRF53_NETCORE -- so it is not
even compiled for an application core build.

The nRF5340 places the application core cache in a separate CACHE
peripheral at 0x50001000.  NRF53_CACHE_BASE is already defined in
hardware/nrf53_memorymap_cpuapp.h, but there was no register header and
no enable.  Add both, behind a new NRF53_CACHE option.

The option defaults to n, matching ARMV7M_ICACHE and
ARMV8M_ICACHE/DCACHE, so that upgrading does not silently change the
behaviour of an existing configuration.

Measured on nrf5340-dk at 64 MHz with apps/benchmarks/scbench:

  protected-build syscall round trip   64.1 us -> 29.6 us
  userspace sem wait + post pair       4.75 us -> 1.95 us

Flat builds benefit equally; the gain is on any flash-resident code
path.

Per the nRF5340 Product Specification, 'CACHE - Instruction and data
cache', 'both instruction and data accesses towards flash memory or XIP
code regions are cached'.  The cache does not observe NVMC programming,
so nrf53_flash.c has to account for it: both up_progmem_eraseblock() and
up_progmem_write() read back what they just programmed to verify it, and
up_progmem_ispageerased() reads a whole page, so lines covering the
region being programmed are commonly resident.  Bypass the cache for the
duration of an erase or a write and invalidate it before re-enabling, so
the verify reads the array and later readers do too.  That file is built
only when NRF53_PROGMEM is selected, which is not the default.

Signed-off-by: AlmAck <gluca86@gmail.com>
2026-09-04 13:50:15 -03:00
jsanchez-2g
b75b93fd32 stm32g0: Fix erase bank selection after bank swap
The flash page number follows the logical memory mapping, but BKER selects a physical flash bank. Account for the nSWAP_BANK option when selecting BKER so erasing a logical address targets the corresponding physical bank after a swap.

Assisted-by: OpenAI Codex <codex@openai.com>
Signed-off-by: jsanchez-2g <jsanchez@2g-eng.com>
2026-09-04 13:44:51 -03:00
Felipe Moura
c8f1e093f5 xtensa/esp32s3: drop redundant CONFIG_UORB_STACKSIZE from defconfig
nuttx-apps PR #3763 adds "default 4096 if LIBC_PRINT_EXTENSION" to
CONFIG_UORB_STACKSIZE. Both lckfb-szpi-esp32s3/qmi8658 and
esp32s3-ws-lcd128/imu-qmi8658 already set CONFIG_UORB_STACKSIZE=4096
explicitly, which now matches the new default and makes the line
redundant, so savedefconfig drops it -- causing the CI defconfig-sync
check (testbuild.sh -R) to flag these files as stale and fail the
xtensa-03 job.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Assisted-by: Claude:claude-sonnet-5
2026-09-04 13:27:32 -03:00
DuoYuWang
30503f8fdf boards/imx93-evk: disable work queues in bootloader
Some checks failed
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Build Documentation / build-html (push) Has been cancelled
The bootloader image has no linked HPWORK or LPWORK consumers, but
enabling both queues pulls unused scheduler code into its constrained
OCRAM region.

Disable the predefined work queues and let deferred memory reclamation
fall back to the idle thread.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
DuoYuWang
a1e2813c25 Documentation/wqueue: document custom user queues
Describe the handle-based custom queue APIs, worker-pool creation and
teardown, periodic requeue, cancellation semantics, and return values.

Clarify that libc user work queue APIs use blocking synchronization and
must only be called from task context, while kernel and Flat queue and
asynchronous cancellation operations remain ISR-safe.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
DuoYuWang
315d9f7e64 libc/wqueue: use the uninterruptible wait helper
Replace the local EINTR retry loop with nxsem_wait_uninterruptible().
This keeps the master implementation aligned with the libc semaphore API
without changing cancellation behavior.

Keep the cleanup separate so release branches where the helper is not
available to Protected user space can use the functional commit without a
downstream compatibility patch.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
DuoYuWang
ae5997eef7 libc/wqueue: support custom user work queues
Implement the handle-based create, queue, priority, cancellation, and
teardown APIs for CONFIG_LIBC_USRWORK.  Custom queues use configurable
pthread worker pools while the predefined USRWORK queue remains available.

Match scheduler-backend delay, replacement, cancellation, and lifecycle
semantics.  Restrict the libc backend to task context because it uses
blocking synchronization.

Tested on an STM32H7 PX4 FMUv6C with ostest wqueue in Protected user space.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
DuoYuWang
3582d5a04b sched/wqueue: use the uninterruptible wait helper
Replace the local EINTR retry loop with
nxsem_wait_uninterruptible().  This keeps the master implementation
aligned with the semaphore API without changing cancellation behavior.

Keep the cleanup separate so release branches where the helper is
unavailable can use the lifecycle commit without a downstream
compatibility patch.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
DuoYuWang
7e5d05f4fd sched/wqueue: consolidate queue submission paths
Factor the common queueing logic used by work_queue_wq() and
work_queue_next_wq() into a private helper.

Preserve existing timing semantics: regular work calculates its absolute
expiration before taking the queue lock, while periodic work advances the
previous expiration under the lock.

This is a code deduplication change with no public API or behavior changes.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
DuoYuWang
d2e01b9055 sched/wqueue: harden custom queue lifecycle
Prevent work_queue_free() from destroying predefined queues or freeing a
custom queue from one of its own callbacks.  Mark teardown under the queue
lock, reject new submissions, return pending work to its owner, and wait for
every worker before releasing queue resources.

Clean up partially created worker pools, reject invalid delays, safely
replace pending periodic work, and make synchronous cancellation wait for
every concurrent callback using the same work structure.

Tested on an STM32H7 PX4 FMUv6C with the matching ostest suite in Flat and
Protected kernel builds.

Assisted-by: Codex:GPT-5
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-09-04 23:02:48 +08:00
Felipe Moura
673b4245f7 xtensa/esp32s3: Fix CONSOLE_DEV clobbered by USBSERIAL macro.
When a real UART (CONFIG_UARTx_SERIAL_CONSOLE) is selected as the
system console while CONFIG_ESP32S3_USBSERIAL is also enabled (e.g. to
keep /dev/ttyACM0 available as a secondary device alongside an
external console UART), the unconditional

  #ifdef CONFIG_ESP32S3_USBSERIAL
  #  define CONSOLE_DEV g_uart_usbserial
  #endif

block silently redefines CONSOLE_DEV, clobbering the correct earlier
definition that pointed it at the chosen UART device.

Confirmed on real hardware (Seeed XIAO ESP32-S3): with UART0 selected
as console and USBSERIAL also enabled, the board boot-looped on
RTCWDT_RTC_RST every ~8s, never reaching NSH. With this fix, NSH comes
up normally over UART0 and /dev/ttyACM0 remains available.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Assisted-by: Claude:claude-sonnet-5
2026-09-04 17:51:16 +08:00
AlmAck
ffc29e9a5d drivers/mtd/filemtd: fix nxstyle errors in filemtd.c
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Pre-existing violations in this file, reported by checkpatch because the
preceding commit touches it, and requested by a reviewer.

Three "Missing blank line after declarations", in the BIOC_PARTINFO,
MTDIOC_ERASESTATE and register-time-erase blocks.

The rest were one problem: the whole mtd_loop_ioctl() switch body sits two
columns short of NuttX style. With `switch` at 2 and its brace at 4, case
labels belong at 6 — as they already are in filemtd_ioctl() earlier in this
same file — but here the comments and cases sit at 4 and everything under
them follows suit, which checkpatch reports as 21 separate comment,
alignment and brace errors. Reindented the block to match, including the
two stray closing lines that had drifted to seven and five columns.

Whitespace only: `git diff -w` is empty apart from the three added blank
lines, and the brace count is unchanged. checkpatch is clean against
master.

Signed-off-by: AlmAck <gluca86@gmail.com>
2026-09-04 08:51:20 +08:00
AlmAck
eee09f42ce drivers/mtd/filemtd: open the backing file O_RDWR
filemtd_initialize() opens its backing file with

  mode = O_RDONLY | O_WRONLY | O_CLOEXEC;

Commit 6161c73639 introduced this when it replaced the non-standard
O_RDOK | O_WROK pair, describing the change as a pure text substitution.
That held while the access mode was a genuine bitmask: O_RDONLY was
(1 << 0), O_WRONLY was (1 << 1), and O_RDWR was both bits, so the OR
produced O_RDWR.  O_ACCMODE was defined as an alias for O_RDWR.

Commit 9e141acab3 then aligned the flags with Linux.  The low two bits
became an enumeration -- O_RDONLY 0, O_WRONLY 1, O_RDWR 2 -- and
O_ACCMODE stopped being an alias for O_RDWR and became an independent
mask of 3.  OR-ing two members of that enumeration is no longer
meaningful: O_RDONLY | O_WRONLY evaluates to 1, and masking it with
O_ACCMODE yields O_WRONLY.

The file is therefore opened write-only, and fs_read.c rejects every
read on it with -EACCES.  The failure does not name filemtd: on the
simulator it surfaces as a LittleFS mount of a filemtd-backed partition
returning -ENOSPC, after which nothing on that volume works.

This appears to be an isolated miss rather than a pattern.  Grepping the
tree for the same construct -- two access-mode constants OR-ed together
-- finds only this one call site.  The one remaining place that
bit-tests the mode, fs/xipfs/xipfs_vfs.c:606, happens to be correct
under the new values (and would have been wrong under the old ones).
The hostfs NUTTX_O_* mirror and host_oflags_convert() were updated in
lockstep and switch on the masked value.

Signed-off-by: AlmAck <gluca86@gmail.com>
2026-09-04 08:51:20 +08:00
Antoine Juckler
3a8bd97b3b tools/Unix.mk: add nuttx.asm to manifest
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Fix bug where "nuttx.bin" was written to nuttx.asm instead of appending
nuttx.asm to nuttx.manifest

Signed-off-by: Antoine Juckler <ajuckler@users.noreply.github.com>
2026-09-03 22:40:35 +08:00
Abhishek Mishra
c351769725 Documentation/applications: add mlearning docs and rename mlearing.
Some checks failed
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Build Documentation / build-html (push) Has been cancelled
The apps tree is apps/mlearning, but documentation lived under the
misspelled mlearing path as title-only stubs. TensorFlow Lite Micro and
standalone CMSIS-NN had no pages.

Rename the directory to mlearning, document each package from the
current Kconfig and build files, and add the sim:tflm board
configuration.

Assisted-by: Cursor:Grok-4.6
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
2026-09-03 14:41:34 +08:00
Alan Carvalho de Assis
a177c02b58 doc/boards: Add Documentation to GD32VW553-HMQ board
This PR adds Documentatio to GD32VM553-HMQ board.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-09-03 07:27:43 +02:00
Alan Carvalho de Assis
ff5ebcac85 boards/gd32vm55x: Add support to GD32VW553-HMQ
This commit add support to GD32VW553-HMQ board based on GigaDevice
GD32VM553K_START as base.

No AI used for this board, the but GD32VM553K_START was developed
by Jorge Guzman with help from Claude Code.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-09-03 07:27:43 +02:00
Megha Rajput
907a521b15 arch/risc-v: assign per-cpu data by logical cpu
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Assign the per-CPU area using the HART to CPU mapping instead of the
order in which HARTs register. This keeps interrupt stack assignment
consistent with the logical CPU and avoids incorrect per-CPU IRQ stack
selection when HART boot order differs.

Signed-off-by: Megha Rajput <i.meghar.2408@gmail.com>
2026-09-02 12:00:45 -03:00
raiden00pl
6ffbbbd39d Documentation: add instructions how to run NTFC locally
add instructions how to run NTFC locally

Assisted-by: Claude Code
Signed-off-by: raiden00pl <raiden00@railab.me>
2026-09-02 11:44:23 -03:00
raiden00pl
179bf35fdd tools/ci: remove obsolete testrun harness
NuttX CI runtime test cases have migrated to NTFC.
Remove the unused pytest harness and related files.

Assisted-by: Claude Code
Signed-off-by: raiden00pl <raiden00@railab.me>
2026-09-02 11:44:23 -03:00
Xiang Xiao
83b4239e1d arch/sim: switch nonblock setup to ioctl FIONBIO
Update host_uart_start() to set stdin/stdout nonblocking via ioctl.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-09-02 09:02:09 -03:00