Commit graph

23867 commits

Author SHA1 Message Date
wangchengdong
e83012b540 arm/armv8-r: remove redundant and misleading pointer in arm_syscall()
replace **running_task with *running_task, and updated several other places
 accordingly

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:41:47 +08:00
Lars Kruse
b3dd8b2796 arch/arm/rp2040: merge conflicting definitions of hw_* functions
The functions `hw_write_masked` and `hw_xor_bits` (as defined in
pico-sdk) were defined in NuttX twice.
Additionally these definitions were in conflict (one lacked the
`volatile` modifier).

Now these functions and their dependencies are defined in a new header
file.
Its name is based on the filename of the original definition in
pico-sdk:

  src/rp2_common/hardware_base/include/hardware/address_mapped.h

This change should fix the potential issue of GPIO operations failing
due to compiler optimizations caused by the absence of `volatile`.

Signed-off-by: Lars Kruse <devel@sumpfralle.de>
2025-09-27 21:41:41 +08:00
wangchengdong
ba0a5df95d arch/tricore: fix tasking compiler linking error
Add "add_link_options(--no-default-libraries)" ToolchainTasking.cmake
  Add "LDFLAGS += --no-default-libraries" in ToolchainTasking.defs

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:41:33 +08:00
chao an
cf616fd619 arch/arm/armv8-m: stack pointer should be 8-byte aligned in signal context
Since the alignment of the signal context is affected by XCPTCONTEXT_SIZE in
different Kconfig,  sometimes the stack pointer is not aligned to 8 bytes, this
is not what the software and compiler expect, for example,  if va_list() obtains
wide data of type long long, the offset will be wrong, So in this commit, we set
stack-aligned the base offset so that the correct offset will be set during context
restoration.

1. test code:
|            void signal_handler(int signo, siginfo_t *info, void *context) {
|                long long ttt = 1024000;
|                printf("%lld\n", ttt);
|            }
|
|            struct itimerspec its = {   .it_value.tv_sec  = 1,
|                .it_value.tv_nsec = 0,
|                .it_interval.tv_sec  = 1,
|                .it_interval.tv_nsec = 0
|            };
|
|            int main(int argc, FAR char *argv[])
|            {
|                struct sigevent evp;
|                timer_t timer_id;
|
|                memset(&evp, 0, sizeof(evp));
|                evp.sigev_notify          = SIGEV_SIGNAL | SIGEV_THREAD_ID;
|                evp.sigev_signo           = SIGALRM;
|                evp.sigev_notify_thread_id = gettid();
|
|                timer_create(CLOCK_REALTIME, &evp, &timer_id);
|
|
|                struct sigaction sa;
|                memset(&sa, 0, sizeof(sa));
|                sa.sa_sigaction = signal_handler;
|                sa.sa_flags = SA_SIGINFO;
|                sigemptyset(&sa.sa_mask);
|
|                sigaction(SIGALRM, &sa, NULL);
|
|                timer_settime(timer_id, 0, &its, NULL);
|
|                while (1)
|                    sleep(1);
|
|                return 0;
|            }

2. before this change:

|            NuttShell (NSH) NuttX-12.10.0
|            nsh> hello
|            4398046527890440
|            4398046527890472
|            4398046527890504
|            4398046527890536

3. after this change:

|            NuttShell (NSH) NuttX-12.10.0
|            nsh> hello
|            1024000
|            1024000
|            1024000
|            1024000

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-09-27 21:41:20 +08:00
wangchengdong
754eab4687 arch/tricore: allow user defined compiler path
prefix compiler with ${TOOLCHAIN_PREFIX}

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:41:13 +08:00
wangchengdong
a039fc7097 arch: fix stack alignment bug for arm and tricore arch
The stack alignment operation in tricore and arm porting
   only aligns the size of the stack, forget to align the start addr
   of the stack, this patch fixes it.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:41:05 +08:00
wangchengdong
21e1596dff arch: fix alignment bug for archs that need stack alignment
These archs only align the size of the stack, forgeting to do the
 stack start addr alignment, this patch fixes it.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:40:58 +08:00
