Commit graph

5608 commits

Author SHA1 Message Date
hanzhijian
ad182bcb4b sim: resolve host symbols eagerly on Linux
Resolve PLT entries at load time on Linux hosts so early host calls do not enter the lazy binder with simulated interrupts masked.

On Ubuntu 20 with GCC 9, the sim:nsh binary linked successfully after the -no-pie fix but crashed very early at runtime inside _dl_fixup / _dl_runtime_resolve_xsavec when up_irq_save() triggered a first-time PLT resolution.

Setting LD_BIND_NOW=1 avoided the crash and allowed NSH to start, which showed lazy binding was the trigger.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
2026-05-21 08:55:39 +02:00
raiden00pl
4484f16efc boards/nucleo-c0XXX: add PWM support
add PWM support for nucleo-c071rb and nucleo-c092rc

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-20 13:13:01 -04:00
Eren Terzioglu
9dca04a5cf boards/risc-v/esp32p4: Add touch sensor board support for esp32[-p4]
Add touch sensor board support for esp32p4

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-05-19 16:38:16 +08:00
Xiang Xiao
2c9f91526a board: enable LTO on g431 nsh boards and fix LTO link with toolchain switch
For boards b-g431b-esc1/nsh, nucleo-g431kb/nsh and nucleo-g431rb/nsh,
the `.data` section of nuttx.elf overflows the 128 KB flash region by a
few hundred bytes on default GNU EABI builds:

    arm-none-eabi-ld: nuttx section `.data' will not fit in region `flash'
    arm-none-eabi-ld: region `flash' overflowed by 296 bytes

Enabling CONFIG_LTO_FULL=y in the corresponding defconfigs brings flash
usage back below the 128 KB limit (~93%).

Additionally, fix arch/arm/src/cmake/gcc.cmake so that when LTO is
enabled it always uses the gcc-ar / gcc-nm / gcc-ranlib wrappers, not
just when CONFIG_ARM_TOOLCHAIN_GNU_EABI is also set.  CI tooling (via
tools/testbuild.sh) configures cmake first, then flips the toolchain
choice in .config with kconfig-tweak before running `cmake --build`.
With the previous "ARM_TOOLCHAIN_GNU_EABI && !LTO_NONE" guard the
regen step would switch to plain `ar` for the .a files, even though the
linker driver picked at configure time is still arm-none-eabi-g++ and
the object files contain GCC LTO IR.  The result was a flood of
"undefined reference to `printf' / `free' / `puts' ..." link errors
when running tools/testbuild.sh -A -N -R on the *_CLANG variants.

Now that we are inside gcc.cmake the toolchain is unambiguously GCC,
so dropping the redundant CONFIG_ARM_TOOLCHAIN_GNU_EABI conjunct keeps
the LTO-aware ar wrappers in place across kconfig-tweak toolchain
switches.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-05-19 16:21:28 +08:00
Xiang Xiao
c6654b1106 !sched/clock: remove CONFIG_SYSTEM_TIME64 and always use 64-bit time
The 32-bit system clock has a limited range (~497 days) and the
configuration knob is no longer worth the complexity given that
practically every modern target already enables it.  Make 64-bit
time_t/clock_t/sclock_t/nuttx_time_t the only supported flavor.

Specifically:
  - Drop the SYSTEM_TIME64 Kconfig option and its dependent
    PERF_OVERFLOW_CORRECTION/HRTIMER guards in sched/Kconfig.
  - Remove every #ifdef CONFIG_SYSTEM_TIME64 branch in headers
    (include/{sys/types.h,limits.h,inttypes.h,nuttx/clock.h,
    nuttx/fs/hostfs.h}) and core code paths
    (sched/clock/clock.h, drivers/power/pm/pm_procfs.c,
    drivers/rpmsg/rpmsg_ping.c, fs/procfs/fs_procfsuptime.c,
    libs/libc/wqueue/work_usrthread.c,
    arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c).
  - Strip CONFIG_SYSTEM_TIME64=y from every board defconfig.
  - Update Documentation/guides/rust.rst accordingly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-05-19 16:21:28 +08:00
Xiang Xiao
1b3af76bf3 !libc/stream: remove CONFIG_LIBC_LONG_LONG and always support long long
Long long support is now unconditional in printf/scanf and related
helpers. Remove the Kconfig option, the conditional compilation in
libvsprintf/libvscanf/ultoa_invert, the build-time #error in the
rn2xx3 driver, and clean up CONFIG_LIBC_LONG_LONG entries from all
board defconfigs.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-05-19 16:21:28 +08:00
Eren Terzioglu
87b63402a7 boards/risc-v/esp32p4: Add LPSPI and SPI3 board support
Add LPSPI and SPI3 board support for esp32[-p4]

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2026-05-19 02:04:35 +08:00
ImBonkers
8c0e52ed7d boards/arm/stm32n6/nucleo-n657x0-q: Add Nucleo-N657X0-Q board support.
Add board support for the STMicro Nucleo-N657X0-Q, sufficient to boot
NSH over the on-board ST-LINK virtual COM port (USART1, 115200 8N1)
in DEV (serial) boot mode.

Two defconfigs are shipped:

  - nsh:    minimal NuttShell prompt.
  - ostest: nsh + apps/testing/ostest for RTOS smoke testing.

Production signed XSPI flash boot is deferred to a follow-up; in DEV
mode the image is loaded directly into AXISRAM at 0x34000400 by the
host (e.g. STM32CubeProgrammer over ST-LINK), keeping the linker
script trivial — .text/.rodata/.data/.bss/.heap all in AXISRAM.

Signed-off-by: ImBonkers <samuelnlinden@pm.me>
2026-05-18 14:50:29 -03:00
raiden00pl
4df80e1928 !drivers/pwm: remove PWM_MULTICHAN option
BREAKING CHANGE: remove PWM_MULTICHAN option

PWM_MULTICHAN option is redundant, we can just set CONFIG_PWM_NCHANNELS > 1.
At default CONFIG_PWM_NCHANNELS is set to 1, so the default behavior is preserved.
Access to single channel API is now `info->channels[0].XXX` instead of `info->XXX`

This is the first step to simplify PWM implementation and make it more portable.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-18 11:35:25 -04:00
Jinji Cui
aff8ea572a boards/sim: skip -no-pie on HOST_ARM64 to fix sim:nsh link on aarch64 host
boards/sim/sim/sim/scripts/Make.defs adds `-no-pie` to ARCHCFLAGS /
ARCHPICFLAGS / LDFLAGS for every 64-bit non-Mac sim build.  The
original comment ("To compile 64-bit Sim, adding no-pie is necessary
to prevent linking errors but this may cause other issues on
Ubuntu 20.") already flagged the workaround as fragile.

On HOST_ARM64 the option is in fact actively harmful.  When gcc is
asked to produce a non-PIE executable on aarch64 it switches the
libgcc resolution path from the dynamic library
`libgcc_s.so.1` to the static archive `libgcc_s.a`.  Ubuntu's
arm64 toolchain (and Debian / Raspbian arm64) **does not ship**
`libgcc_s.a` (only `libgcc_s.so.1`), so the link aborts with:

    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s   (push-state / as-needed both fail)
    collect2: error: ld returned 1 exit status

`ld --verbose` shows ld searching 20+ paths for `libgcc_s.a`,
finding only `libgcc_s.so` (a linker script pointing at
`libgcc_s.so.1`) which is invalid in non-PIE mode.

x86_64 Linux is unaffected because Ubuntu ships the static
`libgcc_s.a` (or a compatible static-fallback library) in its
amd64 libgcc-N-dev packaging.  macOS, Windows and Cygwin go
through completely different code paths and never reach this
branch.

Extend the existing `else ifeq ($(CONFIG_HOST_MACOS),)` exclusion
to also cover HOST_ARM64 by concatenating the two variables in the
condition: `else ifeq ($(CONFIG_HOST_MACOS)$(CONFIG_HOST_ARM64),)`.
The condition is true only when both variables are empty (i.e. on
a 64-bit non-macOS non-aarch64 Linux host), so aarch64 hosts fall
through to gcc's default PIE-aware link path, which works
correctly.  This concatenation idiom matches the style already
used elsewhere in the file (suggested by @xiaoxiang781216 in
review).  The default text-segment placement
`-Ttext-segment=0x40000000` and `-Wl,--gc-sections` (set in the
common LDFLAGS just above this block) are honored regardless of
PIE / non-PIE.

Verified on NVIDIA Jetson Orin (Ubuntu 20.04 L4T, GCC 9.4) and
Raspberry Pi 4B (Debian 13 trixie, GCC 14.2):

  $ ./build.sh sim:nsh -j$(nproc)
  $ ./nuttx
  NuttShell (NSH)
  nsh> ostest
  ... [38 user_main stages, 14 PASS, 0 FAIL] ...
  ostest_main: Exiting with status 0

x86_64 Linux behaviour is unchanged (the concatenation is empty
there, so the block is taken exactly as before).

Companion patch: arch/sim: rename nuttx libc memchr to avoid host
glibc collision (independent fix needed on the same aarch64 hosts).

Signed-off-by: Jinji Cui <113000688+cjj66619@users.noreply.github.com>
2026-05-18 15:27:42 +08:00
wangjianyu3
eb0834cd27 boards/esp32p4: Remove unnecessary CONFIG_ESPRESSIF_MERGE_BINS
ESP32-P4 uses simple boot mode without a separate bootloader,
so merging binaries into a single 16MB file is unnecessary.
Removing this option allows 'make flash' to write only the
actual firmware (~380KB) instead of a padded 16MB image,
reducing flash time from ~55s to ~4.5s.

Assisted-by: GitHubCopilot:claude-4.7-opus
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-05-17 11:46:43 +08:00
Tiago Medicci Serrano
e05292f9da [arch|board]/risc-v: Allow BSS segments on PSRAM for ESP32-P4
This commits enables moving BSS data segments to the external PSRAM
on ESP32-P4. This is controlled by a Kconfig option.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-14 09:20:03 +08:00
Matteo Golin
e6b08b2a1e boards/esp32p4-function-ev-board: Normalize configuration
Normalize configuration following change to NuttX initialization
process.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-10 07:59:10 +08:00
Peter Bee
ea05918799 sim: support camera framework multi-instance and dynamic mounting
Allow the SIM camera/V4L2 capture framework to manage multiple
imgdata instances with dynamic mounting. This avoids cross-talk
between camera streams when multiple devices are used.

Signed-off-by: Peter Bee <bijunda@bytedance.com>
2026-05-08 19:51:39 +08:00
raiden00pl
deb52b0855 !arch/arm/src/stm32: remove STM32_USE_LEGACY_PINMAP
BREAKING CHANGE: remove STM32_USE_LEGACY_PINMAP and all references

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-07 11:45:23 +08:00
raiden00pl
cebdcdc692 boards/nucleo-h563zi/nshusbnet: normalize defconfig
boards/nucleo-h563zi/nshusbnet: normalize defconfig

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-06 08:33:06 -04:00
raiden00pl
7934a1c21c boards/stm32f3: migrate to new pinmap
migrate stm32f3 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-06 08:33:06 -04:00
Matteo Golin
89b4815382 boards/xtensa: Normalize configurations
Normalizes configurations after removal of some app-related init config
options due to simplification of NuttX init.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-06 13:27:26 +08:00
daniellizewski
fe67544d5f drivers/usbhost/usbhost_cdcecm.c: Converted CDC-ECM to lower half
Converted USB Host CDC-ECM to a lower half driver.
Removed existing full network driver callbacks and replaced with lower
half.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
daniellizewski
9b18160893 drivers/usbhost/usbhost_cdcecm.c: Added support for Host CDC-ECM
Added support for USB host to use an USB CDC-ECM device.
This class is used for usb-ethernet adapters as well as many modems.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
daniellizewski
761c17f1e0 drivers/usbhost/usbhost_enumerate.c: Allow selecting USB configuration
Added support for selecting a different USB configuration.
Certain USB devices offer different classes using different
configurations. This allows a board file to provide a callback
to select the proper configuration for a given USB device.

Signed-off-by: daniellizewski <daniellizewski@geotab.com>
2026-05-06 06:20:03 +08:00
Tiago Medicci Serrano
c63c061a52 boards/risc-v: Enable ethernet on ESP32-P4-Function-EV-Board
This commit simply enables the ethernet support for the ESP32-P4's
Function EV board.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2026-05-06 01:37:00 +08:00
raiden00pl
4b4ba522cb boards/stm32f4: migrate to new pinmap
migrate stm32f4 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-05 13:30:30 -04:00
raiden00pl
ebb53a7ae6 boards/stm32f1: migrate to new pinmap
migrate stm32f1 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-05 11:48:49 -04:00
raiden00pl
1df49fbb36 boards/stm32f2: migrate to new pinmap
migrate stm32f2 to new pinmap

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-05-05 11:47:42 -04:00
Alan Carvalho de Assis
fc89dfdc3c boards/weact-stm32h750: Don't disable compilation optimization
This board was failing because the CONFIG_DEBUG_NOOPT was enabled.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-05-05 15:01:35 +08:00
Matteo Golin
96041a7c58 boards/comments: Remove legacy comments
Removing legacy comments referring to calling setup functions from the
NSH library.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-04 12:16:11 -03:00
Matteo Golin
8e06efb047 boards/stm32f4discovery: Normalize mt6816 defconfig
Normalize board configuration for mt6816 config.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-04 12:16:11 -03:00
Matteo Golin
a8a492cb4f boards/arm: Remove app-specific initialization
Now that initialization is performed by BOARD_LATE_INITIALIZE,
app-specific initialization options are not needed.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-03 08:23:18 -03:00
Alan Carvalho de Assis
928d7682ce boards/stm32f4discovery: Add support to MT6816
This commit add support to use MagTek Magnetic Rotary Encoder MT6816
on STM32F4Discovery board.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-05-03 07:56:38 -03:00
Alan Carvalho de Assis
f8e78c1075 drivers/qe: Don't compile stm32_qencoder.c if STM32 QE is not enabled
NuttX uses Quadrature Encoder lower half driver to internal QE from
MCUs and also with Magnetic Rotary Encoder sensors. But when the
STM32 QE is not enabled, the board code will try to compile the
stm32_qencoder.c because Magnetic Rotary Encoders enables the
CONFIG_SENSORS_QENCODER. This patch fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-05-03 07:56:38 -03:00
Matteo Golin
51f77ee111 boards/config: Remove final mentions of NSH_ARCHINIT
Since `NSH_ARCHINIT` is now removed, this commit cleans the last few
references to this option in the defconfig files that were recently
modified and escaped removal in initialization simplification commit.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 15:25:45 -03:00
Alan Carvalho de Assis
c01aca09f0 boards/qemu-i486: Fix the removal of qemu_appinit.c
This PR makes the qemu-i486 boot again.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-05-03 01:22:00 +08:00
Matteo Golin
a5e8ea2b40 arch/ceva: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
66ae075ae8 boards/arm: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
d54f3a31cb boards/xtensa: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
1e8564c3e9 boards/x86: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
48307b3a48 boards/sparc: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
73e243584e boards/risc-v: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
945329efd0 boards/z16: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
445b66430d boards/x86_64: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
e30da0ba74 boards/tricore: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
7fded74212 boards/renesas: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
f077c0321d boards/avr: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
9eb9cccbab boards/mips: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
cbbc5c42f4 boards/hc: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
296ee45be0 boards/z80: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
d0ee99a8a9 boards/arm64: Replace board_app_initialize
Replaced board_app_initialize logic with board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
46182069c8 boards/or1k: Remove board_app_initialize
Logic provided by board_app_initialize is removed due to the removal of
BOARDIOC_INIT boardctl command. Logic inside board_late_initialize is to
be used and is identical.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Matteo Golin
5c42dbcaa4 boards/sim: Replace board_app_initialize
Logic provided by board_app_initialize is replaced by
board_late_initialize.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00