read_line() removes a trailing newline and then checks g_line[len - 1]
for a line-continuation backslash. A blank line leaves len at zero, so
the continuation check reads before g_line.
Return the empty line to the caller before checking for a continuation.
kconfig_line() already skips empty lines, so parser behavior is
unchanged.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
riscv_fillpage() is the LOADPF/STOREPF handler used under
CONFIG_PAGING. It checked whether intermediate page table levels were
already allocated, but never checked the final leaf PTE before
installing a new mapping.
RISC-V raises the same LOADPF/STOREPF cause both when a leaf PTE is
absent (a real fault) and when it is present but its permission bits
don't satisfy the access, e.g. a store to a .text page whose write
access was revoked after ELF loading. The two cases are
indistinguishable from mcause alone.
Treating both cases as "page missing" let riscv_fillpage silently
allocate a fresh, zeroed physical page over an existing mapping,
discarding the old page (a leak) and defeating whatever permission
that mapping was enforcing. Reproduced on real hardware: a user-space
store to an already-loaded .text page got a fresh writable page
instead of being rejected.
Check the leaf PTE's valid bit before allocating; if a mapping already
exists, panic instead of overwriting it.
Signed-off-by: liang.huang <liang.huang@houmo.ai>
The CI refresh step removes the explicit LVGL terminal keyboard input selection from the esp32s3-m5-cardputer lvglterm defconfig.
Update the saved defconfig so unrelated pull requests do not fail the normalize check on this board.
Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
This board config is reaching the 64KB Flash limit, so disable some
not used interface to reduce size.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
Rewrite the RTL8721Dx / PKE8721DAF and RTL8720F / RTL8720F-EVB pages against
the official Realtek product specifications, from an application-developer
point of view:
- Describe the application core NuttX runs on -- an Arm Cortex-M55-compatible
core, up to 345 MHz on RTL8721Dx (KM4) and up to 320 MHz on RTL8720F (KM4TZ)
-- and the on-chip memory, instead of the internal multi-core / IPC
arrangement that is not relevant to application developers.
- Fix the RTL8721Dx SRAM size: 512 KB (was incorrectly documented as 288 KB).
- Add per-part memory (RTL8721DAF and RTL8720FBF: 4 MB NOR flash, 512 KB
SRAM), wireless (RTL8721Dx: Wi-Fi 4 dual-band + BLE; RTL8720F: Wi-Fi 6
2.4 GHz + BLE + Thread), peripheral and security highlights.
Signed-off-by: raul_chen <raul_chen@realsil.com.cn>
Simplify complex ifdefs by using UNUSED.
The current conditions do not cover all cases anyway,
and adding more conditions only complicates the code.
Signed-off-by: raiden00pl <raiden00@railab.me>
rtl8720f_wifi_initialize() spawned a kthread to run the blocking WHC host
bring-up and register wlan0, so the netdev appeared only after netinit had
already run its one-shot associate -- the WiFi never auto-connected at
boot. Do the bring-up synchronously on the board bring-up path (mirroring
rtl8721dx_wifi_initialize) so wlan0 exists before netinit runs.
Enable the standard netinit auto-connect machinery in both board
defconfigs: NETINIT_THREAD (runs associate + DHCP off the NSH init path so
the prompt is not blocked), NETINIT_DHCPC, and placeholder
NETINIT_WAPI_SSID/PASSPHRASE the user replaces with their own credentials
(WIRELESS_WAPI + the wapi cmdtool are already enabled).
Signed-off-by: raul_chen <raul_chen@realsil.com.cn>
Rework the Ameba WHC WiFi driver from the legacy flat net_driver_s model
to the netdev lower-half framework (netdev_lowerhalf_s + netdev_ops_s with
.transmit/.receive, IOB-based quota backpressure and a dedicated
NETDEV_RX_THREAD). This provides real TX backpressure and moves RX off
the IPC callback onto a bounded rx queue.
Raise the host TX skb pool (skb_num_ap) to a minimum of 16. The SDK
default of 4 is too small for sustained TCP TX: the host send runs out of
buffers (-2), which exhausts retransmits and tears the connection down.
Enable CONFIG_NET_TCP_SELECTIVE_ACK (which selects OUT_OF_ORDER) in both
board defconfigs. WiFi's occasional loss otherwise stalls TCP RX on RTO
timeouts (~2 Mbit/s); with SACK + out-of-order queuing RX recovers to
~12-13 Mbit/s.
Signed-off-by: raul_chen <raul_chen@realsil.com.cn>
CCM_CR_COUNT is defined as the last CCM root index in the non-SCMI tables, and CCM_CR_PALCAMESCAN also uses that value. Use a strict greater-than check so root 94 reaches the CCM register helpers.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Replace the TODO placeholder with a description of the two-pass build
mechanism (CONFIG_BUILD_2PASS). pass1/ supports two-pass builds where
application-generated source files are compiled and linked into the
kernel address space during pass 2, primarily for kernel symbol table
generation required by loadable kernel modules.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
Author: hanzhijian <hanzhijian@zepp.com>
Compare the requested LED id with BOARD_RLED instead of assigning it. BOARD_RLED is nonzero, so the assignment made every non-green LED request select the red LED instead of rejecting invalid ids.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Check the provided length before reading the current lowoutstream byte. This avoids reading past zero-length or fully consumed buffers before the loop condition stops.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
EEPROM_DS_COUNT is the number of supported DS2XXX device types and is used as the size of the EEPROM geometry tables. Reject it before storing the device type for later table indexing.
Generated-by: OpenAI Codex
Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
Limit modem version tokens parsed from AT command responses to the LTE version field sizes. Also require both HWVERSION fields before copying them so a partial parse does not read an uninitialized temporary buffer.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
GS2200M response parsing copies device-provided text fields into fixed-size local buffers.
Add field widths to the sscanf string conversions so the parsed address, port, and command fields stay within their destination arrays.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Limit the parsed TXTABLE name field to NAME_MAX and reject entries that do not provide all three required fields. This avoids writing past struct partition_s.name when a text partition table contains an overlong name.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
The XMC_VADC_* constants describe counts, so the valid register, group, and channel indexes are below those values. The current checks allow the count itself through and then use it to index VADC group, channel, and result registers.
Reject those boundary values before the register array access.
Generated-by: OpenAI Codex
Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
PWMIOC_ENABLE_LED_BANK_MODE uses the provided LED number to index the LP503X led_mode array. Reject values outside the RGB LED range before writing that array.
Generated-by: OpenAI Codex
Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
When several RNDIS responses are queued, the control request handler sends one complete response if the host wLength is smaller than the whole queue. If the first queued response is also larger than wLength, copying hdr->msglen bytes would overrun the requested transfer and the completion path would consume a partial message.
Return EMSGSIZE before copying in that case so the queued response remains intact for a retry with a large enough wLength.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
pci_epc_map_msi_irq() used && when checking the EPC pointer and map_msi_irq callback. If epc is NULL, the right-hand side dereferences it; if the callback is NULL on a valid EPC, the guard does not reject it before the call.
Match the surrounding EPC wrappers by rejecting a NULL EPC, an out-of-range function number, or a missing map_msi_irq callback before taking the lock and invoking the operation.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
pci_epf_device_register() and pci_epf_unregister_driver() used || in DEBUGASSERT expressions that validate a pointer and a required field or callback. If the pointer is NULL, the right-hand side dereferences it; if the pointer is valid but the required member is NULL, the assertion passes.
Require both conditions in each assertion so the debug checks match the preconditions used later in the functions.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
Fix repeated and misspelled words in the kernel modules versus shared libraries implementation notes so the text reads correctly.
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
All I2S driver operation functions say in their signature description
that negative errno values are returned on failure. However, some of
these same functions had `uint32_t` return types. This would result in
incorrect comparison of the return value against signed error code
values.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Replace the divergent board conventions for the timer input clock
frequency with a single uniform convention provided by every board:
- STM32_APBx_TIMn_CLKIN and BOARD_TIMn_FREQUENCY -> STM32_TIMn_CLKIN
- STM32_APBx_LPTIMn_CLKIN, BOARD_LPTIMn_FREQUENCY and
STM32_LPTIMn_FREQUENCY -> STM32_LPTIMn_CLKIN
- STM32_APB1_THRTIM1_CLKIN and BOARD_HRTIM1_FREQUENCY ->
STM32_HRTIM1_CLKIN
All STM32 consumers (tim/lptim/pwm/adc/dac/capture/sdadc/dfsdm/
pulsecount) updated to match; the timer input clock is now bus-agnostic
in the drivers.
Boards that carried the same timer clock in more than one convention now
define STM32_TIMn_CLKIN exactly once, derived from the APB bus clock
(PCLKx with the x2 doubler when the APB prescaler is greater than 1),
instead of redefining it with a second, sometimes different, value.
BREAKING CHANGE: The timer input-clock board macros STM32_APBx_TIMn_CLKIN,
BOARD_TIMn_FREQUENCY, STM32_APBx_LPTIMn_CLKIN, BOARD_LPTIMn_FREQUENCY,
STM32_LPTIMn_FREQUENCY, STM32_APB1_THRTIM1_CLKIN and
BOARD_HRTIM1_FREQUENCY are removed in favor of STM32_TIMn_CLKIN,
STM32_LPTIMn_CLKIN and STM32_HRTIM1_CLKIN. Out-of-tree boards must
define the new macros (drop the APB bus from the name, keep the value),
and out-of-tree drivers referencing the old names must be updated.
Signed-off-by: raiden00pl <raiden00@railab.me>
the timers example causes the following error:
iscv-none-elf-ld: /github/workspace/sources/nuttx/staging/libapps.a(timer_main.c.github.workspace.sources.apps.examples.timer_1.o): in function timer_main:
/github/workspace/sources/apps/examples/timer/timer_main.c:209:(.text.timer_main+0x1c2): undefined reference to sigaction
riscv-none-elf-ld: /github/workspace/sources/apps/examples/timer/timer_main.c:278:(.text.timer_main+0x30e): undefined reference to sigaction
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
If this configuration is enabled it will cause the build error
riscv-none-elf-ld: /github/workspace/sources/nuttx/nuttx section .text will not fit in region ilm
riscv-none-elf-ld: region ilm overflowed by 976 bytes
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Replace the per-family stm32_get_uniqueid() implementations and the two
IP-versioned common variants with a single generic byte-array reader,
arch/arm/src/common/stm32/stm32_uid.c.
BREAKING CHANGE for STM32 M0 families: stm32_get_uniqueid() now always
takes a uint8_t[12] buffer.
Out-of-tree Cortex-M0 code that used the previous prototype
"void stm32_get_uniqueid(uint32_t *uid)" must change its buffer to
"uint8_t uniqueid[12]".
Signed-off-by: raiden00pl <raiden00@railab.me>
Since already have support for SHA2-224, extend cryptodev/cryptosoft
to support HMAC version of SHA2-224.
Signed-off-by: Peter Barada <peter.barada@gmail.com>
Add an "lvglterm" configuration that runs the on-screen NuttShell terminal
(apps/examples/lvglterm, touch input variant) on the display: an on-screen
LVGL keyboard driven by the FT5X06 touchscreen feeds the shell and the NSH
output is rendered in an LVGL text area.
Update the apps/examples/lvglterm documentation to describe the two input
variants (on-screen touch keyboard and physical keyboard) and their
configuration options (input source, keyboard device and font choices).
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
Add the 56-key matrix keyboard driver for the M5Stack Cardputer. The keys
form an 8x7 matrix behind a 74HC138 3-to-8 demultiplexer; the driver scans it
on the low-priority work queue and registers a keyboard device at /dev/kbd0,
reporting ASCII codes with SHIFT/CTRL and Fn (cursor) handling.
Add an "lvglterm" configuration that runs the on-screen NuttShell terminal
(apps/examples/lvglterm, physical-keyboard input variant) on the ST7789
display: the shell output is rendered in an LVGL text area and the keyboard
feeds the input. Wi-Fi is included so the on-screen shell can associate with
an access point using wapi.
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
It is very easy to get NXDoom running on NuttX, but the instructions
was omitting the needed steps to get it running on Simulator.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
The existing first-order LCG (seed = 470001 * seed % 999563) has several
quality problems:
- Output range limited to [1, 999562] (~20 bits) instead of full 32-bit
- Lower bits have very short periods (8-bit period = 1, 16-bit = 105)
- Overall period only ~1M, far too short for many applications
- Causes mbedtls_rsa_gen_key to loop forever when rand() consumption
aligns with the cycle length (issue #16760)
Replace the entire order-based LCG implementation (CONFIG_LIBC_RAND_ORDER
0-3) with Marsaglia's xorshift32:
- Full 32-bit output range
- Period 2^32 - 1 (~4.29 billion)
- Fast: just three XOR/shift operations
- No floating-point math needed
- No CONFIG_LIBC_RAND_ORDER configuration required
Remove the CONFIG_LIBC_RAND_ORDER Kconfig option and clean up all
defconfig references (12 boards) and related comments.
Signed-off-by: hanzhijian <hanzhijian@zepp.com>
1. The .kasan.unused and .kasan.global sections contain compiler-generated
data with the WRITE flag (.data..LASAN*), but the linker script placed
them before .text without specifying a memory region. The linker could
not put writable sections into the read-only ROM (rx) region, so it
silently placed them at 0x40000000 in RAM, creating an extra LOAD
segment that conflicts with QEMU virt's RAM layout and causes boot
failure.
2. The .kasan.global should be placed before .data because .data
patten (*(.data*)) includes .kasan.global pattern (*(.data..LASAN0)),
and it cause kasan_global.py cannot find .kasan.global section to
generate the g_global_region array.
3. Move .kasan.shadows from before .text to after .rodata. Placing it
before .text causes .text to shift when .kasan.shadows transitions
from empty (pass 1) to populated (pass 2+), preventing the multi-pass
link addresses from converging. After .rodata it does not affect any
upstream section addresses.
4. Add CMake post-build step to strip .kasan.unused and .kasan.global
sections from the final binary, matching the Makefile build behavior.
Signed-off-by: leisiji <2265215145@qq.com>
When CONFIG_BUILD_KERNEL is enabled, user-space and kernel-space have
separate address spaces. User-space addresses passed via syscalls
(e.g., open) are registered by KASAN but should not be monitored,
as they are not kernel heap allocations. This causes KASAN to
report false positives on user-space pointers accessed through
system calls.
Mark the user-space heap with nokasan=true so KASAN skips checking
its address range, consistent with how rptun already handles this.
Signed-off-by: leisiji <2265215145@qq.com>
When CONFIG_MM_KASAN_GLOBAL is enabled, hook.c is also linked into
libmm.a. However, g_global_region (defined in global.c) is only
injected into the nuttx ELF by kasan_global.py — it does not process
the app binary. This causes undefined symbol errors when linking an
app against libmm.a.
Guard the inclusion of global.c with __KERNEL__ so that only kernel
builds pull in the global KASAN region, while app builds fall back
to the no-op stub.
Signed-off-by: leisiji <2265215145@qq.com>
Includes a defconfig to play NXDoom on the simulator. Keyboard input is
available through X11, as well as graphics rendering. The `/data` folder
is used as the default home for game files.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>