Jukka Laitinen
382ed6550f imx9/imx9_usbdev.c: Fix interrupt handling in SMP mode
The interrupt handler accesses the device as well as the driver's private
data. Use critical_section for mutual exclusion with drivers/usbdev, which
also protects the same data with critical_section.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-09-27 21:40:50 +08:00
MASZ
94ad260843 arch/arm/stm32h7: Fix and enhance WWDG (Window Watchdog) support
This patch addresses several issues and adds enhancements to the WWDG
(Window Watchdog) implementation for the STM32H7 platform. The changes
include:

- Extend the definitions of WWDG_CFR_PCLK1 macros to support dividers
  up to 128, and update the stm32_settimeout() function to consider this
  extended range.
- Fix the "elapsed" calculations in the stm32_getstatus() function to
  ensure correct time remaining calculations.
- Clear the EWIF (Early Wakeup Interrupt Flag) bit in the stm32_start()
  function, as this bit might be set by hardware before the watchdog is
  actually started.
- Initialize the WWDG clock in the RCC_APB3ENR register and set the
  RCC_GCR_WW1RSC bit as per the STM32 reference manual to ensure proper
  behavior when enabling the WWDG1.

Signed-off-by: Szymon Magrian <szymon.magrian@hexagon.com>
2025-09-27 21:40:35 +08:00
Huang Qi
3af0ab64bb arch/risc-v: espressif: temperature: Fix incorrect pointer casting
Fix bug in temperature sensor driver where direct casting of lower half
structure pointer could lead to incorrect memory access.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-09-27 21:40:28 +08:00
Huang Qi
47e4576b1c arch/xtensa: espressif: temperature: Fix incorrect pointer casting
Fix bug in temperature sensor driver where direct casting of lower half
structure pointer could lead to incorrect memory access.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-09-27 21:40:28 +08:00
wangchengdong
80f5a06c06 arch/tricore: Align Makefile with Cmake for tasking linker script preprocessing
Provide linker script preprocessing function porting for
    tasking compiler

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-09-27 21:40:12 +08:00
adriendesp
8fea354a0f arch/xmc4 : fix serial buffer size for unused channel
Give the user the full control over the USIC FIFO buffer even if USIC channel 0 is disabled.
When USICx_CHAN0 is not an UART but USICx_CHAN1 is, the user can set the desired FIFO buffer offsets in CHAN1 config.
2025-08-29 12:43:52 -03:00
Serg Podtynnyi
52d1877e2e boards/arm/rp23xx/common: update board reset via BOOTROM functions
Update board reset with BOOTROM functions calls
 - normal reboot
 - reboot to bootloader

normal reboot and reboot bootloader now possible from nsh

Port of https://github.com/apache/nuttx/pull/16848

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-08-28 11:04:08 -03:00
Filipe Cavalcanti
1f7c3a32e5 arch/risc-v: refactor Wi-Fi driver for ESP32-C3|C6
Fixes low and inconsistent bandwidth issues.
Adds new configuration options for buffer management.
Moves code around to make the implementation cleaner and easier to debug.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2025-08-28 21:52:03 +08:00
wangchengdong
a3e5ae9600 arch/tricore/src/common/tricore_irq.c: add up_affinity_irq
Add up_affinity_irq to tricore arch
2025-08-28 15:21:39 +08:00
v-tangmeng
fec6e248b9 fix ld unrecognized option '-g3'
ld: unrecognized option '-g3'
ld: use the --help option for usage information

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2025-08-28 15:21:05 +08:00
Michal Lenc
47cd5ba279 arch/arm/src/samv7/sam_emac.c: fix compile warning
The following warning occurred if ARCH_CHIP_PIC32CZCA70 option was
selected. The variable is not used in case of PIC32CZ CA70 series.

CC:  task/task_getgroup.c chip/sam_emac.c: In function ‘sam_emac_initialize’:
chip/sam_emac.c:4758:12: warning: unused variable ‘regval’ [-Wunused-variable]
 4758 |   uint32_t regval;
      |

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-08-26 14:02:13 +02:00
Jukka Laitinen
5c7c7f8ca3 arch/arm/src/stm32f7/stm32_ethernet.c: Fix "unused variable" warning
Fix build warning when CONFIG_STM32F7_AUTONEG is not set

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-08-26 14:01:47 +02:00
wangchengdong
28206007e0 board/tricore: rename tc397 chip board name
"tc397" is a chip name which is not appropriate to act as a board name.
 the board supported here is actually "a2g-tc397-5v-tft".
 The correct definition is : tricore is arch name, tc3xx is arch family
 name, tc397 is chip name and the borad name is a2g-tc397-5v-tft
2025-08-26 16:09:34 +08:00
Jukka Laitinen
3cf28dd0b2 arch/arm64/src/imx9/imx9_lpi2c.c: Fix bus reset
imx9_lpi2c_reset didn't quite work. It tried to toggle scl line as GPIO, but the line was not even muxed properly.

Instead, set the bus to relaxed mode, and drive address 0 to the bus. This toggles the clock, and also generates start and stop sequences on the bus.

"Relaxed mode" is a new feature on the LPI2C block used in imx93.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-08-26 09:39:33 +08:00
Michal Lenc
5d21aa823e arch/arm/src/samv7: support progmem for pic32czca70 series
There were missing ifdef conditions for pic32czca70 series.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-08-25 16:44:24 -03:00
Jukka Laitinen
4baad0aa22 arch/risc-v/src/mpfs/mpfs_clockconfig.c: Flag out code only used in bootloader
This removes the need to have all the DDR/clock configuration related
"LIBERODEFS" flags defined, when not building a standalone/coldboot
configuration

All of this code is unused when not building with CONFIG_MPFS_BOOTLOADER

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-08-25 23:37:55 +08:00
Thiago Finelon
e87c43b798 arch/xtensa/esp32s3: Add EXT1 wakeup support in power management
Introduce EXT1 wakeup functionality to the ESP32-S3 power management
subsystem. With this feature, the ESP32-S3 can wake up from PM_STANDBY
or PM_SLEEP when one or more RTC GPIOs trigger the EXT1 condition.

Changes include:
- Added EXT1 wakeup configuration and preparation logic in rtc code.
- Integrated EXT1 handling in pmstandby() and pmsleep().
- New board-level Kconfig options under ESP32-S3 DevKit menu:
  - CONFIG_PM_EXT1_WAKEUP: enable EXT1 wakeup support
  - CONFIG_PM_EXT1_WAKEUP_RTC_GPIO<n>: select RTC GPIOs as wake sources
  - CONFIG_PM_EXT1_WAKEUP_TRIGGER_MODE: choose wakeup on HIGH or LOW level
- Fixing Kconfig style
- Fixing comments standard
- Adding PM documentation for esp32s3-devkit

Impact:
- No build impact unless CONFIG_PM_EXT1_WAKEUP is enabled.
- When enabled, ESP32-S3 can wake from low-power states via RTC GPIOs.
- No new public API introduced; controlled via board Kconfig.

Tested on ESP32-S3 DevKit:
- Configured GPIO4 and GPIO5 as EXT1 wake sources.
- Verified wakeup from light sleep and deep sleep on external signals.
- Wakeup reason correctly reported as EXT1.

Signed-off-by: Thiago Finelon <thiago.sfinelon@gmail.com>
2025-08-24 11:32:10 -03:00
Jukka Laitinen
67d0b975a5 arch/arm64/gicv3: Improve initialization in warm reboot case
- In case of warm reboot, clear active and pending interrupts from GICv3
and also from the CPU interface.
- Fix default IGROUPMODR to the reset value (0)
- Move gic_wait_rwp calls to after modifying ICENABLER
- Improve some comments

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-24 11:31:37 -03:00
Jukka Laitinen
80cb2cf9c6 arch/xtensa/esp32,esp32s3: Start the "spiflash_op" thread with correct affinity
Set the affinity of the task before activating it. There is no parameter
or other interface in "kthread_create" to set the affinity mask,
like in "pthread_create".

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-22 15:46:47 -03:00
lipengfei28
d45dfb8a9e arch/arm64: porting config iomux use scmi form arm imx95
pinctrl use same format scmi and config regs

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-08-22 20:54:05 +08:00
lipengfei28
c90349348e arch/arm64: porting config clock use scmi form arm imx95
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-08-22 20:54:05 +08:00
lipengfei28
909d9f1351 arch/arm64: porting mu drv and scmi from arm imx9
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-08-22 20:54:05 +08:00
nuttxs
46bbde02b1 esp32/esp32_spiflash.c: during the SPI Flash erasure operation, task
scheduling (yield) is added to prevent the Watchdog Timer from
triggering a reset due to timeout

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-08-22 20:47:03 +08:00
“wangchengdong”
e2cdb7ef34 arch/tricore: add up_trigger_irq
Add up_trigger_irq in arch/tricore/src/common/tricore_irq.c
  Select ARCH_HAVE_IRQTRIGGER in config ARCH_TC3XX
2025-08-22 15:04:06 +08:00
Niccolò Maggioni
f43c943ebe arch/arm/rp2040: Silence "LOAD segment with RWX permissions" linker warnings
This arch uses code relocation to SRAM through a XIP unit, so forcing segment
permissions manually in the linker script could create unforeseen issues.
A quick fix is setting the "--no-warn-rwx-segments" linker option just for
for the incriminated stage2 bootloader binary.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-22 00:27:12 +08:00
nuttxs
0ff26f0850 esp32/esp32_partition.c: based on the latest revision, in the ESP32 compilation
environment, uint32_t is defined as long unsigned int (i.e., unsigned long)

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-08-22 00:26:46 +08:00
“wangchengdong”
057b483350 include/nuttx/compiler.h:
fix nooptimiziation_function definition problem for tricore gnu compiler
arch/tricore:
	move tricore_csa2addr and tricore_addr2csa definition from include/arch.h to include/irq.h to fix build error
2025-08-21 08:34:13 -03:00
v-tangmeng
7e258621df arch/arm: Add missing barriers.h
This commit adds the missing `barriers.h` for arm.

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2025-08-21 08:32:52 -03:00
“wangchengdong”
8f5c0d5da3 arch: Add Cmake build support for raspberrypi-4b board & bcm2711 chip
Add:
arch/arm64/src/bcm2711/CMakeLists.txt
boards/arm64/bcm2711/raspberrypi-4b/CMakeLists.txt
boards/arm64/bcm2711/raspberrypi-4b/src/CMakeLists.txt
2025-08-21 17:43:31 +08:00
Niccolò Maggioni
093f4d3688 arch/arm/rp2040: Update include paths for pico-sdk 2.2.0
Version 2.2.0 of the SDK unified some headers under a new path.
Now both the old and the new paths are searched during compilation.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-20 12:24:35 -03:00
simbit18
015e013447 arch/arm: Fix Kconfig style
Remove spaces from Kconfig
Add TABs
2025-08-19 19:44:31 -03:00
Tiago Medicci Serrano
d250808c1c esp32s3/elf: Fix ELF loader on ESP32-S3 when using external PSRAM
Prior to this commit, it wasn't possible to load ELF modules from
the external PSRAM. There were two main issues about it: 1) copying
data using the instruction bus was being used instead of the data
bus (this, per si, isn't a problem, but requires special attention
regarding data alignment), and 2) the cache was not being properly
cleaned and flushed to properly access the loaded data using the
instruction bus.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-08-20 02:23:03 +08:00
Tiago Medicci Serrano
60ca804b56 esp32s3: Fix bug related to the PSRAM-allocated task stack
If both SPI Flash support (`CONFIG_ESP32S3_SPIFLASH`) and PSRAM
(`CONFIG_ESP32S3_SPIRAM`) are enabled, the PSRAM can only be
assigned to the user's heap (`CONFIG_ESP32S3_SPIRAM_USER_HEAP`).
Additionaly, `CONFIG_ESP32S3_SPI_FLASH_SUPPORT_PSRAM_STACK` must be
set because the system will end up allocating tasks' stacks from
the external PSRAM. This has an impact when dealing with SPI flash
operations because the cache must be disabled and the running task
should not rely on any data from the PSRAM. To accomplish that, It
offloads the SPI flash operation to a work queue (which, by
definition, allocates its heap from the kernel heap).

The same (assigning the PSRAM to the user's heap) is valid when the
Wi-Fi is enabled because the lower-half driver requires data being
allocated from the internal memory (which can only be achieved by
allocating from the kernel heap when both the kernel and user heaps
exists).

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-08-20 02:23:03 +08:00
Stepan Pressl
637f15ff3c Make/Toolchain.defs: add the AR_EXTRACT command
Use this command to extract archives.
Not all architectures are modified, only those commands I know
or could be logically deducted from the rest were added.

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
2025-08-19 09:47:44 +08:00
Ville Juven
67b17cb4d7 mpfs/mpfs_usb.c: Fix interrupt handling in SMP mode
The interrupt handler accesses the device as well as the driver's private
data. Thus, must take the big kernel lock in SMP mode to protect them.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-18 20:27:20 +08:00
Ville Juven
72bba3b2ee mpfs_emmcsd/coremmc.c: Fix interrupt handling in SMP mode
In SMP mode one CPU can be executing the MMC interrupt while another CPU
disables (e.g. via watchdog timeout). As it is disabled the other CPU
assumes it's safe to start configuring the device after this.

This causes a leak in the driver's private data as well as a mutual
exclusion leak on the device itself.

Fix this by aborting any triggered interrupt by checking whether it's
even enabled.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-18 20:27:20 +08:00
Antoine Juckler
53d7fab355 arch/stm32f7: Fix I2C4 SDA pin assignment.
Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
2025-08-17 21:41:33 +08:00
Serg Podtynnyi
2437771de5 boards/risc-v/rp23xx-rv/common: update board reset via BOOTROM functions
Update board reset with BOOTROM functions calls
 - normal reboot
 - reboot to bootloader

normal reboot and reboot bootloader now possible from nsh

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-08-16 08:56:21 -03:00
Eero Nurkkala
581d667f72 risc-v/mpfs: usb: don't try nonexistent ep int flags
Currently the irq handler checks many reserved bits, which is
a waste of resources:

1. pending_rx_ep bit 0 is reserved (always 0)
2. pending_rx_ep and pending_tx_ep have only bits 1, 2, 3 and 4
   defined, no need to scan MPFS_USB_NENDPOINTS (9) bits as the
   rest are reserved

Fix this by checking only the relevant bits.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-16 08:41:59 -03:00
Eren Terzioglu
21787b49f0 arch/xtensa/esp32s2: Remove duplicated lines to fix warning
Remove duplicated lines to fix build warning for esp32s2

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
2025-08-16 08:41:18 -03:00
Jukka Laitinen
85f6f4bca2 arch/risc-v/src/mpfs/mpfs_userspace.c: Map MTIME into userspace reserved IO area in protected build
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2025-08-15 09:18:34 -03:00
Jari Nippula
93c1e0c633 arch/risc-v/src/mpfs/mpfs_emmcsd: ignore WRCOMPLETE
As emmcsd driver does not support separate WRCOMPLETE interrupt the
SDIOWAIT_WRCOMPLETE event shall not be waited.
The SDIOWAIT_TRANSFERDONE event indicates that both "transfer done"
and "write complete" events are completed.
2025-08-15 02:23:23 +08:00
Jari Nippula
31f691e9ed arch/risc-v/src/mpfs/mpfs_coremmc: MPFS_FPGA_FIC0_CLK defined as config value 2025-08-15 02:23:23 +08:00