From 08bffe1c0b1a005fc3f8fee555ef997cbe6ce76f Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Thu, 19 Mar 2026 16:02:54 +0100 Subject: [PATCH 01/26] drivers/mtd/w25.c: ensure the device is not in power down mode If power down mode is set, trying to read ID ends in an infinite loop because w25_waitwritecomplete never returns as status register never signalizes write complete. Therefore ensure the device is not in a power down mode before trying to read from it. This can be an issue if the board is trying to check for more NOR memories on one SPI bus and one chip select. For example GD25 driver returns the memory to power down state after read id is finished, therefore board initialization is stuck in an infinite loop if it first checks for GD25 and then fallbacks to W25. The commit fixes the possible issue by ensuring W25 is brought back to normal operation mode before trying to obtain the manufacturer ID. Signed-off-by: Michal Lenc --- drivers/mtd/w25.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/mtd/w25.c b/drivers/mtd/w25.c index 0a025183c7d90..831145baa7165 100644 --- a/drivers/mtd/w25.c +++ b/drivers/mtd/w25.c @@ -255,6 +255,7 @@ struct w25_dev_s /* Helpers */ +static inline void w25_purdid(FAR struct w25_dev_s *priv); static void w25_lock(FAR struct spi_dev_s *spi); static inline void w25_unlock(FAR struct spi_dev_s *spi); static inline int w25_readid(FAR struct w25_dev_s *priv); @@ -326,6 +327,18 @@ static ssize_t w25_write(FAR struct mtd_dev_s *dev, * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: w25_purdid + ****************************************************************************/ + +static inline void w25_purdid(FAR struct w25_dev_s *priv) +{ + SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true); + SPI_SEND(priv->spi, W25_PURDID); + SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false); + nxsched_usleep(20); +} + /**************************************************************************** * Name: w25_lock ****************************************************************************/ @@ -386,6 +399,10 @@ static inline int w25_readid(struct w25_dev_s *priv) w25_lock(priv->spi); + /* Make sure the device is not in power down mode */ + + w25_purdid(priv); + /* Wait for any preceding write or erase operation to complete. */ w25_waitwritecomplete(priv); From ed0338a1dff6db817af99b1e94646ea618136f3d Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:23:25 +0900 Subject: [PATCH 02/26] arch: cxd56xx: Fix DMA transfer for large memory size When using a dummy memory address in DMA LLI transfers, do not update the memory address. Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> --- arch/arm/src/cxd56xx/cxd56_dmac.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_dmac.c b/arch/arm/src/cxd56xx/cxd56_dmac.c index 22d931cd3b18f..54100990dcb02 100644 --- a/arch/arm/src/cxd56xx/cxd56_dmac.c +++ b/arch/arm/src/cxd56xx/cxd56_dmac.c @@ -941,7 +941,11 @@ void cxd56_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, CXD56_DMAC_BSIZE4, CXD56_DMAC_BSIZE4, /* Dest / Src burst size (fixed) */ CXD56_DMAC_MAX_SIZE); - dst += CXD56_DMAC_MAX_SIZE; + if (di) + { + dst += CXD56_DMAC_MAX_SIZE; + } + rest -= CXD56_DMAC_MAX_SIZE; } @@ -1012,7 +1016,11 @@ void cxd56_txdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, CXD56_DMAC_BSIZE1, CXD56_DMAC_BSIZE1, /* Dest / Src burst size (fixed) */ CXD56_DMAC_MAX_SIZE); - src += CXD56_DMAC_MAX_SIZE; + if (si) + { + src += CXD56_DMAC_MAX_SIZE; + } + rest -= CXD56_DMAC_MAX_SIZE; } From 62b463bcf756fcfb079f9cc9541687cd77d61698 Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Wed, 25 Mar 2026 21:36:44 +0900 Subject: [PATCH 03/26] arch: cxd56xx: Fix nxstyle Fix error: Case statement should be on a new line. Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> --- arch/arm/src/cxd56xx/cxd56_dmac.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_dmac.c b/arch/arm/src/cxd56xx/cxd56_dmac.c index 54100990dcb02..3d7b111782da3 100644 --- a/arch/arm/src/cxd56xx/cxd56_dmac.c +++ b/arch/arm/src/cxd56xx/cxd56_dmac.c @@ -313,13 +313,13 @@ static int ch2dmac(int ch) { switch (ch) { - case 0: case 1: + case 0 ... 1: return 1; - case 2: case 3: case 4: case 5: case 6: /* APP IDMAC */ + case 2 ... 6: /* APP IDMAC */ return 3; - case 7: case 8: /* APP SKDMAC */ + case 7 ... 8: /* APP SKDMAC */ return 2; - default: + default: return 0; } } @@ -330,9 +330,12 @@ static struct dmac_register_map *get_device(int ch) switch (id) { - case 1: return (struct dmac_register_map *)DMAC1_REG_BASE; - case 2: return (struct dmac_register_map *)DMAC2_REG_BASE; - case 3: return (struct dmac_register_map *)DMAC3_REG_BASE; + case 1: + return (struct dmac_register_map *)DMAC1_REG_BASE; + case 2: + return (struct dmac_register_map *)DMAC2_REG_BASE; + case 3: + return (struct dmac_register_map *)DMAC3_REG_BASE; } return NULL; @@ -366,13 +369,13 @@ static int get_pmid(int ch) { switch (ch) { - case 0: case 1: + case 0 ... 1: return PM_APP_ADMAC; - case 2: case 3: case 4: case 5: case 6: + case 2 ... 6: return PM_APP_IDMAC; - case 7: case 8: + case 7 ... 8: return PM_APP_SKDMAC; - default: + default: break; /* may not comes here */ } From 363f8fd125c3ed3a5043f694579271d49189dcac Mon Sep 17 00:00:00 2001 From: Shunchao Hu Date: Wed, 25 Mar 2026 14:34:35 +0800 Subject: [PATCH 04/26] drivers/net/telnet: Fix typo. This commit fixed code comment typo in telnet.c. Signed-off-by: Shunchao Hu --- drivers/net/telnet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index e492517f344dc..08c23e0dbbf26 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -209,9 +209,9 @@ static const struct file_operations g_factory_fops = factory_ioctl, /* ioctl */ }; -/* This is an global data set of all of all active Telnet drivers. This - * additional logic in included to handle killing of task via control - * characters received via Telenet (via Ctrl-C SIGINT, in particular). +/* This is a global data set of all active Telnet drivers. This + * additional logic is included to handle killing tasks via control + * characters received via Telnet (via Ctrl-C SIGINT, in particular). */ static struct telnet_dev_s *g_telnet_clients[CONFIG_TELNET_MAXLCLIENTS]; From d32ac6ea9d4bb79c177ec947bcf839f71d1106c1 Mon Sep 17 00:00:00 2001 From: chao an Date: Tue, 3 Mar 2026 18:24:42 +0800 Subject: [PATCH 05/26] serial/uart_rpmsg: Remove redundant CONFIG_RPMSG_UART_CONSOLE macro check Remove the unnecessary CONFIG_RPMSG_UART_CONSOLE preprocessor guard around the console registration logic in uart_rpmsg_init(). The uart_rpmsg_init() function already accepts a bool isconsole parameter to dynamically control console registration, which is designed to support flexible console setup in distributed multi-core SOC systems. Adding the macro check on top of this runtime parameter is redundant and negates the dynamic registration capability. This change fixes a regression introduced by PR #18410, which broke the functionality of sim/rpproxy and sim/rpserver due to the incorrect macro guard preventing proper console registration for the rpmsg UART device. Signed-off-by: chao an --- drivers/serial/uart_rpmsg.c | 2 -- drivers/serial/uart_rpmsg_raw.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/serial/uart_rpmsg.c b/drivers/serial/uart_rpmsg.c index 12205c232af1b..2fc7d273f3854 100644 --- a/drivers/serial/uart_rpmsg.c +++ b/drivers/serial/uart_rpmsg.c @@ -458,12 +458,10 @@ int uart_rpmsg_init(FAR const char *cpuname, FAR const char *devname, UART_RPMSG_DEV_PREFIX, devname); uart_register(name, dev); - #ifdef CONFIG_RPMSG_UART_CONSOLE if (dev->isconsole) { uart_register(UART_RPMSG_DEV_CONSOLE, dev); } - #endif return 0; } diff --git a/drivers/serial/uart_rpmsg_raw.c b/drivers/serial/uart_rpmsg_raw.c index a658b3f61d303..8e40b2b960064 100644 --- a/drivers/serial/uart_rpmsg_raw.c +++ b/drivers/serial/uart_rpmsg_raw.c @@ -369,12 +369,10 @@ int uart_rpmsg_raw_init(FAR const char *cpuname, FAR const char *devname, UART_RPMSG_DEV_PREFIX, devname); uart_register(name, dev); -#ifdef CONFIG_RPMSG_UART_RAW_CONSOLE if (dev->isconsole) { uart_register(UART_RPMSG_DEV_CONSOLE, dev); } -#endif return 0; } From c0d69399e10068e26270de25dc7b6d3a07ebfbf0 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Tue, 24 Mar 2026 11:06:02 +0100 Subject: [PATCH 06/26] sched/group_foreachchild.c: fix warning fix compilation warning: group/group_foreachchild.c:85:10: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized] 85 | return ret; | ^~~ group/group_foreachchild.c:67:7: note: 'ret' was declared here 67 | int ret; Signed-off-by: raiden00pl --- sched/group/group_foreachchild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sched/group/group_foreachchild.c b/sched/group/group_foreachchild.c index 8b830837833c6..a0cf1f25458a8 100644 --- a/sched/group/group_foreachchild.c +++ b/sched/group/group_foreachchild.c @@ -64,7 +64,7 @@ int group_foreachchild(FAR struct task_group_s *group, { FAR sq_entry_t *curr; FAR sq_entry_t *next; - int ret; + int ret = OK; DEBUGASSERT(group); From ba0f1806a21ce55c6277ebbb861d49978bd1eeda Mon Sep 17 00:00:00 2001 From: kywwilson11 Date: Tue, 24 Mar 2026 15:40:45 -0500 Subject: [PATCH 07/26] stm32h5/adc: fix TROVS bit and watchdog threshold register writes Fix adc_oversample() where priv->trovs (a bool, 0 or 1) was OR'd directly into setbits instead of using ADC_CFGR2_TROVS (bit 9). This caused triggered oversampling to never actually be enabled. Fix ANIOC_WDOG_UPPER and ANIOC_WDOG_LOWER ioctls where the TR1 register was overwritten with only the new threshold value, zeroing out the opposite threshold and the AWDFILT digital filter bits. Use read-modify-write to preserve the other fields. Signed-off-by: kywwilson11 --- arch/arm/src/stm32h5/stm32_adc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/stm32h5/stm32_adc.c b/arch/arm/src/stm32h5/stm32_adc.c index b44d778a4749e..d0b69e53beb7e 100644 --- a/arch/arm/src/stm32h5/stm32_adc.c +++ b/arch/arm/src/stm32h5/stm32_adc.c @@ -1069,7 +1069,10 @@ static void adc_oversample(struct adc_dev_s *dev) (priv->ovsr << ADC_CFGR2_OVSR_SHIFT) | (priv->ovss << ADC_CFGR2_OVSS_SHIFT); - setbits |= priv->trovs; + if (priv->trovs) + { + setbits |= ADC_CFGR2_TROVS; + } adc_modifyreg(priv, STM32_ADC_CFGR2_OFFSET, clrbits, setbits); } @@ -1811,7 +1814,8 @@ static int adc_ioctl(struct adc_dev_s *dev, int cmd, unsigned long arg) /* Set the watchdog threshold register */ - regval = ((arg << ADC_TR1_HT1_SHIFT) & ADC_TR1_HT1_MASK); + regval &= ~ADC_TR1_HT1_MASK; + regval |= ((arg << ADC_TR1_HT1_SHIFT) & ADC_TR1_HT1_MASK); adc_putreg(priv, STM32_ADC_TR1_OFFSET, regval); /* Ensure analog watchdog is enabled */ @@ -1845,7 +1849,8 @@ static int adc_ioctl(struct adc_dev_s *dev, int cmd, unsigned long arg) /* Set the watchdog threshold register */ - regval = ((arg << ADC_TR1_LT1_SHIFT) & ADC_TR1_LT1_MASK); + regval &= ~ADC_TR1_LT1_MASK; + regval |= ((arg << ADC_TR1_LT1_SHIFT) & ADC_TR1_LT1_MASK); adc_putreg(priv, STM32_ADC_TR1_OFFSET, regval); /* Ensure analog watchdog is enabled */ From ab0ad3cee517bbc8c92159cd56b96dbe3c13f5a6 Mon Sep 17 00:00:00 2001 From: Shunchao Hu Date: Tue, 24 Mar 2026 15:52:11 +0800 Subject: [PATCH 08/26] drivers/net/telnet: Ignore unsupported subnegotiation data. Ignore unsupported telnet subnegotiation payload until `IAC SE` so option bytes do not leak into the first NSH command. Keep existing NAWS handling intact and also treat `IAC IAC` inside subnegotiation payload as an escaped `0xFF` data byte rather than a subnegotiation terminator. This makes subnegotiation parsing RFC-compliant for both unsupported options and NAWS payload processing. Signed-off-by: Shunchao Hu --- drivers/net/telnet.c | 53 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 08c23e0dbbf26..6cd92ebf8b213 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -107,8 +107,8 @@ enum telnet_state_e STATE_DO, STATE_DONT, STATE_SB, - STATE_SB_NAWS, - STATE_SE + STATE_SB_DATA, + STATE_SB_NAWS }; /* This structure describes the internal state of the driver */ @@ -118,6 +118,7 @@ struct telnet_dev_s uint8_t td_state; /* (See telnet_state_e) */ uint8_t td_crefs; /* The number of open references to the session */ uint8_t td_minor; /* Minor device number */ + bool td_sb_iac; /* Saw IAC within sub-negotiation payload */ uint16_t td_offset; /* Offset to the valid, pending bytes in the rxbuffer */ uint16_t td_pending; /* Number of valid, pending bytes in the rxbuffer */ #ifdef CONFIG_TELNET_SUPPORT_NAWS @@ -372,16 +373,17 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv, priv->td_state = STATE_DONT; break; -#ifdef CONFIG_TELNET_SUPPORT_NAWS case TELNET_SB: priv->td_state = STATE_SB; + priv->td_sb_iac = false; +#ifdef CONFIG_TELNET_SUPPORT_NAWS priv->td_sb_count = 0; +#endif break; case TELNET_SE: priv->td_state = STATE_NORMAL; break; -#endif default: priv->td_state = STATE_NORMAL; @@ -458,25 +460,58 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv, } break; -#ifdef CONFIG_TELNET_SUPPORT_NAWS - /* Handle Telnet Sub negotiation request */ + /* Handle Telnet sub-negotiation requests. */ case STATE_SB: switch (ch) { +#ifdef CONFIG_TELNET_SUPPORT_NAWS case TELNET_NAWS: priv->td_state = STATE_SB_NAWS; break; +#endif default: - priv->td_state = STATE_NORMAL; + priv->td_state = STATE_SB_DATA; break; } break; + /* Ignore unsupported sub-negotiation payload until IAC SE. */ + + case STATE_SB_DATA: + if (priv->td_sb_iac) + { + priv->td_sb_iac = false; + if (ch == TELNET_SE) + { + priv->td_state = STATE_NORMAL; + } + } + else if (ch == TELNET_IAC) + { + priv->td_sb_iac = true; + } + break; + +#ifdef CONFIG_TELNET_SUPPORT_NAWS /* Handle NAWS sub-option negotiation */ case STATE_SB_NAWS: + if (priv->td_sb_iac) + { + priv->td_sb_iac = false; + if (ch == TELNET_SE) + { + priv->td_state = STATE_NORMAL; + break; + } + } + else if (ch == TELNET_IAC) + { + priv->td_sb_iac = true; + break; + } /* Update cols / rows based on received byte count */ @@ -500,11 +535,11 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv, break; } - /* Increment SB count and switch to NORMAL when complete */ + /* Increment SB count and keep discarding until IAC SE. */ if (++priv->td_sb_count == 4) { - priv->td_state = STATE_NORMAL; + priv->td_state = STATE_SB_DATA; } break; From dccd06e581bcb9d3ae10209d838dbe79a4934ef4 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Fri, 16 Jan 2026 17:57:19 +0100 Subject: [PATCH 09/26] boards/nucleo-c0{71rb|92rc}: fix USART 1 pins fix USART 1 pins for boards/nucleo-c0 boards Signed-off-by: raiden00pl --- boards/arm/stm32f0l0g0/nucleo-c071rb/include/board.h | 8 ++++---- boards/arm/stm32f0l0g0/nucleo-c092rc/include/board.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boards/arm/stm32f0l0g0/nucleo-c071rb/include/board.h b/boards/arm/stm32f0l0g0/nucleo-c071rb/include/board.h index 8a07bebea84f9..3821efe426e77 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c071rb/include/board.h +++ b/boards/arm/stm32f0l0g0/nucleo-c071rb/include/board.h @@ -139,12 +139,12 @@ /* USART */ /* USART1 at arduino D0/D1: - * USART1_RX - PB6 - * USART1_TX - PB7 + * USART1_RX - PB7 + * USART1_TX - PB6 */ -#define GPIO_USART1_RX (GPIO_USART2_RX_2|GPIO_SPEED_HIGH) /* PB6 */ -#define GPIO_USART1_TX (GPIO_USART2_TX_2|GPIO_SPEED_HIGH) /* PB7 */ +#define GPIO_USART1_RX (GPIO_USART1_RX_2|GPIO_SPEED_HIGH) /* PB7 */ +#define GPIO_USART1_TX (GPIO_USART1_TX_2|GPIO_SPEED_HIGH) /* PB6 */ /* USART1 RS485_DIR - PA8 (arduino D7) * (compatible with RS485 Waveshare shield) diff --git a/boards/arm/stm32f0l0g0/nucleo-c092rc/include/board.h b/boards/arm/stm32f0l0g0/nucleo-c092rc/include/board.h index 167d4fc74ac27..553377235cb26 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c092rc/include/board.h +++ b/boards/arm/stm32f0l0g0/nucleo-c092rc/include/board.h @@ -144,12 +144,12 @@ /* USART */ /* USART1 at arduino D0/D1: - * USART1_RX - PB6 - * USART1_TX - PB7 + * USART1_RX - PB7 + * USART1_TX - PB6 */ -#define GPIO_USART1_RX (GPIO_USART2_RX_2|GPIO_SPEED_HIGH) /* PB6 */ -#define GPIO_USART1_TX (GPIO_USART2_TX_2|GPIO_SPEED_HIGH) /* PB7 */ +#define GPIO_USART1_RX (GPIO_USART1_RX_2|GPIO_SPEED_HIGH) /* PB7 */ +#define GPIO_USART1_TX (GPIO_USART1_TX_2|GPIO_SPEED_HIGH) /* PB6 */ /* USART1 RS485_DIR - PA8 (arduino D7) * (compatible with RS485 Waveshare shield) From 2c788b35c74976bbdf83d9e2a27aec4a6851cace Mon Sep 17 00:00:00 2001 From: muyangren Date: Mon, 23 Mar 2026 15:14:06 +0800 Subject: [PATCH 10/26] docs: Fix typos, formatting, and numbering in README.md and CONTRIBUTING.md. Fix multiple documentation issues in README.md and CONTRIBUTING.md: * README.md: Merge multi-line badge markdown into single lines for License and Contributors badges to follow standard markdown format. * CONTRIBUTING.md: Remove extra space in Inviolable Principles link URL. * CONTRIBUTING.md: Fix duplicate numbering in section 1.17 Merge rules (two items numbered 3, renumbered to 3, 4, 5). * CONTRIBUTING.md: Fix typo in section 2.2 commit template example, "different thing" to "different things" (missing plural). Signed-off-by: aiduxiaoxiong --- CONTRIBUTING.md | 8 ++++---- README.md | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6739cc8ad723..03d67c7050831 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ Thank you for your interest in contributing to Apache NuttX RTOS :-) If you haven't yet read -[The Inviolable Principles of NuttX]( https://github.com/apache/nuttx/blob/master/INVIOLABLES.md) +[The Inviolable Principles of NuttX](https://github.com/apache/nuttx/blob/master/INVIOLABLES.md) please do so first. Apache NuttX RTOS supports over 15 different architectures, 360+ boards, @@ -355,8 +355,8 @@ See: https://github.com/apache/nuttx/blob/master/INVIOLABLES.md 2. Single company / organization commit, review, and merge is not allowed. 3. Merge of PRs with unresolved discussions and "change request" marks is not allowed. -3. Self committed code merge with or without review is not allowed. -4. Direct push to master is not allowed. +4. Self committed code merge with or without review is not allowed. +5. Direct push to master is not allowed. Breaking these rules will be punished. @@ -395,7 +395,7 @@ Add g_ prefix to can_dlc_to_len and len_to_can_dlc to follow NuttX coding style conventions for global symbols, improving code readability and maintainability. * you can also use bullet points. -* to note different thing briefly. +* to note different things briefly. Signed-off-by: AuthorName ``` diff --git a/README.md b/README.md index e56807dfe2251..3ec5eba255e7d 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,9 @@

![POSIX Badge](https://img.shields.io/badge/POSIX-Compliant-brightgreen?style=flat&label=POSIX) -[![License](https://img.shields.io/badge/License-Apache%202.0-blue -)](https://nuttx.apache.org/docs/latest/introduction/licensing.html) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](https://nuttx.apache.org/docs/latest/introduction/licensing.html) ![Issues Tracking Badge](https://img.shields.io/badge/issue_track-github-blue?style=flat&label=Issue%20Tracking) -[![Contributors](https://img.shields.io/github/contributors/apache/nuttx -)](https://github.com/apache/nuttx/graphs/contributors) +[![Contributors](https://img.shields.io/github/contributors/apache/nuttx)](https://github.com/apache/nuttx/graphs/contributors) [![GitHub Build Badge](https://github.com/apache/nuttx/workflows/Build/badge.svg)](https://github.com/apache/nuttx/actions/workflows/build.yml) [![Documentation Badge](https://github.com/apache/nuttx/workflows/Build%20Documentation/badge.svg)](https://nuttx.apache.org/docs/latest/index.html) From 930087e764bc266f0968d42375000b94609e6e35 Mon Sep 17 00:00:00 2001 From: Filipe Cavalcanti Date: Wed, 18 Mar 2026 11:27:45 -0300 Subject: [PATCH 11/26] boards/risc-v: increase init stack size on esp32h2-devkit:efuse Fix a crash scenarion due to stack overflow when debug assertions are enabled. Signed-off-by: Filipe Cavalcanti --- boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig b/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig index ddc6d5199ae28..3310cd804d071 100644 --- a/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig +++ b/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig @@ -24,6 +24,7 @@ CONFIG_ESPRESSIF_EFUSE=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_PERROR_STDOUT=y CONFIG_LIBC_STRERROR=y From 2176388e525e6d1400fa3d9277f75a1cac6fc476 Mon Sep 17 00:00:00 2001 From: Filipe Cavalcanti Date: Mon, 9 Mar 2026 21:05:55 -0300 Subject: [PATCH 12/26] boards/risc-v: increase init stacksize for efuse defconfig on ESP32-C6 Fixes a crash when executing basic commands on the efuse defconfig. Signed-off-by: Filipe Cavalcanti --- boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig b/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig index 9c387edc9bffa..c8a34cde8692e 100644 --- a/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig +++ b/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig @@ -25,6 +25,7 @@ CONFIG_ESPRESSIF_EFUSE=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=4096 CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_PERROR_STDOUT=y CONFIG_LIBC_STRERROR=y From 089b6e20d304f7cb272a147382242b48eae3a659 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Fri, 20 Mar 2026 12:33:14 +0800 Subject: [PATCH 13/26] boards/xtensa/esp32s3: fix WiFi init by using CONFIG_ESPRESSIF_WIFI The WiFi driver refactor (662c1e0bbb7) renamed the Kconfig symbol from CONFIG_ESPRESSIF_WLAN to CONFIG_ESPRESSIF_WIFI, but several ESP32-S3 board bringup files were not updated. This caused board_wlan_init() to be compiled out, so the wlan0 interface never appeared. Update the preprocessor guards in all affected boards: - esp32s3-box - esp32s3-eye - esp32s3-korvo-2 - esp32s3-lcd-ev - lckfb-szpi-esp32s3 Signed-off-by: wangjianyu3 --- boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_bringup.c | 4 ++-- boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c | 4 ++-- boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c | 4 ++-- boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_bringup.c | 4 ++-- .../xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_bringup.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_bringup.c index 812ed1a5e3f4c..3a69d4614aa0a 100644 --- a/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_bringup.c @@ -42,7 +42,7 @@ # include "esp32s3_board_tim.h" #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI # include "esp32s3_board_wlan.h" #endif @@ -211,7 +211,7 @@ int esp32s3_bringup(void) } #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI ret = board_wlan_init(); if (ret < 0) { diff --git a/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c index 8c314a47ad096..40119eac62e90 100644 --- a/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c @@ -42,7 +42,7 @@ # include "esp32s3_board_tim.h" #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI # include "esp32s3_board_wlan.h" #endif @@ -202,7 +202,7 @@ int esp32s3_bringup(void) } #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI ret = board_wlan_init(); if (ret < 0) { diff --git a/boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c index 775d9ba449660..b080752c9aaed 100644 --- a/boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-korvo-2/src/esp32s3_bringup.c @@ -45,7 +45,7 @@ # include "esp32s3_board_tim.h" #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI # include "esp32s3_board_wlan.h" #endif @@ -412,7 +412,7 @@ int esp32s3_bringup(void) } #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI ret = board_wlan_init(); if (ret < 0) { diff --git a/boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_bringup.c index b0fe87d41b4f0..3de427b45c91b 100644 --- a/boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-lcd-ev/src/esp32s3_bringup.c @@ -45,7 +45,7 @@ # include "esp32s3_board_tim.h" #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI # include "esp32s3_board_wlan.h" #endif @@ -304,7 +304,7 @@ int esp32s3_bringup(void) } #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI ret = board_wlan_init(); if (ret < 0) { diff --git a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_bringup.c index 9d7c84e35b051..4028d883b681c 100644 --- a/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_bringup.c @@ -45,7 +45,7 @@ # include "esp32s3_board_tim.h" #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI # include "esp32s3_board_wlan.h" #endif @@ -402,7 +402,7 @@ int esp32s3_bringup(void) } #endif -#ifdef CONFIG_ESPRESSIF_WLAN +#ifdef CONFIG_ESPRESSIF_WIFI ret = board_wlan_init(); if (ret < 0) { From 8f3846584be924d265a3c9489368c8f6c1529e98 Mon Sep 17 00:00:00 2001 From: shichunma Date: Sat, 21 Mar 2026 15:42:16 +0800 Subject: [PATCH 14/26] net/nat: g_nat_lock can be used recursively case: when rndis receive a packet and this packet is going to be forwarded. 1. first lock happen when ipv4_dev_forward call ipv4_nat_outbound; 2. next lock is: ipv4_nat_outbound_entry_find --> nat_port_select --> tcp_selectport --> nat_port_inuse Signed-off-by: Jerry Ma --- net/nat/nat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/nat/nat.c b/net/nat/nat.c index 4ccc2d9700bd1..426a04cd848df 100644 --- a/net/nat/nat.c +++ b/net/nat/nat.c @@ -42,7 +42,7 @@ * Private Data ****************************************************************************/ -static mutex_t g_nat_lock = NXMUTEX_INITIALIZER; +static rmutex_t g_nat_lock = NXRMUTEX_INITIALIZER; /**************************************************************************** * Private Functions @@ -418,7 +418,7 @@ uint32_t nat_expire_time(uint8_t protocol) void nat_lock(void) { - nxmutex_lock(&g_nat_lock); + nxrmutex_lock(&g_nat_lock); } /**************************************************************************** @@ -431,7 +431,7 @@ void nat_lock(void) void nat_unlock(void) { - nxmutex_unlock(&g_nat_lock); + nxrmutex_unlock(&g_nat_lock); } #endif /* CONFIG_NET_NAT */ From 6e061f0809b0ee40030175e9d8278522d8843640 Mon Sep 17 00:00:00 2001 From: shichunma Date: Mon, 23 Mar 2026 21:36:09 +0800 Subject: [PATCH 15/26] net/nat: fix missed nat_unlock If call nat_enable twice, there will be a miss "nat_unlock". Signed-off-by: Jerry Ma --- net/nat/nat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/nat/nat.c b/net/nat/nat.c index 426a04cd848df..d8cf542b6677e 100644 --- a/net/nat/nat.c +++ b/net/nat/nat.c @@ -118,6 +118,7 @@ int nat_enable(FAR struct net_driver_s *dev) if (IFF_IS_NAT(dev->d_flags)) { nwarn("WARNING: NAT was already enabled for %s!\n", dev->d_ifname); + nat_unlock(); return -EEXIST; } From 3ef755a1093fe5123263ba450c41e32ac5e7c945 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 21 Mar 2026 20:36:27 +0800 Subject: [PATCH 16/26] libs/libbuiltin: Fix spacing style in gcov.c Add space after 'else if' keyword to follow NuttX coding style guidelines. Signed-off-by: Huang Qi --- libs/libbuiltin/libgcc/gcov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libbuiltin/libgcc/gcov.c b/libs/libbuiltin/libgcc/gcov.c index 02d41d71325e5..c73aa620b2301 100644 --- a/libs/libbuiltin/libgcc/gcov.c +++ b/libs/libbuiltin/libgcc/gcov.c @@ -514,7 +514,7 @@ void __gcov_dump(void) _NX_CLOSE(fd); } - else if(S_ISDIR(state.st_mode)) + else if (S_ISDIR(state.st_mode)) { args.mkdir = gcov_mkdir; args.strip = atoi(getenv("GCOV_PREFIX_STRIP")); From 9f794ace0e06a57b187fdbef2ddd283435a8d805 Mon Sep 17 00:00:00 2001 From: nuttxs Date: Tue, 10 Mar 2026 10:58:58 +0800 Subject: [PATCH 17/26] boards/esp32s3: Fix MAC address byte order in LAN9250 driver Fix MAC address byte order by reversing 6 bytes after reading from eFuse. Adjust offset logic to apply after byte reversal, ensuring Ethernet MAC is base_mac +3. Comply with Espressif's MAC address generation specification for ESP32S3 Signed-off-by: nuttxs --- boards/xtensa/esp32s3/common/src/esp32s3_lan9250.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boards/xtensa/esp32s3/common/src/esp32s3_lan9250.c b/boards/xtensa/esp32s3/common/src/esp32s3_lan9250.c index 3accb752fce1a..5eeae968f45bb 100644 --- a/boards/xtensa/esp32s3/common/src/esp32s3_lan9250.c +++ b/boards/xtensa/esp32s3/common/src/esp32s3_lan9250.c @@ -188,8 +188,8 @@ static int lan9250_getmac(const struct lan9250_lower_s *lower, uint8_t *mac) { int fd; int ret; -#ifndef CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR int i; +#ifndef CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR uint8_t tmp; #endif @@ -227,6 +227,11 @@ static int lan9250_getmac(const struct lan9250_lower_s *lower, uint8_t *mac) close(fd); + for (i = 0; i < 6; i++) + { + mac[i] = mac[5 - i]; + } + #ifdef CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR mac[5] += 3; #else From 1cf0551cf0f8a41dbeac40172f0ea167a604d90b Mon Sep 17 00:00:00 2001 From: Saurav Pal Date: Sun, 8 Mar 2026 13:14:20 +0530 Subject: [PATCH 18/26] boards/arm64/bcm2711/raspberrypi-4b: Fix GPIO * Fix GPIO unspecified behavior on some GPIO ports. * Fix GPIO undefined behavior caused by uncleared set or reset bits. Signed-off-by: Saurav Pal --- arch/arm64/include/bcm2711/chip.h | 2 ++ arch/arm64/src/bcm2711/bcm2711_gpio.c | 19 ++++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/bcm2711/chip.h b/arch/arm64/include/bcm2711/chip.h index 6b2eafe486d19..5aa9117bf6073 100644 --- a/arch/arm64/include/bcm2711/chip.h +++ b/arch/arm64/include/bcm2711/chip.h @@ -75,6 +75,8 @@ #if defined(CONFIG_RPI4B_RAM_4GB) || defined(CONFIG_RPI4B_RAM_8GB) #define CONFIG_RAMBANK1_SIZE GB(4) - MB(64) +#elif defined(CONFIG_RPI4B_RAM_2GB) +#define CONFIG_RAMBANK1_SIZE GB(2) - MB(64) #endif /* defined(CONFIG_RPI4B_RAM_4GB) || defined(CONFIG_RPI4B_RAM_8GB) */ /* The 8GB version begins to use a second RAM bank. diff --git a/arch/arm64/src/bcm2711/bcm2711_gpio.c b/arch/arm64/src/bcm2711/bcm2711_gpio.c index a53a03b902e27..94a4a95f1805f 100644 --- a/arch/arm64/src/bcm2711/bcm2711_gpio.c +++ b/arch/arm64/src/bcm2711/bcm2711_gpio.c @@ -380,22 +380,22 @@ void bcm2711_gpio_set_func(uint32_t gpio, enum bcm2711_gpio_func_e func) value = (g_fsel_map[func] << ((gpio - 10) * 3)); modreg32(value, value, BCM_GPIO_GPFSEL1); } - else if (gpio <= 29 && gpio > 20) + else if (gpio <= 29 && gpio > 19) { value = (g_fsel_map[func] << ((gpio - 20) * 3)); modreg32(value, value, BCM_GPIO_GPFSEL2); } - else if (gpio <= 39 && gpio > 30) + else if (gpio <= 39 && gpio > 29) { value = (g_fsel_map[func] << ((gpio - 30) * 3)); modreg32(value, value, BCM_GPIO_GPFSEL3); } - else if (gpio <= 49 && gpio > 40) + else if (gpio <= 49 && gpio > 39) { value = (g_fsel_map[func] << ((gpio - 40) * 3)); modreg32(value, value, BCM_GPIO_GPFSEL4); } - else if (gpio <= 57 && gpio > 50) + else if (gpio <= 57 && gpio > 49) { value = (g_fsel_map[func] << ((gpio - 50) * 3)); modreg32(value, value, BCM_GPIO_GPFSEL5); @@ -418,15 +418,8 @@ void bcm2711_gpio_set_func(uint32_t gpio, enum bcm2711_gpio_func_e func) void bcm2711_gpio_pin_set(uint32_t gpio, bool set) { DEBUGASSERT(gpio < BCM_GPIO_NUM); - - if (set) - { - bcm2711_gpio_help_set(gpio, BCM_GPIO_GPSET0, BCM_GPIO_GPSET0, true); - } - else - { - bcm2711_gpio_help_set(gpio, BCM_GPIO_GPCLR0, BCM_GPIO_GPCLR0, true); - } + bcm2711_gpio_help_set(gpio, BCM_GPIO_GPSET0, BCM_GPIO_GPSET1, set); + bcm2711_gpio_help_set(gpio, BCM_GPIO_GPCLR0, BCM_GPIO_GPCLR1, !set); } /**************************************************************************** From e5f654f4ca558af483baabd1f710afd489b1e69d Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Wed, 4 Mar 2026 17:08:25 +0100 Subject: [PATCH 19/26] arch/arm/src/samX/sam_gpioirq.c: fix pin base address calculation GPIO PIN base address calculation had double right shift, thus call to SAM_PION_BASE was always with port = 0 instead of correct port number. As a result, function sam_gpioirq didn't correctly configure additional interrupt modes (only rising or falling edge and level interrupts). The issue occured on SAMv7 and SAM34 platforms (likely copy-pasted from one to another). Signed-off-by: Michal Lenc --- arch/arm/src/sam34/sam_gpioirq.c | 2 +- arch/arm/src/samv7/sam_gpioirq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/sam34/sam_gpioirq.c b/arch/arm/src/sam34/sam_gpioirq.c index b5e303af093df..42ee4c2c85e03 100644 --- a/arch/arm/src/sam34/sam_gpioirq.c +++ b/arch/arm/src/sam34/sam_gpioirq.c @@ -82,7 +82,7 @@ static inline uint32_t sam_gpiobase(gpio_pinset_t pinset) { int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; - return SAM_PION_BASE(port >> GPIO_PORT_SHIFT); + return SAM_PION_BASE(port); } /**************************************************************************** diff --git a/arch/arm/src/samv7/sam_gpioirq.c b/arch/arm/src/samv7/sam_gpioirq.c index efbda6ab6bf9b..1cfd11ed6305a 100644 --- a/arch/arm/src/samv7/sam_gpioirq.c +++ b/arch/arm/src/samv7/sam_gpioirq.c @@ -71,7 +71,7 @@ static inline uint32_t sam_gpiobase(gpio_pinset_t pinset) { int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; - return SAM_PION_BASE(port >> GPIO_PORT_SHIFT); + return SAM_PION_BASE(port); } /**************************************************************************** From 88ef77ba862e6ee8573c2459f493ce0612e623a9 Mon Sep 17 00:00:00 2001 From: Jari Nippula Date: Mon, 2 Mar 2026 15:57:18 +0200 Subject: [PATCH 20/26] arch/arm64: handle fatal user exception Print user exception reason class and description Print register dump Signed-off-by: Jari Nippula --- arch/arm64/src/common/arm64_fatal.c | 191 ++++++++++++++++++++++------ 1 file changed, 149 insertions(+), 42 deletions(-) diff --git a/arch/arm64/src/common/arm64_fatal.c b/arch/arm64/src/common/arm64_fatal.c index e9c23e2dee619..5f39e23ed4462 100644 --- a/arch/arm64/src/common/arm64_fatal.c +++ b/arch/arm64/src/common/arm64_fatal.c @@ -477,6 +477,112 @@ static int arm64_el1_exception_handler(uint64_t esr, return ret; } +static void arm64_get_exception_info(uint64_t el, uint64_t *esr, + uint64_t *far, uint64_t *elr, + const char **el_str) +{ + switch (el) + { + case MODE_EL1: + { + if (el_str != NULL) + { + *el_str = "MODE_EL1"; + } + + if (esr != NULL) + { + *esr = read_sysreg(esr_el1); + } + + if (far != NULL) + { + *far = read_sysreg(far_el1); + } + + if (elr != NULL) + { + *elr = read_sysreg(elr_el1); + } + break; + } + + case MODE_EL2: + { + if (el_str != NULL) + { + *el_str = "MODE_EL2"; + } + + if (esr != NULL) + { + *esr = read_sysreg(esr_el2); + } + + if (far != NULL) + { + *far = read_sysreg(far_el2); + } + + if (elr != NULL) + { + *elr = read_sysreg(elr_el2); + } + break; + } + +#ifdef CONFIG_ARCH_HAVE_EL3 + case MODE_EL3: + { + if (el_str != NULL) + { + *el_str = "MODE_EL3"; + } + + if (esr != NULL) + { + *esr = read_sysreg(esr_el3); + } + + if (far != NULL) + { + *far = read_sysreg(far_el3); + } + + if (elr != NULL) + { + *elr = read_sysreg(elr_el3); + } + break; + } +#endif + + default: + { + if (el_str != NULL) + { + *el_str = "Unknown"; + } + + if (esr != NULL) + { + *esr = 0; + } + + if (far != NULL) + { + *far = 0; + } + + if (elr != NULL) + { + *elr = 0; + } + break; + } + } +} + static int arm64_exception_handler(uint64_t *regs) { uint64_t el; @@ -487,50 +593,13 @@ static int arm64_exception_handler(uint64_t *regs) int ret = -EINVAL; el = arm64_current_el(); + arm64_get_exception_info(el, &esr, &far, &elr, &el_str); - switch (el) - { - case MODE_EL1: - { - el_str = "MODE_EL1"; - esr = read_sysreg(esr_el1); - far = read_sysreg(far_el1); - elr = read_sysreg(elr_el1); - ret = arm64_el1_exception_handler(esr, regs); - break; - } - - case MODE_EL2: + if (el == MODE_EL1) { - el_str = "MODE_EL2"; - esr = read_sysreg(esr_el2); - far = read_sysreg(far_el2); - elr = read_sysreg(elr_el2); - break; + ret = arm64_el1_exception_handler(esr, regs); } -#ifdef CONFIG_ARCH_HAVE_EL3 - case MODE_EL3: - { - el_str = "MODE_EL3"; - esr = read_sysreg(esr_el3); - far = read_sysreg(far_el3); - elr = read_sysreg(elr_el3); - break; - } - -#endif - default: - { - el_str = "Unknown"; - - /* Just to keep the compiler happy */ - - esr = elr = far = 0; - break; - } - } - if (ret != 0) { serr("CurrentEL: %s\n", el_str); @@ -567,9 +636,47 @@ uint64_t *arm64_fatal_handler(uint64_t *regs) if (ret != 0) { - /* The fatal is not handled, print error and hung */ + if (((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) && + ((tcb->flags & TCB_FLAG_SYSCALL) == 0) && + ((regs[REG_SPSR] & SPSR_MODE_MASK) == SPSR_MODE_EL0T)) + { + uint64_t esr; + const char *reason; + const char *desc; + + arm64_get_exception_info(arm64_current_el(), &esr, NULL, + NULL, NULL); + + reason = esr_get_class_string(esr); + if (reason == NULL) + { + reason = "Unknown/Uncategorized"; + } + + desc = esr_get_desc_string(esr); + if (desc == NULL) + { + desc = ""; + } + + _alert("PANIC: Unhandled user exception in PID %d: %s\n", + tcb->pid, get_task_name(tcb)); + _alert("Reason: %s - %s\n", reason, desc); + up_dump_register(regs); + + tcb->flags |= TCB_FLAG_FORCED_CANCEL; + + regs[REG_ELR] = (uint64_t) _exit; + regs[REG_X0] = SIGSEGV; + regs[REG_SPSR] &= ~SPSR_MODE_MASK; + regs[REG_SPSR] |= SPSR_MODE_EL1H; + } + else + { + /* The fatal is not handled, print error and hung */ - PANIC_WITH_REGS("panic", regs); + PANIC_WITH_REGS("panic", regs); + } } /* Clear irq flag */ From a8af4ecaac1a7c2af6b8726fa089bceee5e47d16 Mon Sep 17 00:00:00 2001 From: shichunma Date: Tue, 3 Mar 2026 21:25:12 +0800 Subject: [PATCH 21/26] netdev/netdev_ioctl: log in hex mode for ioctl cmd It's a more friendly when output cmd in hex mode, since it's defined like: 0x7xx Signed-off-by: Jerry Ma --- net/netdev/netdev_ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 3b7ccb27731b0..66d4b7ecc067d 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -579,7 +579,7 @@ static int netdev_cell_ioctl(FAR struct socket *psock, int cmd, FAR struct net_driver_s *dev = NULL; int ret = -ENOTTY; - ninfo("cmd: %d\n", cmd); + ninfo("cmd: 0x%04x\n", cmd); if (_CELLIOCVALID(cmd)) { @@ -827,7 +827,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, unsigned int idx = 0; int ret = OK; - ninfo("cmd: %d\n", cmd); + ninfo("cmd: 0x%04x\n", cmd); /* Execute commands that do not need ifr_name or lifr_name */ @@ -1378,7 +1378,7 @@ static int netdev_imsf_ioctl(FAR struct socket *psock, int cmd, FAR struct net_driver_s *dev; int ret = -EINVAL; - ninfo("cmd: %d\n", cmd); + ninfo("cmd: 0x%04x\n", cmd); /* Execute the command */ From bd690712c5111ed60f3ce391752e256788b3260c Mon Sep 17 00:00:00 2001 From: chao an Date: Tue, 3 Mar 2026 17:47:40 +0800 Subject: [PATCH 22/26] sched/tickless: Fix CLOCK_MONOTONIC always 0 by updating sched ticks Fix the issue where clock_gettime(CLOCK_MONOTONIC) always returns 0 in tickless mode, caused by the scheduler tick counter (g_system_ticks) not being updated with the actual timer ticks. 1. Add clock_update_sched_ticks() function to sched/clock/clock_sched_ticks.c: a. This function directly sets the system tick counter to a specific value (vs incrementing in clock_increase_sched_ticks), with full documentation matching the existing code style. b. Uses seqlock to ensure thread-safe access to g_system_ticks. 2. Call clock_update_sched_ticks() in nxsched_process_timer() (sched_processtickless.c): a. Syncs the scheduler tick counter with the actual timer ticks retrieved via up_timer_gettick(). With this fix, g_system_ticks is properly updated in tickless mode, and clock_gettime(CLOCK_MONOTONIC) returns the correct non-zero monotonic time. Signed-off-by: chao an --- sched/clock/clock.h | 73 +++++++++++++++++++++++++++++ sched/clock/clock_sched_ticks.c | 28 +++++++++++ sched/sched/sched_processtickless.c | 10 +++- 3 files changed, 110 insertions(+), 1 deletion(-) diff --git a/sched/clock/clock.h b/sched/clock/clock.h index a59ce4a8627df..71b80297b094f 100644 --- a/sched/clock/clock.h +++ b/sched/clock/clock.h @@ -70,15 +70,88 @@ extern spinlock_t g_basetime_lock; * Public Function Prototypes ****************************************************************************/ +/**************************************************************************** + * Name: clock_basetime + * + * Description: + * Get the initial time value from the best source available. + * + ****************************************************************************/ + int clock_basetime(FAR struct timespec *tp); +/**************************************************************************** + * Name: clock_initialize + * + * Description: + * Perform one-time initialization of the timing facilities. + * + ****************************************************************************/ + void clock_initialize(void); +/**************************************************************************** + * Name: clock_update_sched_ticks + * + * Description: + * Update the scheduler tick counter to a specific value. This function + * directly sets the system tick counter to the given value (rather than + * incrementing it), typically used for synchronizing or resetting the + * scheduler tick count to a known state. + * + * Input Parameters: + * ticks - The new value to set for the scheduler tick counter + * + * Returned Value: + * None + * + ****************************************************************************/ + +void clock_update_sched_ticks(clock_t ticks); + +/**************************************************************************** + * Name: clock_increase_sched_ticks + * + * Description: + * Increment the scheduler tick counter. This function should be called + * each time the real-time clock interrupt occurs, indicating the passage + * of one or more scheduling ticks. + * + * Input Parameters: + * ticks - The number of ticks to increment (typically 1) + * + * Returned Value: + * None + * + ****************************************************************************/ + void clock_increase_sched_ticks(clock_t ticks); +/**************************************************************************** + * Name: clock_get_sched_ticks + * + * Description: + * Return the current value of the scheduler tick counter. This counter + * only increases while the scheduler is running, and is independent of + * the real-time clock. + * + * Returned Value: + * The current number of scheduler ticks. + * + ****************************************************************************/ + clock_t clock_get_sched_ticks(void); #ifdef CONFIG_SCHED_CPULOAD_SYSCLK + +/**************************************************************************** + * Name: cpuload_init + * + * Description: + * Initialize the CPU load measurement logic. + * + ****************************************************************************/ + void cpuload_init(void); #endif diff --git a/sched/clock/clock_sched_ticks.c b/sched/clock/clock_sched_ticks.c index 353e4f3e0b1d4..282a51450f7c4 100644 --- a/sched/clock/clock_sched_ticks.c +++ b/sched/clock/clock_sched_ticks.c @@ -46,6 +46,34 @@ static seqcount_t g_system_tick_lock = SEQLOCK_INITIALIZER; * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: clock_update_sched_ticks + * + * Description: + * Update the scheduler tick counter to a specific value. This function + * directly sets the system tick counter to the given value (rather than + * incrementing it), typically used for synchronizing or resetting the + * scheduler tick count to a known state. + * + * Input Parameters: + * ticks - The new value to set for the scheduler tick counter + * + * Returned Value: + * None + * + ****************************************************************************/ + +void clock_update_sched_ticks(clock_t ticks) +{ + irqstate_t flags; + + /* Increment the per-tick scheduler counter */ + + flags = write_seqlock_irqsave(&g_system_tick_lock); + g_system_ticks = ticks; + write_sequnlock_irqrestore(&g_system_tick_lock, flags); +} + /**************************************************************************** * Name: clock_increase_sched_ticks * diff --git a/sched/sched/sched_processtickless.c b/sched/sched/sched_processtickless.c index 352d9f105bab2..8eea08ad9bdce 100644 --- a/sched/sched/sched_processtickless.c +++ b/sched/sched/sched_processtickless.c @@ -375,13 +375,17 @@ void nxsched_process_timer(void) { #ifdef CONFIG_HRTIMER uint64_t nsec = clock_systime_nsec(); + clock_t ticks = NSEC2TICK(nsec); + + clock_update_sched_ticks(ticks); + hrtimer_process(nsec); # if CONFIG_RR_INTERVAL > 0 /* Workaround for SCHED_RR, see the note. */ irqstate_t flags = enter_critical_section(); - nxsched_process_event(div_const(nsec, (uint32_t)NSEC_PER_TICK), true); + nxsched_process_event(ticks, true); leave_critical_section(flags); # endif @@ -397,6 +401,10 @@ void nxsched_process_timer(void) up_timer_gettick(&ticks); + /* Update sched ticks */ + + clock_update_sched_ticks(ticks); + #if CONFIG_RR_INTERVAL > 0 /* Workaround for SCHED_RR, see the note. */ From 57f73616db5a7e0da05afc37139064a8dc7e9de2 Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Sun, 22 Mar 2026 22:55:01 +0100 Subject: [PATCH 23/26] nucleo-l476rg: register userleds device driver if CONFIG_USERLED is set This enhances the bringup file with /dev/userleds registration if CONFIG_USERLED option is set. Signed-off-by: Michal Lenc --- .../arm/stm32l4/nucleo-l476rg/src/stm32_bringup.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_bringup.c b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_bringup.c index 0f565664c16af..01fd1b277c483 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_bringup.c +++ b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_bringup.c @@ -57,6 +57,10 @@ #include "stm32_bmp280.h" #endif +#ifdef CONFIG_USERLED +# include +#endif + #ifdef CONFIG_SENSORS_MPU9250 #include "stm32_mpu9250.h" #endif @@ -247,6 +251,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_USERLED + /* Register the LED driver */ + + ret = userled_lower_initialize("/dev/userleds"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + #ifdef CONFIG_PWM /* Initialize PWM and register the PWM device. */ From b6d47165f329aa69d7dfaca97ddcc5a658729ca4 Mon Sep 17 00:00:00 2001 From: chao an Date: Tue, 3 Mar 2026 17:04:30 +0800 Subject: [PATCH 24/26] sched/critmon: Fix CPU load stats incorrect when using SCHED_CPULOAD_CRITMONITOR Fix the abnormal CPU usage statistics issue caused by missing update of run_start timestamp in the target task (to) TCB when the CPU load counting mode is SCHED_CPULOAD_CRITMONITOR. Before this fix, the to->run_start was not set when switching context, leading to incorrect CPU usage calculation (e.g., Idle_Task showed 52.9% CPU usage instead of 100%, and running tasks had wrong non-zero values). After fixing, the CPU statistics return to normal: Idle_Task correctly shows 100% usage, and non-running tasks show 0% as expected. Enable: +CONFIG_SCHED_CPULOAD_CRITMONITOR=y +CONFIG_SCHED_CRITMONITOR=y Before: nsh> ps TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK CPU COMMAND 0 0 0 0 FIFO Kthread - Ready 0000000000000000 0069584 52.9% Idle_Task 1 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067456 0.0% sim_loop_wq 0x7b4417a003f0 0x7b4417a00470 2 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067464 17.6% hpwork 0x4014dba0 0x4014dc20 3 3 0 100 FIFO Task - Running 0000000000000000 0067496 36.8% nsh_main After: nsh> ps TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK CPU COMMAND 0 0 0 0 FIFO Kthread - Ready 0000000000000000 0069584 100.0% Idle_Task 1 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067456 0.0% sim_loop_wq 0x7646932003f0 0x764693200470 2 0 0 224 FIFO Kthread - Waiting Semaphore 0000000000000000 0067464 0.0% hpwork 0x4014dba0 0x4014dc20 3 3 0 100 FIFO Task - Running 0000000000000000 0067496 0.0% nsh_main This issue was introduced by PR #17075, where the run_start update for the target task was omitted in the SCHED_CPULOAD_CRITMONITOR branch. Signed-off-by: chao an --- sched/sched/sched_critmonitor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sched/sched/sched_critmonitor.c b/sched/sched/sched_critmonitor.c index 94c944b79c26f..c4c3f213e1f06 100644 --- a/sched/sched/sched_critmonitor.c +++ b/sched/sched/sched_critmonitor.c @@ -375,6 +375,7 @@ void nxsched_switch_critmon(FAR struct tcb_s *from, FAR struct tcb_s *to) #ifdef CONFIG_SCHED_CPULOAD_CRITMONITOR clock_t tick = elapsed * CLOCKS_PER_SEC / perf_getfreq(); nxsched_critmon_cpuload(from, current, tick); + to->run_start = current; #endif #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0 From b9b5d9afbf5a88f3c52830d4ce88ae038be0fd35 Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Sun, 29 Mar 2026 08:32:05 +0200 Subject: [PATCH 25/26] Documentation: add NuttX-12.13.0 release notes Add release notes for 12.13.0 release Signed-off-by: Alin Jerpelea --- Documentation/ReleaseNotes/NuttX-12.13.0 | 796 +++++++++++++++++++++++ 1 file changed, 796 insertions(+) create mode 100644 Documentation/ReleaseNotes/NuttX-12.13.0 diff --git a/Documentation/ReleaseNotes/NuttX-12.13.0 b/Documentation/ReleaseNotes/NuttX-12.13.0 new file mode 100644 index 0000000000000..571b4b1968622 --- /dev/null +++ b/Documentation/ReleaseNotes/NuttX-12.13.0 @@ -0,0 +1,796 @@ +NuttX-12.13.0 +------------ + +What's New In This Release +Major Changes to Core OS +Sched +* [#17287](https://github.com/apache/nuttx/pull/17287) sched/clock: Fix missing clock_inittime() call +* [#17423](https://github.com/apache/nuttx/pull/17423) docs/sched/sched: Add documentation for different sleep interfaces +* [#17482](https://github.com/apache/nuttx/pull/17482) sched/clock: Remove unnecessary preprocessor definition +* [#17485](https://github.com/apache/nuttx/pull/17485) sched/misc: correct coredump log format +* [#17517](https://github.com/apache/nuttx/pull/17517) sched/sched: Part 1: add high resolution timer (hrtimer) only (without os tick support with hrtimer) for NuttX +* [#17535](https://github.com/apache/nuttx/pull/17535) sched/signal: assert if call timedwait from interrupt +* [#17545](https://github.com/apache/nuttx/pull/17545) sched: merge task_tcb_s and pthread_tcb_s into tcb to simplify the code. +* [#17546](https://github.com/apache/nuttx/pull/17546) sched/env_putenv:putenv is kernel function need use kmm_free +* [#17564](https://github.com/apache/nuttx/pull/17564) Revert "sched/group: move task group into task_tcb_s to improve perfo… +* [#17584](https://github.com/apache/nuttx/pull/17584) sched: Improvements on sched_timerexpiration. +* [#17640](https://github.com/apache/nuttx/pull/17640) sched/wdog: Fix-up for SMP and Improvements. +* [#17642](https://github.com/apache/nuttx/pull/17642) sched/hrtimer: hrtimer state machine improvement for SMP cases +* [#17644](https://github.com/apache/nuttx/pull/17644) sched/signals: add support to partially or fully disable signals +* [#17680](https://github.com/apache/nuttx/pull/17680) sched: Remove `CONFIG_SCHED_TICKLESS_TICK_ARGUMENT`. +* [#17681](https://github.com/apache/nuttx/pull/17681) sched/wdog: fix race condition in wd_gettime() +* [#17739](https://github.com/apache/nuttx/pull/17739) sched/task: fix Redundant memory allocation. +* [#17781](https://github.com/apache/nuttx/pull/17781) sched/hrtimer: isolate SMP logic in hrtimer +* [#17784](https://github.com/apache/nuttx/pull/17784) sched/hrtimer: Fix some functional correctness issues. +* [#17796](https://github.com/apache/nuttx/pull/17796) sched/wdog: Simplify the wdog expiration handling. +* [#17822](https://github.com/apache/nuttx/pull/17822) sched: binfmt remove csection +* [#17823](https://github.com/apache/nuttx/pull/17823) sched: merge nxsched_timer_expiration() into nxsched_process_timer() to simplify tick process +* [#17848](https://github.com/apache/nuttx/pull/17848) sched/hrtimer: Some improvements. +* [#17912](https://github.com/apache/nuttx/pull/17912) sched/sched: Improve sched make and cmake scripts +* [#17921](https://github.com/apache/nuttx/pull/17921) sched/hrtimer: fix Kconfig typo +* [#17941](https://github.com/apache/nuttx/pull/17941) sched/tls: fix uninitialized argv pointer in task info +* [#17953](https://github.com/apache/nuttx/pull/17953) sched/task: fix task_exit regression with critical section state +* [#17955](https://github.com/apache/nuttx/pull/17955) sched/addrenv: replace critical section with spinlock for refs protec… +* [#17957](https://github.com/apache/nuttx/pull/17957) sched/environ: rm cestion_in evn +* [#17958](https://github.com/apache/nuttx/pull/17958) sched/irq: handle NULL ISR handler in irq_default_handler +* [#17959](https://github.com/apache/nuttx/pull/17959) sched/signal: use spinlock to protect signal queues +* [#17969](https://github.com/apache/nuttx/pull/17969) sched/sched_roundrobin.c: fix round-robin scheduling in SMP mode +* [#17971](https://github.com/apache/nuttx/pull/17971) sched/list: some improvements. +* [#17981](https://github.com/apache/nuttx/pull/17981) sched: stack debugging improvements +* [#17985](https://github.com/apache/nuttx/pull/17985) sched/task: fix null pointer dereference in fork address environment … +* [#17991](https://github.com/apache/nuttx/pull/17991) sched/signals: improvements for when all signals are disabled +* [#17993](https://github.com/apache/nuttx/pull/17993) sched/wdog: Simplify tickless timer expiration. +* [#18002](https://github.com/apache/nuttx/pull/18002) sched/sched: add sched_timer.c to improve tick processing and enable hrtimer support for scheduler +* [#18007](https://github.com/apache/nuttx/pull/18007) sched/group: add spinlock in group_childstatus.c +* [#18012](https://github.com/apache/nuttx/pull/18012) sched: add spinlock to sched_note_preemption and nxsched_critmon_pree… +* [#18016](https://github.com/apache/nuttx/pull/18016) sched/task: MISRA/Coverity cleanups in scheduler, init, libc spawn, and ARMv8-R IRQ helpers +* [#18026](https://github.com/apache/nuttx/pull/18026) sched/hrtimer: add option for list-based hrtimer management +* [#18034](https://github.com/apache/nuttx/pull/18034) sched/environ: add interrupt context check to getenv +* [#18037](https://github.com/apache/nuttx/pull/18037) sched/tls: fix thread ID initialization in tls_dup_info +* [#18038](https://github.com/apache/nuttx/pull/18038) sched/pthread: use spin_lock_irqsave_nopreempt for mutex head lock +* [#18040](https://github.com/apache/nuttx/pull/18040) sched: move process ID from kernel to TLS for faster access +* [#18041](https://github.com/apache/nuttx/pull/18041) sched/pthread: remove duplicate robust mutex checking logic +* [#18047](https://github.com/apache/nuttx/pull/18047) [BUG-FIX] Fix some bug of sched +* [#18066](https://github.com/apache/nuttx/pull/18066) sched/irq: Avoid same static function name in different files +* [#18070](https://github.com/apache/nuttx/pull/18070) sched/signal: fix the occasional issue where SIGCONT was not executed +* [#18072](https://github.com/apache/nuttx/pull/18072) sched/wqueue: add configuring the stack of an hpwork/lpwork as static +* [#18078](https://github.com/apache/nuttx/pull/18078) sched: add configuration to record the busy waiting time +* [#18080](https://github.com/apache/nuttx/pull/18080) sched/sched: Modify the critical section interface name +* [#18084](https://github.com/apache/nuttx/pull/18084) sched/irq: declare the object in scope +* [#18086](https://github.com/apache/nuttx/pull/18086) sched/irq: avoid casting from signed int to unsigned int +* [#18090](https://github.com/apache/nuttx/pull/18090) sched/irq: Every function must have exactly one exit point +* [#18093](https://github.com/apache/nuttx/pull/18093) sched/irq: fix MISRA C problems for irq_chain.c +* [#18098](https://github.com/apache/nuttx/pull/18098) sched/pthread: move pthread mutex from syscall to user-space +* [#18105](https://github.com/apache/nuttx/pull/18105) sched/irq: Change the function parameter "regs" to "context" +* [#18111](https://github.com/apache/nuttx/pull/18111) sched/irq: Avoid directly converting variables of type uintptr_t to void +* [#18114](https://github.com/apache/nuttx/pull/18114) sched: add trace points during system startup and board initialization +* [#18118](https://github.com/apache/nuttx/pull/18118) sched: fix regression and improve NULL pointer safety in task information functions +* [#18122](https://github.com/apache/nuttx/pull/18122) sched/irq: Fix potential deadlock in irqchain_detach +* [#18131](https://github.com/apache/nuttx/pull/18131) sched/hrtimer: Fix functional correctness issues. +* [#18141](https://github.com/apache/nuttx/pull/18141) sched/hrtimer: refresh code comments to match implementation +* [#18160](https://github.com/apache/nuttx/pull/18160) sched/irq: Add architecture-specific IRQ-to-index mapping interface +* [#18174](https://github.com/apache/nuttx/pull/18174) sched/hrtimer: fix hrtimer regression introduced by recent update and add support for tickless with hrtimer +* [#18175](https://github.com/apache/nuttx/pull/18175) sched/irq: functions should have exactly one exit point +* [#18183](https://github.com/apache/nuttx/pull/18183) sched: Remove FS_PROCFS dependency for SCHED_CRITMONITOR +* [#18184](https://github.com/apache/nuttx/pull/18184) sched: Remove legacy sched_resumescheduler.c +* [#18187](https://github.com/apache/nuttx/pull/18187) sched: call spinlock nopreempt when need disable context swi… +* [#18189](https://github.com/apache/nuttx/pull/18189) sched: replace critical section with spinlock +* [#18190](https://github.com/apache/nuttx/pull/18190) sched/irq: Avoid negative array index in irqchain_dispatch +* [#18191](https://github.com/apache/nuttx/pull/18191) sched/irq: Fix type mismatch in irq_dispatch (MISRA C-2012 Rule 10.3) +* [#18192](https://github.com/apache/nuttx/pull/18192) sched/signal: Optimize code logic +* [#18193](https://github.com/apache/nuttx/pull/18193) sched/semaphore: Fix HIS_CALLS metric violation for MISRA compliance +* [#18196](https://github.com/apache/nuttx/pull/18196) sched: Add bounds checking to prevent OVERRUN defect +* [#18197](https://github.com/apache/nuttx/pull/18197) sched: Fix null pointer dereference (FORWARD_NULL defect) +* [#18198](https://github.com/apache/nuttx/pull/18198) sched: Reduce return points in sched_rrgetinterval() for MISRA compliance +* [#18201](https://github.com/apache/nuttx/pull/18201) sched/semaphore: Code quality improvements and MISRA compliance fixes +* [#18202](https://github.com/apache/nuttx/pull/18202) sched: Reduce return statements in sched_get_stackinfo() for MISRA compliance +* [#18203](https://github.com/apache/nuttx/pull/18203) sched/irq: Consolidate IRQ bounds checking into IRQ_TO_NDX macro +* [#18204](https://github.com/apache/nuttx/pull/18204) sched/irq: Avoid out-of-bounds array access +* [#18205](https://github.com/apache/nuttx/pull/18205) sched_setpriority: Consolidate return statements for MISRA HIS compliance +* [#18208](https://github.com/apache/nuttx/pull/18208) sched_setparam: Refactor nxsched_set_param() with helper functions for MISRA HIS compliance +* [#18210](https://github.com/apache/nuttx/pull/18210) sched: Optimize reader-writer semaphore and achieve MISRA HIS goto compliance +* [#18212](https://github.com/apache/nuttx/pull/18212) sched_getfiles: Consolidate return statements in nxsched_get_fdlist_from_tcb() for MISRA HIS compliance +* [#18215](https://github.com/apache/nuttx/pull/18215) sched_profil: Move static variable to block scope for MISRA C 2012 compliance +* [#18216](https://github.com/apache/nuttx/pull/18216) sched: Consolidate return statements for MISRA HIS compliance +* [#18217](https://github.com/apache/nuttx/pull/18217) sched_profil: Consolidate return statements for MISRA HIS compliance +* [#18220](https://github.com/apache/nuttx/pull/18220) sched_sysinfo: Consolidate return statements for MISRA HIS compliance +* [#18221](https://github.com/apache/nuttx/pull/18221) sched_get_stateinfo: Move static array to block scope for MISRA C 2012 Rule 8.9 +* [#18223](https://github.com/apache/nuttx/pull/18223) sched_setscheduler: Eliminate goto statements and consolidate returns for MISRA HIS compliance +* [#18224](https://github.com/apache/nuttx/pull/18224) sched/hrtimer: Fix functional correctness issues and improve the performance. +* [#18237](https://github.com/apache/nuttx/pull/18237) sched: Consolidate return statements in sched_critmonitor() for MISRA HIS compliance +* [#18227](https://github.com/apache/nuttx/pull/18227) sched_getscheduler: Consolidate return statements for MISRA HIS compliance +* [#18235](https://github.com/apache/nuttx/pull/18235) sched_waitid: Code quality improvements for HIS compliance and complexity reduction +* [#18239](https://github.com/apache/nuttx/pull/18239) sched_cpuload: Move static wdog to block scope for MISRA C 2012 Rule 8.9 +* [#18240](https://github.com/apache/nuttx/pull/18240) sched_sysinfo.c: misra_c_2012_rule_9_1_violation: uninit_use +* [#18241](https://github.com/apache/nuttx/pull/18241) Fix critical SMP scheduler issues with CPU selection and ready-to-run list management +* [#18255](https://github.com/apache/nuttx/pull/18255) sched/semaphore: optimize the source code +* [#18270](https://github.com/apache/nuttx/pull/18270) sched/spinlock: Replace critical_section with spinlock. +* [#18278](https://github.com/apache/nuttx/pull/18278) sched/sched: fix casting issue found by coverity +* [#18284](https://github.com/apache/nuttx/pull/18284) sched/clock: replace atomic operations with sequence lock for tick counter +* [#18306](https://github.com/apache/nuttx/pull/18306) sched: Fix CANCEL_FLAG_* macro definitions MISRA C:2012 Rule 10.4 violations +* [#18307](https://github.com/apache/nuttx/pull/18307) sched/spawn: Fix MISRA C Rule 10.4 violations +* [#18336](https://github.com/apache/nuttx/pull/18336) sched/waitpid: reduce cyclomatic complexity for HIS/MISRA compliance +* [#18338](https://github.com/apache/nuttx/pull/18338) sched/semaphore: Add debug assert to detect mutex recursion. +* [#18376](https://github.com/apache/nuttx/pull/18376) sched/mqueue: Enable receiving messages on an interrupt handler +* [#18437](https://github.com/apache/nuttx/pull/18437) sched/clock: fix CLOCK_BOOTTIME and CLOCK_MONOTONIC handling +* [#18438](https://github.com/apache/nuttx/pull/18438) sched/sched: fix typos and remove unused declarations in sched.h +* [#18444](https://github.com/apache/nuttx/pull/18444) sched/sched: Add nxsched_abstick_sleep() and make nxsched_ticksleep() a wrapper around it +* [#18448](https://github.com/apache/nuttx/pull/18448) sched/misc: fix incorrect mutex holder retrieval in assert backtrace +* [#18450](https://github.com/apache/nuttx/pull/18450) sched/misc: fix potential out-of-bounds access in coredump stack emission +* [#18451](https://github.com/apache/nuttx/pull/18451) sched/misc: fix incomplete data emission in coredump elf_emit function +MM +* [#17439](https://github.com/apache/nuttx/pull/17439) mm/iob: add iob_init method to support external buffer init as iob structure +* [#17537](https://github.com/apache/nuttx/pull/17537) mm/mempool: fix misjudged condition of interrupt memory release +* [#17668](https://github.com/apache/nuttx/pull/17668) mm/iob: limit the alignment length of IOB to no less than sizeof(uinptr_t) +* [#17704](https://github.com/apache/nuttx/pull/17704) mm/iob: update all iob information in the iob_update_pktlen +* [#18042](https://github.com/apache/nuttx/pull/18042) mm/kasan: prevent recursive report overflow +* [#18358](https://github.com/apache/nuttx/pull/18358) mm/mm_gran: fix data truncation on 64-bit systems by using size_t for mask +* [#18445](https://github.com/apache/nuttx/pull/18445) mm/mempool: Optimize undefined behavior in memory pool allocation +* [#18464](https://github.com/apache/nuttx/pull/18464) mm/mempool: fix the entry condition for semaphore during mempool allocation +* [#17538](https://github.com/apache/nuttx/pull/17538) mm: use Kconfig to control sequence number to save memory +* [#18152](https://github.com/apache/nuttx/pull/18152) mm: implement custom umm heap, and enable heap management on the simulator +* [#18427](https://github.com/apache/nuttx/pull/18427) mm: use mm_malloc inside of mm_memalig +libc +* [#17453](https://github.com/apache/nuttx/pull/17453) libs/libc: machine code update +* [#17479](https://github.com/apache/nuttx/pull/17479) libc/machine/xtensa: add mcount implementation for gprof +* [#17533](https://github.com/apache/nuttx/pull/17533) libc/libelf: fix bug for libelf_symname +* [#17534](https://github.com/apache/nuttx/pull/17534) libs/libc/misc: backtrace needs init lock before use +* [#17544](https://github.com/apache/nuttx/pull/17544) libs/libc: use builtin function to optimize string function +* [#17495](https://github.com/apache/nuttx/pull/17495) libs/libc/obstack/lib_obstack_free.c: fix object check within chunk +* [#17502](https://github.com/apache/nuttx/pull/17502) libc: improve libc dependencies in case of LIBM_NONE +* [#17568](https://github.com/apache/nuttx/pull/17568) libc/search: add foreach api for hcreate_data +* [#17571](https://github.com/apache/nuttx/pull/17571) libc/localtime: tz_lock/unlock should not touch tcb except FLAT +* [#17742](https://github.com/apache/nuttx/pull/17742) libc/syslograwstream: Use memrchr to locate the newline character for… +* [#17789](https://github.com/apache/nuttx/pull/17789) libc: Add Kconfig option to disable hex-string to float parsing +* [#17831](https://github.com/apache/nuttx/pull/17831) libs/libc/ftok: fix sizeof(char *), after tempbuffer +* [#17838](https://github.com/apache/nuttx/pull/17838) libcxx: porting libcxx test. +* [#17840](https://github.com/apache/nuttx/pull/17840) libs/libcxx: port for Infineon TASKING compiler. +* [#17841](https://github.com/apache/nuttx/pull/17841) libcxx: supports CXX_MINI_LOCALIZATION +* [#17846](https://github.com/apache/nuttx/pull/17846) libs/libxx: libcxxabi script updates +* [#17862](https://github.com/apache/nuttx/pull/17862) libs/libc: Fix fsetops func signature +* [#17898](https://github.com/apache/nuttx/pull/17898) libc/netdb: avoid unnecessary DNS notify if nameserver exists +* [#17910](https://github.com/apache/nuttx/pull/17910) libc/stdio: fix freopen fd handling and add fdsan support +* [#17936](https://github.com/apache/nuttx/pull/17936) libc: add creat function implementation +* [#17956](https://github.com/apache/nuttx/pull/17956) libs/libc: replace critical section with spinlock in hostname operations +* [#18028](https://github.com/apache/nuttx/pull/18028) libcxx/libstdc++: Add libsupc++.defs to support libsupc++ +* [#18046](https://github.com/apache/nuttx/pull/18046) libc/pthread: Avoid compiler optimizations for once_control->done +* [#18058](https://github.com/apache/nuttx/pull/18058) libs/libc/regex: remove logically dead code in regcomp.c +* [#18076](https://github.com/apache/nuttx/pull/18076) libc/spawn: support get/set priority +* [#18018](https://github.com/apache/nuttx/pull/18018) libxx: fix __config_site for libcxx compile errors +* [#17990](https://github.com/apache/nuttx/pull/17990) libs/libxx: change libcxxmini to libminiabi +* [#18019](https://github.com/apache/nuttx/pull/18019) libs/libxx: Add _LIBCPP_HAS_NO_CONTENTION_TABLE to reduce RAM usage +* [#18136](https://github.com/apache/nuttx/pull/18136) libs/libc/pthread: Optimize mutex robustness configuration and remove unnecessary tl_lock +* [#18285](https://github.com/apache/nuttx/pull/18285) libc/tls: update preprocessor condition comment to match implementation +* [#18334](https://github.com/apache/nuttx/pull/18334) libc/string: Add BSD-optimized memset implementation. +* [#18449](https://github.com/apache/nuttx/pull/18449) libs/libc: add configurable skip count for mutex backtrace addresses +* [#17853](https://github.com/apache/nuttx/pull/17853) libs/libs: fix wqueue config typo +* [#18068](https://github.com/apache/nuttx/pull/18068) libs/crc: implement AUTOSAR-compatible CRC algorithm +* [#18151](https://github.com/apache/nuttx/pull/18151) libstdc++: Relocate c++config.h from include/ to libstdc++ to preserv +tools +* [#17525](https://github.com/apache/nuttx/pull/17525) tools/nxtagspkgsfetch.sh: Fetch tags packages for NuttX and Apps. +* [#17874](https://github.com/apache/nuttx/pull/17874) Tools[feat]: Add config change impact simulation tool (checkkconfig) using kconfig-lib +* [#17886](https://github.com/apache/nuttx/pull/17886) tools/abi_check.py: Identify potential ABI incompatibility issues +* [#18035](https://github.com/apache/nuttx/pull/18035) tools/pynuttx/nxgdb: fix semaphore field access in debugging scripts +* [#18124](https://github.com/apache/nuttx/pull/18124) tools/parsetrace.py: Fix get_typesize bug in parsetrace.py +* [#18299](https://github.com/apache/nuttx/pull/18299) tools: fix `make host_info` flag parsing and config string escaping +Various +* [#17444](https://github.com/apache/nuttx/pull/17444) include/string.h: mark memset and memcpy as used_code +* [#17569](https://github.com/apache/nuttx/pull/17569) include/nuttx: Introduce seqlock, a sequential count based read-write lock. +* [#17575](https://github.com/apache/nuttx/pull/17575) include/nuttx/atomic.h: fix C++ definition conflicts +* [#17851](https://github.com/apache/nuttx/pull/17851) include/sys: extend the IOCTL defintion that compatible with linux kernel +* [#18236](https://github.com/apache/nuttx/pull/18236) include/notifier: fix undefined reference to spin_lock_irqsave_nopreempt +* [#18308](https://github.com/apache/nuttx/pull/18308) include/cxx/cmath: Fix compatibility with external toolchains +* [#18374](https://github.com/apache/nuttx/pull/18374) include/cxx/cmath: Use toolchain with toolchain libm +Crypto +* [#17932](https://github.com/apache/nuttx/pull/17932) crypto: export aes-cbc with 192/256 keysize +* [#17948](https://github.com/apache/nuttx/pull/17948) crypto/cryptodev: fix memory leak when failed to open /dev/crypto +* [#17952](https://github.com/apache/nuttx/pull/17952) Crypto key management with docs +* [#17994](https://github.com/apache/nuttx/pull/17994) crypto/cryptosoft: replace macro howmany with common macro div_round_up +* [#17995](https://github.com/apache/nuttx/pull/17995) crypto/blake2s.h: fix tasking compile warning +* [#17996](https://github.com/apache/nuttx/pull/17996) crypto/siphash: avoid redefine name issue +* [#18064](https://github.com/apache/nuttx/pull/18064) Crypto: export ecc software +* [#18138](https://github.com/apache/nuttx/pull/18138) crypto/cryptosoft: Fix HMAC-SHA when a long key is used +* [#18167](https://github.com/apache/nuttx/pull/18167) crypto: fixes for cryptodev, cryptosoft and RSA export updates +* [#18169](https://github.com/apache/nuttx/pull/18169) crypto: support software key management features (MTD storage, Key Gen) +Major Changes to the Build System +cmake +* [#18364](https://github.com/apache/nuttx/pull/18364) CMake: build implemented for NXP S32K3 Family +* [#17427](https://github.com/apache/nuttx/pull/17427) cmake: Add support for ccache +* [#17550](https://github.com/apache/nuttx/pull/17550) cmake:add lib_psa_set/getstackaddr file to CMakeLists.txt +* [#17558](https://github.com/apache/nuttx/pull/17558) cmake:add missing cflag "-D_FILE_OFFSET_BITS=64" of sim +* [#17579](https://github.com/apache/nuttx/pull/17579) arch/arm: Aligned Cmake with Make +* [#17430](https://github.com/apache/nuttx/pull/17430) boards/arm/stm32l4: CMake added boards Part1 +* [#17794](https://github.com/apache/nuttx/pull/17794) fix cmake build +* [#17810](https://github.com/apache/nuttx/pull/17810) arch/arm/xmc4: Aligned Cmake with Make and added XMC4500 and XMC4700 Relax +* [#17852](https://github.com/apache/nuttx/pull/17852) CMake[enhance][debug]: Add target information tracking and dump capability for CMake builds +* [#17857](https://github.com/apache/nuttx/pull/17857) CMake(enhance): Complete defconfig include support with menuconfig writeback capability +* [#17864](https://github.com/apache/nuttx/pull/17864) arch/arm/cmake: fix the gnu-elf.ld handle error at ghs pre-process +* [#17868](https://github.com/apache/nuttx/pull/17868) CMake[bugfix]:Fix incorrect include directory order in CMake application configuration +* [#17908](https://github.com/apache/nuttx/pull/17908) arch/arm/src/am335x: CMake build implemented for TI AM335x Sitara +* [#17922](https://github.com/apache/nuttx/pull/17922) ghs.cmake: add preprocess command to the .ld script generate procedure +* [#17927](https://github.com/apache/nuttx/pull/17927) CMake(feat): Implement CMake ELF Application Build Mode +* [#17968](https://github.com/apache/nuttx/pull/17968) build/cmake: add missing libcxxtoolchain support +* [#18382](https://github.com/apache/nuttx/pull/18382) arm64/chip/imx9: add cmake support, add reboot support +* [#18015](https://github.com/apache/nuttx/pull/18015) libs/libm: cmake fix +* [#18033](https://github.com/apache/nuttx/pull/18033) arch: fix cmake error +* [#18144](https://github.com/apache/nuttx/pull/18144) CMake build implemented for NXP S32K1 Family +* [#18194](https://github.com/apache/nuttx/pull/18194) CMake: Multiple bugfix and optimizations for build system reliability +* [#18390](https://github.com/apache/nuttx/pull/18390) CMake: build implemented for Microchip's SAM3 SAM4 Family +* [#18392](https://github.com/apache/nuttx/pull/18392) CMake: build implemented for Microchip's SAM D/L Family +* [#18400](https://github.com/apache/nuttx/pull/18400) cmake/nuttx_mkconfig: Improve .config comparison logic +* [#18411](https://github.com/apache/nuttx/pull/18411) CMake: build implemented for Microchip's SAM D5x/E5x Family +* [#18413](https://github.com/apache/nuttx/pull/18413) boards/arm/stm32f0l0g0: CMake fix build b-l072z-lrwan1:nxlines_oled +* [#18419](https://github.com/apache/nuttx/pull/18419) CMake: build implemented for STM32 STM32WB Series +* [#18423](https://github.com/apache/nuttx/pull/18423) CMake: build implemented for STM32 STM32L5 Series +* [#18432](https://github.com/apache/nuttx/pull/18432) CMake: build implemented for Allwinner A1X family +* [#18433](https://github.com/apache/nuttx/pull/18433) CMake: build implemented for Quicklogic EOS S3 +* [#18440](https://github.com/apache/nuttx/pull/18440) CMake: build implemented for STM32 STM32WL5 +* [#18443](https://github.com/apache/nuttx/pull/18443) cmake: bump minimum required CMake version to 3.20 +* [#18455](https://github.com/apache/nuttx/pull/18455) arm64/cmake: fix typo in CMAKE_STRIP flag +* [#18466](https://github.com/apache/nuttx/pull/18466) CMake: build implemented for Microchip's SAMA5 Family +Architectural Support +Architecture Improvements +* [#16795](https://github.com/apache/nuttx/pull/16795) arch/sim: save errno in sim context switch to avoid coroutine make errno mess between host api calls. +* [#17011](https://github.com/apache/nuttx/pull/17011) arch: Remove default value for BOARD_LOOPSPERMSEC +* [#17117](https://github.com/apache/nuttx/pull/17117) arch/arm/imxrt: serial registration fixes when no dev console defined +* [#17372](https://github.com/apache/nuttx/pull/17372) arch/arm64: fix create page table err +* [#17377](https://github.com/apache/nuttx/pull/17377) arch/arm64: config irq type +* [#17416](https://github.com/apache/nuttx/pull/17416) arch/arm/stm32h5: Add RS-485 support to serial driver +* [#17420](https://github.com/apache/nuttx/pull/17420) arch/xmc4 : various fixes and clean +* [#17425](https://github.com/apache/nuttx/pull/17425) arch/arm/samv7: allow all values for count in read +* [#17429](https://github.com/apache/nuttx/pull/17429) arch/arm/src/samv7/Kconfig: allow 0 in MCANx_RXFIFOx_SIZE +* [#17442](https://github.com/apache/nuttx/pull/17442) arch/arm/samv7: optimize MCUboot loader configuration +* [#17448](https://github.com/apache/nuttx/pull/17448) arch/armv8-r: use -mfpu=fpv5-sp-d16 for SP-only Cortex-R52 targets +* [#17450](https://github.com/apache/nuttx/pull/17450) arch/crt0.c: revert entry name to `_start` +* [#17454](https://github.com/apache/nuttx/pull/17454) arch/arm/src/kinetis: support RS485 on UART, fix warnings and pin assignment for K60 +* [#17484](https://github.com/apache/nuttx/pull/17484) arch/sim: USB host support isochronous transfer endpoint +* [#17486](https://github.com/apache/nuttx/pull/17486) arch/Toolchain.defs: ELF entry for more archs +* [#17507](https://github.com/apache/nuttx/pull/17507) arch/risc-v: add crt0 to LDELFFLAG +* [#17523](https://github.com/apache/nuttx/pull/17523) arch/sim: fix sim spi issue +* [#17542](https://github.com/apache/nuttx/pull/17542) arch/x86_64: fix syscall type mismatch +* [#17549](https://github.com/apache/nuttx/pull/17549) arch/arm: use cfi to debug syscall +* [#17684](https://github.com/apache/nuttx/pull/17684) arch/armv8-m: Fix IRQ number corruption in exception_direct with O2 optimization +* [#17690](https://github.com/apache/nuttx/pull/17690) arch/tricore: enable CONFIG_SYSTEM_TIME64 for TC397 +* [#17762](https://github.com/apache/nuttx/pull/17762) arch/risc-v: Fix incompatible pointer types in vector context switching +* [#17767](https://github.com/apache/nuttx/pull/17767) arch/risc-v: Enable VPU initialization for QEMU RV +* [#17788](https://github.com/apache/nuttx/pull/17788) arch/kinetis: Fix S32K3XX regressions caused by refactoring +* [#17795](https://github.com/apache/nuttx/pull/17795) arch/avr/src/avrdx: remove unused variable and update comment +* [#17815](https://github.com/apache/nuttx/pull/17815) arch/arm: fix the error in obtaining thread pointer after we use `-mtp=soft` +* [#17832](https://github.com/apache/nuttx/pull/17832) arch/arm/samv7: fix incorrect Kconfig SAMV7_EMAC0_RMII dependency +* [#17854](https://github.com/apache/nuttx/pull/17854) arch/arm: add -ffunction-sections and -fdata-sections compile options +* [#17855](https://github.com/apache/nuttx/pull/17855) arch/arm: change ghs vfpv3 to vfpv5 accrding to armv7-m documentation +* [#17856](https://github.com/apache/nuttx/pull/17856) arch/arm: replace the "-Wall" build option with the "-ghstd=last" +* [#17867](https://github.com/apache/nuttx/pull/17867) arch/sim: Refactor Wi-Fi simulation and add Pseudo Mode support +* [#17880](https://github.com/apache/nuttx/pull/17880) arch/x64: Syscall support is enabled by default +* [#17881](https://github.com/apache/nuttx/pull/17881) arch/x64: create qemu chip +* [#17883](https://github.com/apache/nuttx/pull/17883) arch/x86_64/intel64: fix build break for timerisr +* [#17891](https://github.com/apache/nuttx/pull/17891) arch/x64: add acpi procfs and poweroff +* [#17892](https://github.com/apache/nuttx/pull/17892) arch/x64:Fix the abnormal backtrace display issue +* [#17893](https://github.com/apache/nuttx/pull/17893) arch/x64: Fix crash issue after enabling KASAN +* [#17897](https://github.com/apache/nuttx/pull/17897) arch/sim: support SOCK_RAW in host_usrsock_socket +* [#17906](https://github.com/apache/nuttx/pull/17906) arch/arm/imxrt: fix error header guard +* [#17951](https://github.com/apache/nuttx/pull/17951) arch/x86_64: add support for linker map generation +* [#17961](https://github.com/apache/nuttx/pull/17961) arch: move STACK_ALIGNMENT to irq.h +* [#17964](https://github.com/apache/nuttx/pull/17964) arch/imx9: Modify default ddr config handling +* [#17965](https://github.com/apache/nuttx/pull/17965) arch/arm64: disable fork support in protected build mode +* [#17974](https://github.com/apache/nuttx/pull/17974) arch/tricore: support cache function +* [#17975](https://github.com/apache/nuttx/pull/17975) arch/tricore: enhanced irq handling +* [#17984](https://github.com/apache/nuttx/pull/17984) arch: enable ARCH_KERNEL_STACK support in protected builds +* [#17986](https://github.com/apache/nuttx/pull/17986) arch: fix addrenv_switch changing this_task causing exceptions +* [#17988](https://github.com/apache/nuttx/pull/17988) arch/stm32: Fix stm32-capture if timer don't support GTIM_CCER_CC1NP +* [#18006](https://github.com/apache/nuttx/pull/18006) arch: move some macros to public code. +* [#18008](https://github.com/apache/nuttx/pull/18008) arch/x86_64: Add gprof and stack check tool +* [#18010](https://github.com/apache/nuttx/pull/18010) arch/x64:add up_set_irq_type +* [#18020](https://github.com/apache/nuttx/pull/18020) arch/x86_64: fix revoke_low_memory +* [#18021](https://github.com/apache/nuttx/pull/18021) arch/x64: interrupt add CFI info +* [#18022](https://github.com/apache/nuttx/pull/18022) arch/x64: Solve the sig_nest hang issue +* [#18023](https://github.com/apache/nuttx/pull/18023) arch/x86_64i:Fix issue 02 Compile acpidump crash problem +* [#18030](https://github.com/apache/nuttx/pull/18030) arch/arm64: fix mpu_freeregion +* [#18048](https://github.com/apache/nuttx/pull/18048) arch: default enable TLS_ALIGNED when BUILD_PROTECTED=y +* [#18059](https://github.com/apache/nuttx/pull/18059) arch/tricore: disable CPU and system watchdogs during startup +* [#18060](https://github.com/apache/nuttx/pull/18060) arch/tricore: add NMI trap handler (weak) +* [#18065](https://github.com/apache/nuttx/pull/18065) arch/arm: armv8-r PL at startup needs to be checked +* [#18067](https://github.com/apache/nuttx/pull/18067) arch/arm: Add arm memmanage fault skip operation +* [#18079](https://github.com/apache/nuttx/pull/18079) arch/tricore: add tricore mpu driver +* [#18092](https://github.com/apache/nuttx/pull/18092) arch/arm/nrf: fix rtc functions return param +* [#18097](https://github.com/apache/nuttx/pull/18097) arch/xtensa: remove XCHAL_SYSCALL_LEVEL +* [#18099](https://github.com/apache/nuttx/pull/18099) arch/arm: Add the macro definitions for CFI instructions for ghs +* [#18103](https://github.com/apache/nuttx/pull/18103) arch: add stack alignment and size validation for CONFIG_TLS_ALIGNED +* [#18106](https://github.com/apache/nuttx/pull/18106) arch/arm64: fix backtrace return address precision +* [#18117](https://github.com/apache/nuttx/pull/18117) arch/arm/nrf{52|53|91}: fix timer timeout value (overflow issue) +* [#18130](https://github.com/apache/nuttx/pull/18130) arch/x86_64: optimize assembly instructions for size and performance +* [#18140](https://github.com/apache/nuttx/pull/18140) arch/arm/src/imxrt: Fix Ethernet RUNNING status regression +* [#18153](https://github.com/apache/nuttx/pull/18153) arch/arm: systick: fix off-by-one in SysTick RELOAD programming +* [#18157](https://github.com/apache/nuttx/pull/18157) arch/arm64: Enhance MPU infrastructure with unified interface and improved platform flexibility +* [#18158](https://github.com/apache/nuttx/pull/18158) arch/arm64: Enhance MPU with background region and region query interface +* [#18166](https://github.com/apache/nuttx/pull/18166) arch/xtensa/esp32/esp32s2 spi errors +* [#18168](https://github.com/apache/nuttx/pull/18168) arch/stm32: Add counter reset function +* [#18177](https://github.com/apache/nuttx/pull/18177) arch/armv8-r64: userspace PMU access +* [#18186](https://github.com/apache/nuttx/pull/18186) arch/risc-v: fix timer initialization for SMP mode using mtimer +* [#18195](https://github.com/apache/nuttx/pull/18195) arch/xtensa/espressif: ESP32 simpleboot improvements +* [#18214](https://github.com/apache/nuttx/pull/18214) arch/armv7-r: Enable userspace PMU access with performance event support +* [#18229](https://github.com/apache/nuttx/pull/18229) arch/arm: GPIO IMX9 Add support for IRQ line1 and GPIO5 +* [#18230](https://github.com/apache/nuttx/pull/18230) arch/arm: LPSPI imx9 add support for 2nd CS +* [#18268](https://github.com/apache/nuttx/pull/18268) arch/x86_64: use pause to reduce power consumption in spin wait loops +* [#18273](https://github.com/apache/nuttx/pull/18273) arch/imx9: Correct CONFIG_IMX9_ENET_PHYINIT flag and imx9_phy_boardinitialize +* [#18277](https://github.com/apache/nuttx/pull/18277) arch/sim: Add sigdelset to nuttx-names.in +* [#18279](https://github.com/apache/nuttx/pull/18279) arch/arm64: Delete the default save for SCTLR and fix the issue of including incorrect order +* [#18296](https://github.com/apache/nuttx/pull/18296) arch/arm/stm32: fix undeclared page variable in flash write +* [#18297](https://github.com/apache/nuttx/pull/18297) arch/xtensa: fix `INT32_C` macro to match `int32_t` type +* [#18298](https://github.com/apache/nuttx/pull/18298) arch/x86_64: replaced loop construct with rep movsb +* [#18300](https://github.com/apache/nuttx/pull/18300) arch/arm/stm32h7: fix sdcan clock, ILS register and ID +* [#18303](https://github.com/apache/nuttx/pull/18303) arch/x86: fixed errors in gdt_flush and idt_flush +* [#18349](https://github.com/apache/nuttx/pull/18349) arch/risc-v: Fix page table traversal for SV39 +* [#18381](https://github.com/apache/nuttx/pull/18381) arch/tricore: initialize spinlock used by tricore systimer +* [#18403](https://github.com/apache/nuttx/pull/18403) arch/arm64/Imx9: usdhc improvements +* [#18409](https://github.com/apache/nuttx/pull/18409) arch/arm64/imx9: Add enet MII clock calculation +* [#18418](https://github.com/apache/nuttx/pull/18418) arch/arm: remove all "select ARMV8M_HAVE_STACKCHECK". +* [#18429](https://github.com/apache/nuttx/pull/18429) arch/risc-v/espressif: Fix SHA errors +* [#18452](https://github.com/apache/nuttx/pull/18452) arch/sim: fix X11 framebuffer window not visible in POSIX simulator +* [#18453](https://github.com/apache/nuttx/pull/18453) arch/sim: fix incomplete HCI socket data reading in simulator interrupt handler +* [#18457](https://github.com/apache/nuttx/pull/18457) arch/arm: Add necessary conversion between tick and usec in systick_interrupt +* [#18461](https://github.com/apache/nuttx/pull/18461) arch/[risc-v|xtensa]/src/common: Create SoC-specific initialization routine +* [#18462](https://github.com/apache/nuttx/pull/18462) arch/xtensa/esp32: Fix buffer overflow in SPI poll exchange +Driver Support +Drivers With Improvements +* [#16925](https://github.com/apache/nuttx/pull/16925) drivers/timers/capture: fix typo in capture.h +* [#17373](https://github.com/apache/nuttx/pull/17373) drivers/pci: Calculate PCI bar size use mask 0xffffffff +* [#17375](https://github.com/apache/nuttx/pull/17375) drivers/pci: calculate bar size +* [#17376](https://github.com/apache/nuttx/pull/17376) drivers/eeprom: Support PE/SE/CE commands +* [#17379](https://github.com/apache/nuttx/pull/17379) drivers/pci: write legacy num to config sapce when enable legacy irq +* [#17426](https://github.com/apache/nuttx/pull/17426) drivers/lcd/st7789.c: fix byte order in st7789_fill for 3 wires +* [#17433](https://github.com/apache/nuttx/pull/17433) drivers/usbdev: fix cdcecm netdev can not enter running state +* [#17441](https://github.com/apache/nuttx/pull/17441) drivers/can/can.c: fix broken O_NONBLOCK +* [#17446](https://github.com/apache/nuttx/pull/17446) drivers/lpwan: Fix Kconfig SX1276 and SX1262 position +* [#17455](https://github.com/apache/nuttx/pull/17455) note/drivers: Get taskname more safely. +* [#17456](https://github.com/apache/nuttx/pull/17456) drivers/i3c: Revert "drivers/i3c: remove extra i3c_dev_register, do_daa has created them" +* [#17464](https://github.com/apache/nuttx/pull/17464) drivers/mmcsd: Aligned Cmake with Make +* [#17470](https://github.com/apache/nuttx/pull/17470) drivers/rpmsgdev: server functions enhanced +* [#17491](https://github.com/apache/nuttx/pull/17491) drivers/usbhost: improve usbhost hid kbd +* [#17498](https://github.com/apache/nuttx/pull/17498) drivers/timers/ptp: support ptp clock driver model,CLOCKFD and clock adjtime/settime/gettime for ptp device +* [#17501](https://github.com/apache/nuttx/pull/17501) drivers/battery: fix event lost before service open +* [#17510](https://github.com/apache/nuttx/pull/17510) drivers/ioexpander: add debounce and interrupt mask functions +* [#17512](https://github.com/apache/nuttx/pull/17512) drivers/sensors/goldfish: support more sensors +* [#17528](https://github.com/apache/nuttx/pull/17528) drivers/input: Adds a small extension to the Force Feedback (FF) input subsystem +* [#17529](https://github.com/apache/nuttx/pull/17529) drivers/virtio: Fix DRIVERS_VIRTIO_INPUT configuration dependencies +* [#17530](https://github.com/apache/nuttx/pull/17530) drivers: replace critical_section with spinlock +* [#17531](https://github.com/apache/nuttx/pull/17531) drivers/timers: A small improvements in the drivers/timers subsystem +* [#17540](https://github.com/apache/nuttx/pull/17540) drivers/timers: fix rtc_time struct +* [#17541](https://github.com/apache/nuttx/pull/17541) drivers/virtio: if in assert, don't wait semaphore +* [#17552](https://github.com/apache/nuttx/pull/17552) drivers/mtd: Add W25N SPI NAND flash driver +* [#17554](https://github.com/apache/nuttx/pull/17554) drivers/rpmsg: Add rpmsg_get_signals API and rpmsg transport ops support +* [#17586](https://github.com/apache/nuttx/pull/17586) drivers/net: fix "wapi save_config" and "wapi reconnect" commands +* [#17597](https://github.com/apache/nuttx/pull/17597) drivers/net: setting loopback network driver sending task to the HPWORK queue +* [#17604](https://github.com/apache/nuttx/pull/17604) drivers/mtd: add MTDIOC_ISBAD ioctl +* [#17746](https://github.com/apache/nuttx/pull/17746) drivers/i2c: add ioexpander-based lower-half implementation for I2C bit-bang +* [#17747](https://github.com/apache/nuttx/pull/17747) drivers/capture: add signal notification support and fake capture driver +* [#17752](https://github.com/apache/nuttx/pull/17752) drivers/sensors: add a dynamic sensor debugging tool sensor_monitor +* [#17760](https://github.com/apache/nuttx/pull/17760) drivers/rpmsg: port spi add debug log, low power feature and bug fixs +* [#17763](https://github.com/apache/nuttx/pull/17763) drivers/sx127x: Add support to different bitrate and RX timeout +* [#17764](https://github.com/apache/nuttx/pull/17764) drivers/adc: Use mutexlock to replace critical section protection +* [#17769](https://github.com/apache/nuttx/pull/17769) drivers/sensors: update upper->parsebuffer every new line +* [#17772](https://github.com/apache/nuttx/pull/17772) drivers/sensors: fix mpu9250 register function comments +* [#17776](https://github.com/apache/nuttx/pull/17776) drivers/pty: fix memory leak when pty_destroy +* [#17778](https://github.com/apache/nuttx/pull/17778) drivers/rpmsg: router double free and reconnect related bugs fix +* [#17782](https://github.com/apache/nuttx/pull/17782) drivers/usrsock: replace net_lock with conn_lock +* [#17783](https://github.com/apache/nuttx/pull/17783) drivers/Rpmsg: fix rpmsg dead lock and ns bind race condition problem +* [#17787](https://github.com/apache/nuttx/pull/17787) drivers/rptun: fix rptun stop related deadlock and crash bugs +* [#17797](https://github.com/apache/nuttx/pull/17797) drivers/can: replace critical-section mutex with spinlock +* [#17802](https://github.com/apache/nuttx/pull/17802) drivers/virtio-gpu: Avoid calling free in IRQ +* [#17805](https://github.com/apache/nuttx/pull/17805) drivers/net/e1000|igc.c: add PIDVID of NIC +* [#17813](https://github.com/apache/nuttx/pull/17813) drivers/ioexpander: add enable & disable macro for gpio SETDEBOUNCE and SETMASK +* [#17814](https://github.com/apache/nuttx/pull/17814) drivers/sensors: add get_info interface for gnss_uorb +* [#17816](https://github.com/apache/nuttx/pull/17816) drivers/rptun: refactor rptun to decoupling the rptun and rpmsg virtio, make rptun can work with any virtio devices +* [#17824](https://github.com/apache/nuttx/pull/17824) drivers/sensors: sensor bug fix - part 1 +* [#17833](https://github.com/apache/nuttx/pull/17833) drivers/net: fix igc build error +* [#17837](https://github.com/apache/nuttx/pull/17837) drivers/sensors: add a new sensor type ENG +* [#17842](https://github.com/apache/nuttx/pull/17842) drivers/net/rpmsgdrv.c: add bidirectional data netdev support +* [#17845](https://github.com/apache/nuttx/pull/17845) drivers/mtd: Optimizations for RRAM/MRAM Compatibility and Erase Logic Robustness +* [#17870](https://github.com/apache/nuttx/pull/17870) drivers/net: Fix crash in wifi_sim disconnect. +* [#17871](https://github.com/apache/nuttx/pull/17871) drivers/virtio: Use arc4random_buf to generate MAC address. +* [#17872](https://github.com/apache/nuttx/pull/17872) drivers/sensors/fakesensor: Remove GNSS dependency +* [#17923](https://github.com/apache/nuttx/pull/17923) drivers/timers: check CONFIG_BOARD_LOOPSPERMSEC != 0 at runtime +* [#17928](https://github.com/apache/nuttx/pull/17928) drivers/can: repair compiler error +* [#17942](https://github.com/apache/nuttx/pull/17942) drivers/mmcsd: fix typo, it should be "Byte" by spec +* [#17949](https://github.com/apache/nuttx/pull/17949) drivers/misc/optee: add missing addrenv header include +* [#17989](https://github.com/apache/nuttx/pull/17989) drivers/usbhost_hidkbd: Fix small typo in usbhost_hidkbd.c +* [#18005](https://github.com/apache/nuttx/pull/18005) drivers/rpmsg: remove unnecessary header files, revise make.def and cmake file +* [#18014](https://github.com/apache/nuttx/pull/18014) drivers/serial/Kconfig-16550: fix non-existent option +* [#18036](https://github.com/apache/nuttx/pull/18036) drivers/rpmsg: use nuttx/atomic.h instead metal/atomic.h +* [#18061](https://github.com/apache/nuttx/pull/18061) drivers/pipe: fix POLLHUP handling in poll() +* [#18073](https://github.com/apache/nuttx/pull/18073) drivers/sensors optimizes the sensor rpmsg driver proxy waiting mechanism to improve reliability. part 2 +* [#18081](https://github.com/apache/nuttx/pull/18081) drivers/analog/mcp47x6: fix configuration command +* [#18085](https://github.com/apache/nuttx/pull/18085) drivers/rpmsg_router: multiple fixes and improvements for multi-core stability +* [#18091](https://github.com/apache/nuttx/pull/18091) drivers/mtd: add nvs cache buffer +* [#18095](https://github.com/apache/nuttx/pull/18095) drivers/mtd: support ram_mtdconfig device && lomtdconfig device +* [#18100](https://github.com/apache/nuttx/pull/18100) drivers/net/slip: set serial port to raw mode to prevent character escaping +* [#18102](https://github.com/apache/nuttx/pull/18102) drivers/sensors: fix sensor deadlock. part 3 +* [#18108](https://github.com/apache/nuttx/pull/18108) drivers/rpmsg: unify cpuname handling and fix pm wakelock initialization +* [#18116](https://github.com/apache/nuttx/pull/18116) drivers/serial: Fix SIGINT not delivered to foreground process on Ctrl-C +* [#18125](https://github.com/apache/nuttx/pull/18125) drivers/usbdev: fix rndis net link status can't update timely issue +* [#18134](https://github.com/apache/nuttx/pull/18134) drivers/sensors: Add non-wakeup mode support and optimize RPMSG communication part 4. +* [#18156](https://github.com/apache/nuttx/pull/18156) drivers/rpmsg: fix struct alignment issue by removing flexible array member +* [#18159](https://github.com/apache/nuttx/pull/18159) drivers/rpmsg_port_spi: add PM support and stability improvements +* [#18163](https://github.com/apache/nuttx/pull/18163) drivers/rpmsg_port_uart: Improvements and bug fixes for stability and power management +* [#18164](https://github.com/apache/nuttx/pull/18164) drivers/sensors/dhtxx: Fix read return values to be POSIX compliant +* [#18165](https://github.com/apache/nuttx/pull/18165) drivers/rpmsg: refactor internal APIs to private header +* [#18180](https://github.com/apache/nuttx/pull/18180) drivers/sensors: Remove the uncalibrated member of the sensor lowerhalf layer part 5 +* [#18209](https://github.com/apache/nuttx/pull/18209) drivers/sensors: sensor bug fix. part 6 +* [#18231](https://github.com/apache/nuttx/pull/18231) drivers/serial: fix crash when buffer is full and only recvbuf is imp… +* [#18246](https://github.com/apache/nuttx/pull/18246) drivers/ioexapnder/mcp23x17 : Fix write gpio output values on OLAT registers +* [#18248](https://github.com/apache/nuttx/pull/18248) drivers/rpmsg: support release the rx buffer early in endpoint callback +* [#18250](https://github.com/apache/nuttx/pull/18250) drivers/timers: add timer driver implemented by watchdog +* [#18256](https://github.com/apache/nuttx/pull/18256) drivers/sensors: add sensor monitor debug log. part 7 +* [#18261](https://github.com/apache/nuttx/pull/18261) drivers/sensors/gnss: Add monitor logs for activation +* [#18265](https://github.com/apache/nuttx/pull/18265) drivers/virtio: virtio config space size-matched read operations +* [#18286](https://github.com/apache/nuttx/pull/18286) drivers/analog: fix adc ads1115 driver +* [#18289](https://github.com/apache/nuttx/pull/18289) drivers/vhost: Improvements and fixes for vhost framework +* [#18290](https://github.com/apache/nuttx/pull/18290) drivers/virtio: use virtqueue_nused() to check pending buffers +* [#18291](https://github.com/apache/nuttx/pull/18291) drivers/virtio: fix the minor code style in virtio.c +* [#18294](https://github.com/apache/nuttx/pull/18294) drivers/rpmsg: add timestamp support for rpmsg buffer latency measurement +* [#18301](https://github.com/apache/nuttx/pull/18301) drivers/lcd: Add ST7796 TFT LCD framebuffer driver +* [#18304](https://github.com/apache/nuttx/pull/18304) drivers/power/pm: Fix typos in comments +* [#18361](https://github.com/apache/nuttx/pull/18361) drivers/usbdev: Fix usbmsc_unbind() function for USB composite device +* [#18372](https://github.com/apache/nuttx/pull/18372) drivers/note: noteram ioctl FIONBIO should return -ENOTTY +* [#18410](https://github.com/apache/nuttx/pull/18410) drivers/serial/uart: implement uart rpmsg linux conterpart +* [#18435](https://github.com/apache/nuttx/pull/18435) drivers/sensors: Legacy sensor warning +* [#18446](https://github.com/apache/nuttx/pull/18446) drivers/serial: add common Xilinx UART Peripheral System (XUARTPS) support +* [#18454](https://github.com/apache/nuttx/pull/18454) drivers/syslog: add millisecond option for syslog timestamp formatting' +* [#17460](https://github.com/apache/nuttx/pull/17460) driver/usbhost: Support obtaining USB3.0 device descriptors +* [#17487](https://github.com/apache/nuttx/pull/17487) power/battery: battery gauge driver support +* [#17557](https://github.com/apache/nuttx/pull/17557) driver/note: make SIZEOF_NOTE_START return the right size +* [#17744](https://github.com/apache/nuttx/pull/17744) driver/cfi: fix write failed issue for unalign length with bankwidth +* [#17774](https://github.com/apache/nuttx/pull/17774) can: fix can driver error about hdr is not initilized +* [#17866](https://github.com/apache/nuttx/pull/17866) driver/cfi-flash: Add a config option for the page size of CFI flash. +* [#17979](https://github.com/apache/nuttx/pull/17979) crypto/cryptodev: support private data in driver +* [#18029](https://github.com/apache/nuttx/pull/18029) crypto/cryptodev: optimize driver +* [#18121](https://github.com/apache/nuttx/pull/18121) driver/note: Support poll threshold +* [#18123](https://github.com/apache/nuttx/pull/18123) driver/note: Add tag to note_event_s and note_printf_s +* [#18127](https://github.com/apache/nuttx/pull/18127) driver/syslog: Implement the rate limiting function for ramlog driver. +* [#18128](https://github.com/apache/nuttx/pull/18128) driver/note: Fix compilation error when CONFIG_SYSLOG_TO_SCHED_NOTE=y +* [#18280](https://github.com/apache/nuttx/pull/18280) driver/virtio: Delete reset on initialization +* [#18368](https://github.com/apache/nuttx/pull/18368) driver/input: Add keyboard matrix driver to read matrix keyboard using polling way. +* [#18370](https://github.com/apache/nuttx/pull/18370) video/sim_camera: Improve camera driver behavior and simulator camera coverage. +Board Support +New Board Support +* [#18460](https://github.com/apache/nuttx/pull/18460) Introduce i.MX93 (M33) and IMX93-QSB board support +Boards With Significant Improvements +* [#17397](https://github.com/apache/nuttx/pull/17397) boards/nucleo-h743zi: modify the romfs img file path +* [#17471](https://github.com/apache/nuttx/pull/17471) boards/defconfig: enable CONFIG_SCHED_CHILD_STATUS +* [#17477](https://github.com/apache/nuttx/pull/17477) boards/risc-v/esp32c3: Corrected the names of #include guards +* [#17532](https://github.com/apache/nuttx/pull/17532) boards/risc-v: Add lvgl64_vector configuration for RISC-V QEMU +* [#17547](https://github.com/apache/nuttx/pull/17547) boards/arm/mps3-an547: enable protected mode support +* [#17560](https://github.com/apache/nuttx/pull/17560) boards/nucleo-g431rb/qenco: reduce FLASH +* [#17562](https://github.com/apache/nuttx/pull/17562) boards/nucleo-f446re: disable OSTEST in some configs +* [#17563](https://github.com/apache/nuttx/pull/17563) boards/qemu-intel64/jumbo: enable more network tools +* [#17566](https://github.com/apache/nuttx/pull/17566) boards/risc-v/esp32c3: add Waveshare ESP32-C3-Zero +* [#17572](https://github.com/apache/nuttx/pull/17572) boards/esp32s3/lckfb-szpi: Add QMI8658 6-axis IMU sensor support +* [#17574](https://github.com/apache/nuttx/pull/17574) boards/esp32: Add initial support to Heltec WiFi LoRa32 +* [#17576](https://github.com/apache/nuttx/pull/17576) boards/leds: remove dependency on leds example for some boards +* [#17577](https://github.com/apache/nuttx/pull/17577) boards/nucleo-c0xxx: fix leds handling +* [#17581](https://github.com/apache/nuttx/pull/17581) boards/esp32/heltec_wifi_lora32: Add support to SX1276 transceiver +* [#17738](https://github.com/apache/nuttx/pull/17738) boards/{nrf53|stm32h7}: mark shmem region as NOLOAD +* [#17751](https://github.com/apache/nuttx/pull/17751) board/lm3s6432-s2e/nsh: disable LIBC_LONG_LONG to fix ci bb +* [#17771](https://github.com/apache/nuttx/pull/17771) boards/raspberrypi-4b: Add testing configurations +* [#17879](https://github.com/apache/nuttx/pull/17879) boards/arm/kinetis: fix freeform-k28f usbhshost undeclared 'errcode' +* [#17911](https://github.com/apache/nuttx/pull/17911) boards/esp32c3-xiao: Fix ble configuration crash +* [#17945](https://github.com/apache/nuttx/pull/17945) boards/stm32f103-minimum: Add GPIO in/out/int define +* [#18013](https://github.com/apache/nuttx/pull/18013) boards/qemu-intel64/jumbo: enable procfs ACPI +* [#18025](https://github.com/apache/nuttx/pull/18025) boards/smartl-c906: enable hrtimer ostest in CI +* [#18031](https://github.com/apache/nuttx/pull/18031) boards/boardctl: Add BOARDCTL_MACADDR command +* [#18032](https://github.com/apache/nuttx/pull/18032) boards/xtensa/esp32: add rtc_reserved_seg to legacy_sections +* [#18054](https://github.com/apache/nuttx/pull/18054) boards/nrf53: correct rptun names +* [#18094](https://github.com/apache/nuttx/pull/18094) boards/sim: Fix watchdog callback +* [#18132](https://github.com/apache/nuttx/pull/18132) boards/sim: enable list-based hrtimer in CI ostest +* [#18146](https://github.com/apache/nuttx/pull/18146) boards/boardctl: use spinlock IRQ-safe interfaces for consistency +* [#18154](https://github.com/apache/nuttx/pull/18154) boards/xtensa: fixes for build and start-up issues when legacy boot enabled +* [#18206](https://github.com/apache/nuttx/pull/18206) board: enable hritmer (RB-tree and list implementation) CITEST on arm and riscv board +* [#18251](https://github.com/apache/nuttx/pull/18251) boards/sim/crypto: enable cmocka testing framework +* [#18283](https://github.com/apache/nuttx/pull/18283) boards/boardctl: BOARDIOC_SPINLOCK missing some Conditional branch +* [#18310](https://github.com/apache/nuttx/pull/18310) boards/risc-v/esp32c6: Add missing config for esp32c6 romfs +* [#18355](https://github.com/apache/nuttx/pull/18355) boards/imx95-evk: enable mpu by default +* [#18363](https://github.com/apache/nuttx/pull/18363) boards/arm: add nxp mr-navq95b support +* [#18406](https://github.com/apache/nuttx/pull/18406) boards/xtensa/esp32: add three missing defconfigs +* [#18416](https://github.com/apache/nuttx/pull/18416) boards/xtensa/esp32s2: add efuse defconfig +* [#18420](https://github.com/apache/nuttx/pull/18420) boards/stm32h7: Add button support to nucleo-h743zi2 +* [#18459](https://github.com/apache/nuttx/pull/18459) boards/esp32c3-xiao: Add NimBLE example configuration +File System +Significant Improvements +* [#17488](https://github.com/apache/nuttx/pull/17488) fs/romfs: revert the romfs write feature +* [#17500](https://github.com/apache/nuttx/pull/17500) fs/vfs: fix poll covertify issue about out-of-bound access fds +* [#17539](https://github.com/apache/nuttx/pull/17539) fs/mqueue: fix msgq memleak +* [#17548](https://github.com/apache/nuttx/pull/17548) fs/procfs: bugfix in heapcheck, avoid '\n' to 0 +* [#17559](https://github.com/apache/nuttx/pull/17559) fs/tmpfs: fix memoryleak of tmpfs_opendir +* [#17706](https://github.com/apache/nuttx/pull/17706) littlefs: fix statfs underflow during active writes +* [#17731](https://github.com/apache/nuttx/pull/17731) fs/inode: bug fix about fdlist_extend, fdlist_install and eventfd/timerfd_blocking_io +* [#17740](https://github.com/apache/nuttx/pull/17740) fs/mqueue: fix inverted 'created' flag in file_mq_vopen +* [#17741](https://github.com/apache/nuttx/pull/17741) fs/epoll: release refs count and add TLS cleanup handler to release epoll fd reference on thread exit +* [#17748](https://github.com/apache/nuttx/pull/17748) fs/file: add reference count protection for stack-allocated file structures +* [#17513](https://github.com/apache/nuttx/pull/17513) bugfix/fs:write Bad buf addr should return EINVAL +* [#17811](https://github.com/apache/nuttx/pull/17811) fs/inode: using file_allocate and file_dup to avoid racecondition to allocate new fd +* [#17821](https://github.com/apache/nuttx/pull/17821) fs/userfs: keep mutex while reading iobuffer +* [#17839](https://github.com/apache/nuttx/pull/17839) fs/driver: Replace heap allocation of temporary device names +* [#18001](https://github.com/apache/nuttx/pull/18001) fs: add fs dump in ROMFS/LITTLEFS +* [#18062](https://github.com/apache/nuttx/pull/18062) fs: Fix the incorrect return value of the lseek interface. +* [#18107](https://github.com/apache/nuttx/pull/18107) fs/fat: add support for FIOC_FILEPATH ioctl +* [#18200](https://github.com/apache/nuttx/pull/18200) fs: fix inode information update outside of lock in SMP scene +* [#18238](https://github.com/apache/nuttx/pull/18238) fs/timerfd: implement TFD_TIMER_CANCEL_ON_SET to detect clock changes +Networking +Improvements +* [#16940](https://github.com/apache/nuttx/pull/16940) net: Hardware Checksum Offload Support for NuttX Network Stack +* [#17431](https://github.com/apache/nuttx/pull/17431) net/pkt: Add some feature support +* [#17435](https://github.com/apache/nuttx/pull/17435) net/can: add write buffer to support nonblock send +* [#17436](https://github.com/apache/nuttx/pull/17436) net/netdev/netdev_register.c: skip mld_devinit if Nic can not support mld +* [#17440](https://github.com/apache/nuttx/pull/17440) net/utils/net_bufpool: add lock to struct net_bufpool_s and bufpool_navail +* [#17451](https://github.com/apache/nuttx/pull/17451) net: replace critical_section with spinlock +* [#17452](https://github.com/apache/nuttx/pull/17452) net: add vlan support +* [#17465](https://github.com/apache/nuttx/pull/17465) netdev_upperhalf: convert Kconfig to variable +* [#17483](https://github.com/apache/nuttx/pull/17483) net/pkt: add SOCK_DGRAM support +* [#17519](https://github.com/apache/nuttx/pull/17519) net: Check listening connections when selecting ports +* [#17520](https://github.com/apache/nuttx/pull/17520) net/pkt: Fixed error handling for unsupported types +* [#17521](https://github.com/apache/nuttx/pull/17521) net/socket: Fixed network card name does not end with \0 when binding the device issue +* [#17526](https://github.com/apache/nuttx/pull/17526) net/tcp: modify txavail to be sent directly in the current thread +* [#17551](https://github.com/apache/nuttx/pull/17551) net/packet: add PACKET__MEMBERSHIP support +* [#17553](https://github.com/apache/nuttx/pull/17553) net/netlink: add RT_TABLE_LOCAL definition for mqttc5 build +* [#17555](https://github.com/apache/nuttx/pull/17555) net/tcp: add TCP_CORK definition +* [#17585](https://github.com/apache/nuttx/pull/17585) net/netdev: allow stack to send/receive when running +* [#17587](https://github.com/apache/nuttx/pull/17587) net/igmp: mod check of IGMP_SCHEDMSG from assert to error log +* [#17588](https://github.com/apache/nuttx/pull/17588) net/tcp: modify the return value when dev is down in tcp_pollsetup +* [#17589](https://github.com/apache/nuttx/pull/17589) net: update check condition from IFF_UP to IFF_RUNNING in the network sending process +* [#17590](https://github.com/apache/nuttx/pull/17590) net/tcp: resolve reconnection issues when connection failed due to rejection +* [#17603](https://github.com/apache/nuttx/pull/17603) net/tcp: improve TCP retransmission mechanisms for better reliability +* [#17607](https://github.com/apache/nuttx/pull/17607) net/pkt: fix DHCP transmission failure by updating d_sndlen/d_len lengths +* [#17652](https://github.com/apache/nuttx/pull/17652) net/wireless: fix compile warning issue for wireless +* [#17655](https://github.com/apache/nuttx/pull/17655) netpkt: Introduction to using netpkt example +* [#17656](https://github.com/apache/nuttx/pull/17656) net/ethernet: ARP can be configured on interface +* [#17657](https://github.com/apache/nuttx/pull/17657) netlib: Introduction to IP conflict detection functions +* [#17658](https://github.com/apache/nuttx/pull/17658) net/icmp: check the checksum field when receive icmp message +* [#17659](https://github.com/apache/nuttx/pull/17659) net/ethernet: remove no use remove excess code +* [#17660](https://github.com/apache/nuttx/pull/17660) netdev_upperhalf: add direct rx mode +* [#17661](https://github.com/apache/nuttx/pull/17661) net/can: fix the typo and compile error +* [#17662](https://github.com/apache/nuttx/pull/17662) net/icmp: Return -ENOPROTOOPT for SOL_SOCKET to avoid misleading logs +* [#17663](https://github.com/apache/nuttx/pull/17663) net/net_initialize: remove the empty functions that are not needed +* [#17667](https://github.com/apache/nuttx/pull/17667) net/can: can protocol uses a separate buffer to cache can data +* [#17669](https://github.com/apache/nuttx/pull/17669) netlib: Add IOB statistics interface description +* [#17672](https://github.com/apache/nuttx/pull/17672) net/ipfrag: fix ip fragment assert when iob not enough +* [#17673](https://github.com/apache/nuttx/pull/17673) net/bufpool: fix typo +* [#17674](https://github.com/apache/nuttx/pull/17674) net/icmp: check src ip for icmp request message +* [#17676](https://github.com/apache/nuttx/pull/17676) net/tcp: add kconfig to support retransmission at a fixed time +* [#17677](https://github.com/apache/nuttx/pull/17677) net/vlan: add some macro for vlan +* [#17678](https://github.com/apache/nuttx/pull/17678) net/tcp: add support for the CLOSE_WAIT state +* [#17679](https://github.com/apache/nuttx/pull/17679) nuttx/net: Expose the net_ipv6addr_maskcmp interface to user-mode calls +* [#17686](https://github.com/apache/nuttx/pull/17686) net/ipv4: Send ICMP Destination Unreachable for unknown protocol +* [#17687](https://github.com/apache/nuttx/pull/17687) net/ipv4: Drop a ipv4 packet with total length bigger than the actual transmitted data +* [#17688](https://github.com/apache/nuttx/pull/17688) net/arp: support ARP entry learned on gratuitous ARP response +* [#17689](https://github.com/apache/nuttx/pull/17689) net/icmp: Support icmp timestamp request +* [#17691](https://github.com/apache/nuttx/pull/17691) net/tcp: tcp header seq check +* [#17692](https://github.com/apache/nuttx/pull/17692) net: decouple the impact of net_lock between network cards +* [#17693](https://github.com/apache/nuttx/pull/17693) net/ethernet: fix compilation issues for inet_sockif.c +* [#17695](https://github.com/apache/nuttx/pull/17695) net/vlan: make a judgment before calling fuction +* [#17698](https://github.com/apache/nuttx/pull/17698) net/udp: Validate UDP length field against actual packet size +* [#17699](https://github.com/apache/nuttx/pull/17699) net/udp: Support zero-length UDP datagrams +* [#17700](https://github.com/apache/nuttx/pull/17700) net/ethernet: change struct ifreq to consistent with Linux +* [#17701](https://github.com/apache/nuttx/pull/17701) net/devif: fix poll issue when ifdown +* [#17702](https://github.com/apache/nuttx/pull/17702) net/arp: dont learn arp information if interface is noarp +* [#17705](https://github.com/apache/nuttx/pull/17705) net/ioctl: add a socket interface for ioctl +* [#17707](https://github.com/apache/nuttx/pull/17707) net/tcp: support recv packet in the TCP_FIN_WAIT_1/2 state +* [#17709](https://github.com/apache/nuttx/pull/17709) net/tcp: remove SYN_RCVD state conn by listener created when free listener +* [#17710](https://github.com/apache/nuttx/pull/17710) net/tcp: send reset when retransmitted number greater than TCP_MAXRTX +* [#17711](https://github.com/apache/nuttx/pull/17711) net/tcp: support OTW ack seq check +* [#17712](https://github.com/apache/nuttx/pull/17712) net/arp: support arp request limit +* [#17713](https://github.com/apache/nuttx/pull/17713) net/tcp: discard fin packet in LISTEN state +* [#17714](https://github.com/apache/nuttx/pull/17714) net/tcp: fix tcp conn lock leak when port in use in tcp_selectport +* [#17715](https://github.com/apache/nuttx/pull/17715) net/tcp: fix conn->work use after free in worker queue list +* [#17716](https://github.com/apache/nuttx/pull/17716) net/ipv6: Drop IP packet shorter than length in IP header +* [#17729](https://github.com/apache/nuttx/pull/17729) net/arp: Skip ARP request if ip address is invalid +* [#17730](https://github.com/apache/nuttx/pull/17730) net/neighbor: Skip Neighbor request if ip address is invalid at ipv6 +* [#17732](https://github.com/apache/nuttx/pull/17732) net/netlink: replace net_lock with netlink_lock +* [#17733](https://github.com/apache/nuttx/pull/17733) net/local: replace net_lock with local_lock +* [#17734](https://github.com/apache/nuttx/pull/17734) net/usrsock: replace net_lock with usrsock_lock +* [#17735](https://github.com/apache/nuttx/pull/17735) net_sockif.c: add ip level s|getsockopt support in SOCK_CTRL +* [#17743](https://github.com/apache/nuttx/pull/17743) net/can: fix poll setup to properly find and use free pollfd slots +* [#17745](https://github.com/apache/nuttx/pull/17745) net/local: simplify file descriptor passing using shared filep references +* [#17754](https://github.com/apache/nuttx/pull/17754) net/devif_poll: only call the corresponding xxx_poll when there is data to be sent +* [#17775](https://github.com/apache/nuttx/pull/17775) net can: modify the return value of can_datahandler API. +* [#17785](https://github.com/apache/nuttx/pull/17785) net/udp: fix udp message cannot be sent to the network card +* [#17806](https://github.com/apache/nuttx/pull/17806) net/netdev: Fix best prefix in findby +* [#17819](https://github.com/apache/nuttx/pull/17819) net/route: need clear old cached route info when do reset cache +* [#17858](https://github.com/apache/nuttx/pull/17858) net: make the sendmsg param type consistent with posix specification +* [#17869](https://github.com/apache/nuttx/pull/17869) net/icmpv6: fix crash when ipv6 address modified during autoconfig +* [#17877](https://github.com/apache/nuttx/pull/17877) net/usrsock: Fix EPIPE loop by clearing POLLIN on remote close +* [#17878](https://github.com/apache/nuttx/pull/17878) net: Support no-lto option for the network build. +* [#17887](https://github.com/apache/nuttx/pull/17887) netinet/in.h: Rename imr_interface to imr_address in struct ip_mreqn. +* [#17890](https://github.com/apache/nuttx/pull/17890) net/icmp: Fix devif_loopback dead loop when unrecognized ICMP packet +* [#17895](https://github.com/apache/nuttx/pull/17895) net/route/ramroute: replace prealloc with netpool +* [#17896](https://github.com/apache/nuttx/pull/17896) net/neighbor: fix compilation with CONFIG_NET_ICMPv6_NO_STACK +* [#17907](https://github.com/apache/nuttx/pull/17907) net/can: allow errmask to be set to CAN_ERR_FLAG +* [#17917](https://github.com/apache/nuttx/pull/17917) net/ipv4: check whether the length of the ipv4 option is correct +* [#17919](https://github.com/apache/nuttx/pull/17919) net/netdev: correct the ioctl command validation logic +* [#18011](https://github.com/apache/nuttx/pull/18011) net: limit TCP and UDP send/recv buffer usage with throttled IOB +* [#18056](https://github.com/apache/nuttx/pull/18056) net/bluetooth: fix rmutex deadlock +* [#18247](https://github.com/apache/nuttx/pull/18247) net/netdev: a valid netdev for ipv4 should have ipv4 addr configured +* [#18249](https://github.com/apache/nuttx/pull/18249) netdev_driver: add carrier_on to xxx_ifup where carrier_on is absent +* [#18258](https://github.com/apache/nuttx/pull/18258) net/rpmsg: Modify error handling to rpmsg socket +* [#18386](https://github.com/apache/nuttx/pull/18386) net/utils: add union name for tasking compiler compatibility +Unsorted +* [#17432](https://github.com/apache/nuttx/pull/17432) icmp/icmp6: Fix some functional errors +* [#17434](https://github.com/apache/nuttx/pull/17434) select: fix too small timeout will be counted as 0 +* [#17445](https://github.com/apache/nuttx/pull/17445) misc C++ related fixes +* [#17449](https://github.com/apache/nuttx/pull/17449) Improve the robustness of env & binfmt code +* [#17457](https://github.com/apache/nuttx/pull/17457) Fix clang fortify issue +* [#17458](https://github.com/apache/nuttx/pull/17458) binfmt/elf: fix issue that the file is not closed after opening +* [#17461](https://github.com/apache/nuttx/pull/17461) usbhost: cdcacm exit wq after copy all received data +* [#17467](https://github.com/apache/nuttx/pull/17467) usbdev CDCACM optimization +* [#17469](https://github.com/apache/nuttx/pull/17469) sim usb enhancement +* [#17472](https://github.com/apache/nuttx/pull/17472) compiler: redefine float and double when disable float compiling +* [#17475](https://github.com/apache/nuttx/pull/17475) espressif: add support for flash encryption +* [#17476](https://github.com/apache/nuttx/pull/17476) 3-wire for ili9341 +* [#17478](https://github.com/apache/nuttx/pull/17478) eeprom/spi_xx25xx: Add IOCTL to set Block Protect +* [#17490](https://github.com/apache/nuttx/pull/17490) risc-v/litex: For vexriscv_smp, match default FDT address set by upstream opensbi. +* [#17492](https://github.com/apache/nuttx/pull/17492) usbdev: replace critical_section with spinlock +* [#17494](https://github.com/apache/nuttx/pull/17494) risc-v/litex: For vexriscv, point docs at linux CPU variant instead of secure. +* [#17496](https://github.com/apache/nuttx/pull/17496) usbhost: replace critical_section with spinlock +* [#17509](https://github.com/apache/nuttx/pull/17509) bugfix:the inode may have been removed by other core in SMP +* [#17515](https://github.com/apache/nuttx/pull/17515) rp2040,rp23xx,rp23xx-rv: allow up to 32 PIO instructions +* [#17518](https://github.com/apache/nuttx/pull/17518) timers/oneshot: Fix converted tv_nsec > NSEC_PER_SEC. +* [#17522](https://github.com/apache/nuttx/pull/17522) mtd/at25ee: Use eeprom/spi_xx25xx internally +* [#17561](https://github.com/apache/nuttx/pull/17561) openamp: upgrade the OpenAMP and Libmetal to the last released version v2025.10 +* [#17591](https://github.com/apache/nuttx/pull/17591) espressif: improve esp-hal-3rdparty handling +* [#17647](https://github.com/apache/nuttx/pull/17647) LoopTask: Sim loop task refactor wdt thread process loop event +* [#17651](https://github.com/apache/nuttx/pull/17651) defconfig: Change the default gateway address +* [#17653](https://github.com/apache/nuttx/pull/17653) cmocka/defconfig: Update defconfigs to include cmocka application +* [#17665](https://github.com/apache/nuttx/pull/17665) paho_mqtt: Add paho_mqtt repository description file +* [#17670](https://github.com/apache/nuttx/pull/17670) arp_poll: skip arp_out when arp_send flow +* [#17671](https://github.com/apache/nuttx/pull/17671) mld: free all mld group when netdev unregister +* [#17682](https://github.com/apache/nuttx/pull/17682) com/can: Attempt to release invalid resources when sender is full +* [#17683](https://github.com/apache/nuttx/pull/17683) tcp_reset: Modify RST packet responses to comply with RFC 793. +* [#17694](https://github.com/apache/nuttx/pull/17694) nuttx/can: in trunk support to Send message cancel mechanism. +* [#17696](https://github.com/apache/nuttx/pull/17696) risc-v/litex: Implement up_flush_dcache_all when CONFIG_ARCH_DCACHE is defined. +* [#17719](https://github.com/apache/nuttx/pull/17719) Sim/gpiochip: sim gpiochip support nuttx access host gpiochip +* [#17725](https://github.com/apache/nuttx/pull/17725) risc-v/litex: Add 64-bit S-mode vexiiriscv support for litex. +* [#17728](https://github.com/apache/nuttx/pull/17728) initial support for automated testing with NTFC +* [#17737](https://github.com/apache/nuttx/pull/17737) Add esp32c6 coremark and esp32s3 ostest defconfig +* [#17749](https://github.com/apache/nuttx/pull/17749) ARP table improvement +* [#17753](https://github.com/apache/nuttx/pull/17753) xtensa/esp32s3: fix dcache flush error in up_flush_dcache +* [#17755](https://github.com/apache/nuttx/pull/17755) utils.h: add conn_dev_sem_timedwait interface to simplify code logic +* [#17757](https://github.com/apache/nuttx/pull/17757) esp32s3: Remove redundant I2S include directive +* [#17761](https://github.com/apache/nuttx/pull/17761) Rpmsg: rpmsg services should be properly destroyed after calling rpmsg_device_destroy() +* [#17765](https://github.com/apache/nuttx/pull/17765) virtio/virtio-gpu: fbmem should transfer to pa +* [#17766](https://github.com/apache/nuttx/pull/17766) Migrate the rest of citest configurations to NTFC +* [#17770](https://github.com/apache/nuttx/pull/17770) [Kconfig] Fix Kconfig style +* [#17773](https://github.com/apache/nuttx/pull/17773) compiler: Add PRAGMA and unroll_loop. +* [#17777](https://github.com/apache/nuttx/pull/17777) virtio-gpu: support vsync and double fb +* [#17792](https://github.com/apache/nuttx/pull/17792) risc-v/litex: Update docs for vexriscv invalidate and no-op flush. +* [#17800](https://github.com/apache/nuttx/pull/17800) timer: rename tick_settimeouot to tick_settimeout +* [#17801](https://github.com/apache/nuttx/pull/17801) timer: add timer operation support +* [#17804](https://github.com/apache/nuttx/pull/17804) lin: adjust the LIN flag +* [#17807](https://github.com/apache/nuttx/pull/17807) Rpmsg test: add rpmsg test service to test the rpmsg apis +* [#17808](https://github.com/apache/nuttx/pull/17808) Rpmsg port uart: add low power support for rpmsg port uart +* [#17820](https://github.com/apache/nuttx/pull/17820) style: Fix case statement formatting in power management callbacks. +* [#17829](https://github.com/apache/nuttx/pull/17829) mtd/nvs: optimize nvs module +* [#17835](https://github.com/apache/nuttx/pull/17835) if_ether.h: add the definition of ETH_P_TSN +* [#17859](https://github.com/apache/nuttx/pull/17859) ghs: move the -fmacro-prefix-map compile option to compiler specific +* [#17860](https://github.com/apache/nuttx/pull/17860) arm64_head.S: fix the asm code build error +* [#17861](https://github.com/apache/nuttx/pull/17861) signal: add default sigaction for SIGURG +* [#17863](https://github.com/apache/nuttx/pull/17863) ghs: fix the UsageFault:INVSTATE error triggered by exception_common +* [#17875](https://github.com/apache/nuttx/pull/17875) sim: Pass through unknown sockopt to system. +* [#17884](https://github.com/apache/nuttx/pull/17884) stdio.h: Update TMP_MAX definition to match Linux +* [#17888](https://github.com/apache/nuttx/pull/17888) tcp_timer.c: send TCP_RST when keepalive timeout +* [#17899](https://github.com/apache/nuttx/pull/17899) tcp_input.c: standardize the processing of urgent data +* [#17900](https://github.com/apache/nuttx/pull/17900) sim: replace wdog with work queue in periodic work to avoid deadlock +* [#17901](https://github.com/apache/nuttx/pull/17901) libm: prevent atanf() yielding NaN for high inputs values. +* [#17902](https://github.com/apache/nuttx/pull/17902) ipfrag: use netdev_iob_replace_l2 to replace d_iob +* [#17905](https://github.com/apache/nuttx/pull/17905) Tricore sched +* [#17909](https://github.com/apache/nuttx/pull/17909) Rpmsg rtc fixes +* [#17916](https://github.com/apache/nuttx/pull/17916) ghs: update the compile option to recommended options +* [#17918](https://github.com/apache/nuttx/pull/17918) Ltp linux kernel completement sys wait impl +* [#17920](https://github.com/apache/nuttx/pull/17920) sys/resouce: add RLIM_NLIMITS definition +* [#17924](https://github.com/apache/nuttx/pull/17924) posix_test: fix the ltp project link error +* [#17925](https://github.com/apache/nuttx/pull/17925) Rpmsg signals: rpmsg router support get the rpmsg signals +* [#17926](https://github.com/apache/nuttx/pull/17926) lpcxpresso-lpc54628/netnsh: enable CONFIG_NET_SOCKOPTS to adapt icmpv6 changes +* [#17929](https://github.com/apache/nuttx/pull/17929) sys/types.h: Fixed the conflict issue with the "OK" constant definition +* [#17930](https://github.com/apache/nuttx/pull/17930) ulimit: add ulimit implementation +* [#17931](https://github.com/apache/nuttx/pull/17931) pthead: change the pthread_equal implementation from macro to function +* [#17933](https://github.com/apache/nuttx/pull/17933) limits: add _POSIX_PTHREAD_ constant for pthread management +* [#17934](https://github.com/apache/nuttx/pull/17934) pthread: reorganized the locations of pthread-related functions and constants +* [#17937](https://github.com/apache/nuttx/pull/17937) fpathconf: add _POSIX_PRIO_IO definition to comply with PSE52 standard +* [#17938](https://github.com/apache/nuttx/pull/17938) Tricore trap dump register +* [#17939](https://github.com/apache/nuttx/pull/17939) notifiy: remove critical section +* [#17946](https://github.com/apache/nuttx/pull/17946) Arm64 backtrace +* [#17947](https://github.com/apache/nuttx/pull/17947) arm64: add the interrupt status in the syscall +* [#17950](https://github.com/apache/nuttx/pull/17950) ctucanfd: increase rwcnt bitfield width and fix structure alignment +* [#17954](https://github.com/apache/nuttx/pull/17954) binfmt: refactor loadable module cleanup mechanism +* [#17960](https://github.com/apache/nuttx/pull/17960) arm64: add missing REG_SCTLR_EL1 initialization in signal processing +* [#17962](https://github.com/apache/nuttx/pull/17962) arm64: fix FIQ mask initialization in task state +* [#17963](https://github.com/apache/nuttx/pull/17963) arm: support AMP mode with GIC SGI inter-core interrupts +* [#17966](https://github.com/apache/nuttx/pull/17966) arm64: When returning from a system call, regs[REG_SP_EL0] will overw… +* [#17967](https://github.com/apache/nuttx/pull/17967) arm64: g_mpu_region need support SMP +* [#17970](https://github.com/apache/nuttx/pull/17970) kinetis/enet: Set carrier on/off on ifup/ifdown +* [#17972](https://github.com/apache/nuttx/pull/17972) tricore/csrm: bringup cpucs in tricore +* [#17976](https://github.com/apache/nuttx/pull/17976) imx95-m7: Fix Kconfig for flexcan typo +* [#17977](https://github.com/apache/nuttx/pull/17977) arm64: fix compile failed +* [#17982](https://github.com/apache/nuttx/pull/17982) armv7-a/arm_addrenv_pgmap.c: add up_addrenv_find_page and up_addrenv_… +* [#17983](https://github.com/apache/nuttx/pull/17983) arm64: fix stack pointer initialization when CONFIG_STACK_COLORATION … +* [#17998](https://github.com/apache/nuttx/pull/17998) arm64: add mpu_addrenv.c empty implementation and change arm64_addren… +* [#17999](https://github.com/apache/nuttx/pull/17999) arm64/toolchain: fix compile warnning +* [#18004](https://github.com/apache/nuttx/pull/18004) simwifi: Fix compilation warning +* [#18017](https://github.com/apache/nuttx/pull/18017) Kconfig: Add ALLOW_CUSTOM_PERMISSIVE_COMPONENTS license option +* [#18044](https://github.com/apache/nuttx/pull/18044) rpmsg/rpmsg_virtio: add rpmsg virtio common pm support +* [#18045](https://github.com/apache/nuttx/pull/18045) irq: rename STACK_ALIGNMENT to STACKFRAME_ALIGN for clarity +* [#18049](https://github.com/apache/nuttx/pull/18049) spinlock: add and optimize recursive spinlock interface for multi-core support +* [#18050](https://github.com/apache/nuttx/pull/18050) sim: it is not necessary to call restore_critical_section in irq +* [#18051](https://github.com/apache/nuttx/pull/18051) x86_64: remove unnecessary restore_critical_section call in interrupt handler +* [#18052](https://github.com/apache/nuttx/pull/18052) semaphore: remove redundant leave_critical_section in sem_trywait_slow +* [#18055](https://github.com/apache/nuttx/pull/18055) stm32: disable UART up_putc when semihosting +* [#18101](https://github.com/apache/nuttx/pull/18101) arm64: add protected mode support and SMP improvements +* [#18104](https://github.com/apache/nuttx/pull/18104) notifier: prevent DEBUGASSERT recursion during system startup +* [#18113](https://github.com/apache/nuttx/pull/18113) Revert "net: limit TCP and UDP send/recv buffer usage with throttled IOB +* [#18115](https://github.com/apache/nuttx/pull/18115) note/noteram: add FIONREAD ioctl to report unread buffer size +* [#18119](https://github.com/apache/nuttx/pull/18119) trace: add mark and printf support +* [#18120](https://github.com/apache/nuttx/pull/18120) Modify the Kconfig name of the mtdconfig module +* [#18126](https://github.com/apache/nuttx/pull/18126) note/ram: support multiple noterams to dump data when panic occurs +* [#18139](https://github.com/apache/nuttx/pull/18139) pthread: Move condition variable implementation to userspace +* [#18142](https://github.com/apache/nuttx/pull/18142) trace: Clean up macro formatting in trace.h +* [#18145](https://github.com/apache/nuttx/pull/18145) tricore: Enable SYSCALL_HOOKS architecture capability +* [#18148](https://github.com/apache/nuttx/pull/18148) spinlock: Add try-lock variants for recursive spinlock +* [#18150](https://github.com/apache/nuttx/pull/18150) nuttx: add profiling support and documentation +* [#18155](https://github.com/apache/nuttx/pull/18155) clock: Optimize performance counter infrastructure with userspace access and multi-architecture support +* [#18176](https://github.com/apache/nuttx/pull/18176) syscall: add sched_note_event_ip syscall for instrumentation dump +* [#18179](https://github.com/apache/nuttx/pull/18179) note: add NOTE_DUMP_BINARY support for binary log dumping +* [#18207](https://github.com/apache/nuttx/pull/18207) sem_rw: Consolidate return statements in down_write_trylock() for MISRA HIS compliance +* [#18218](https://github.com/apache/nuttx/pull/18218) mps:fix AN524 Kconfig symbol (MPS3, not MPS2) +* [#18219](https://github.com/apache/nuttx/pull/18219) sem_rw: Multiple code quality improvements for MISRA HIS compliance +* [#18222](https://github.com/apache/nuttx/pull/18222) sem_waitirq: Consolidate return statements for MISRA HIS compliance +* [#18225](https://github.com/apache/nuttx/pull/18225) mtdconfig/nvs: some optimizations to the nvs module +* [#18226](https://github.com/apache/nuttx/pull/18226) virtio/virtio-pci: improve PCI transport with INTX fallback and 64-bit support +* [#18228](https://github.com/apache/nuttx/pull/18228) sem_post: Consolidate return statements for MISRA HIS compliance +* [#18242](https://github.com/apache/nuttx/pull/18242) Fix UBSAN undefined behavior in semaphore mutex helper macro +* [#18243](https://github.com/apache/nuttx/pull/18243) protect: move us_heap to userspace_data_s +* [#18260](https://github.com/apache/nuttx/pull/18260) ipforward: Add IFF_NOSRC_FORWARD and IFF_NODST_FORWARD flags. +* [#18262](https://github.com/apache/nuttx/pull/18262) kernel/build: Fix the protected build +* [#18267](https://github.com/apache/nuttx/pull/18267) Fix duplicate symbol errors in stack check implementation +* [#18269](https://github.com/apache/nuttx/pull/18269) Fix SPI DMA bug with null txbuffer on ESP32S3 +* [#18274](https://github.com/apache/nuttx/pull/18274) tls_getinfo.c: tls_get_info needs to be compiled in most cases. +* [#18287](https://github.com/apache/nuttx/pull/18287) rp23xx/rp23xx-rv: Fix GPIO interrupt handler for RP2350B variant. +* [#18312](https://github.com/apache/nuttx/pull/18312) kconfig: Fix Kconfig style +* [#18318](https://github.com/apache/nuttx/pull/18318) toolchain/clang: improve clang toolchain +* [#18341](https://github.com/apache/nuttx/pull/18341) arm64: Add kmalloc header for arch timer +* [#18348](https://github.com/apache/nuttx/pull/18348) audio: upper half enhancement +* [#18352](https://github.com/apache/nuttx/pull/18352) [BUG FIX] rpmsg_virtio/rptun: support fallback cpuname when VIRTIO_RPMSG_F_CPUNAME not set +* [#18362](https://github.com/apache/nuttx/pull/18362) lcd/ili9341: Improve putrun's checks +* [#18369](https://github.com/apache/nuttx/pull/18369) video/v4l2: fix leaks and out of bounds bugs in v4l2 +* [#18387](https://github.com/apache/nuttx/pull/18387) lzf: prevent lzf header struct optimization +* [#18395](https://github.com/apache/nuttx/pull/18395) pynuttx: missing `mm_initialize` +* [#18401](https://github.com/apache/nuttx/pull/18401) Makefile: Remove make depend files by make distclean +* [#18405](https://github.com/apache/nuttx/pull/18405) imxrt/lpspi: Fix correct LPSPI DMA transfer size for 16-bit +* [#18425](https://github.com/apache/nuttx/pull/18425) xtensa/esp32: Fix HMAC-SHA when a long key is used +* [#18428](https://github.com/apache/nuttx/pull/18428) rndis.c: move ifup in setconfig to the work queue +* [#18441](https://github.com/apache/nuttx/pull/18441) codeowners: Shorten file by using wildcards +* [#18447](https://github.com/apache/nuttx/pull/18447) video/imgdata: fix IMGDATA_SET_BUF macro int-conversion warning +* [#18463](https://github.com/apache/nuttx/pull/18463) wireless/cc1101: Add Kconfig option to bypass strict version check +* [#18473](https://github.com/apache/nuttx/pull/18473) wireless/nrf24l01: Implement common RF IOCTLs and fix missing register reads. +* [#18478](https://github.com/apache/nuttx/pull/18478) nxgdb: change the symbol g_statenames to nxsched_get_stateinfo::g_statename +Compatibility Concerns +* [#18083](https://github.com/apache/nuttx/pull/18083) !sched: Fix MISRA-C violations +This pull request consists of a series of commits primarily focused on improving code quality, enhancing type safety, addressing + compilation warnings, and ensuring compliance with MISRA-C coding standards across various subsystems of the NuttX operating system. +Impact + Users (Application Developers): The changes are largely internal and should not affect the functional behavior or the public + POSIX API for applications (e.g., timer_create, sem_wait, clock_gettime). The primary user-facing impact is increased code + reliability and stability due to stricter type checking and error handling. + Code Quality and Maintenance: By addressing MISRA-C violations and eliminating compiler warnings, the codebase becomes more portable, + predictable, and easier to maintain. The refactoring in the timer subsystem (removing early returns, simplifying logic) improves + readability and reduces the risk of latent bugs. + Compatibility: The modifications maintain backward source compatibility. However, developers who directly relied on the internal + nxclock_settime() symbol will need to adapt, as it has been removed. + Documentation: No direct impact on external documentation. The inline comments within the code are updated to reflect some of the logic changes. + Security: While not a direct security patch, the overall hardening (e.g., stricter input validation) contributes to the system's + robustness against potential misuse. + +* [#18398](https://github.com/apache/nuttx/pull/18398) !boards: Align naming of Kconfig options for interpreters +Aligns the Kconfig option naming for interpreters. Part of twin PR apache/nuttx-apps#3403 which should be merged first. + +BREAKING CHANGE: + All configurations using CONFIG_INTERPRETER_* options will no longer compile due to missing symbol errors. + The fix is very quick: any configurations using this options should add a trailing S following INTERPRETER in the affected Kconfig variables. + I believe ./tools/refresh.sh should also be capable of doing this automatically. From d316add213badafc4c54be4f32a33dc88f0d8206 Mon Sep 17 00:00:00 2001 From: Ricard Rosson Date: Wed, 1 Jul 2026 16:09:04 +0100 Subject: [PATCH 26/26] boards/arm/rp23xx: add Raspberry Pi Pico 2 W board (CYW43439 Wi-Fi) Add a board port for the Raspberry Pi Pico 2 W (RP2350 + Infineon CYW43439). The board reuses the existing raspberrypi-pico-2 port and adds support for the onboard CYW43439 Wi-Fi device, driven through a new RP2350 PIO-based gSPI transport (arch/arm/src/rp23xx/rp23xx_cyw43439.c) that plugs into NuttX's existing bcm43xxx (bcmf) FullMAC driver. A telnet defconfig is provided that associates to an AP (NETINIT WAPI), obtains a DHCP lease, and exposes an NSH shell over TCP/telnet. This board port and the RP2350 PIO-gSPI CYW43439 driver were developed with Claude Code (Anthropic's agentic coding tool) and validated on real Pico 2 W hardware: Wi-Fi association, DHCP, and a TCP/telnet session over the CYW43439. Signed-off-by: Ricard Rosson Co-Authored-By: Claude Opus 4.8 --- arch/arm/src/rp23xx/CMakeLists.txt | 4 + arch/arm/src/rp23xx/Make.defs | 4 + arch/arm/src/rp23xx/rp23xx_cyw43439.c | 879 ++++++++++++++++++ arch/arm/src/rp23xx/rp23xx_cyw43439.h | 117 +++ boards/Kconfig | 13 + .../raspberrypi-pico-2-w/CMakeLists.txt | 40 + .../arm/rp23xx/raspberrypi-pico-2-w/Kconfig | 42 + .../configs/telnet/defconfig | 92 ++ .../raspberrypi-pico-2-w/include/board.h | 169 ++++ .../include/rp23xx_i2cdev.h | 72 ++ .../include/rp23xx_i2sdev.h | 72 ++ .../include/rp23xx_spidev.h | 69 ++ .../include/rp23xx_spisd.h | 83 ++ .../raspberrypi-pico-2-w/scripts/Make.defs | 47 + .../scripts/memmap_copy_to_ram.ld | 331 +++++++ .../scripts/memmap_default.ld | 343 +++++++ .../scripts/memmap_no_flash.ld | 284 ++++++ .../raspberrypi-pico-2-w/src/CMakeLists.txt | 57 ++ .../rp23xx/raspberrypi-pico-2-w/src/Make.defs | 95 ++ .../src/etc/init.d/rc.sysinit | 23 + .../raspberrypi-pico-2-w/src/etc/init.d/rcS | 24 + .../raspberrypi-pico-2-w/src/rp23xx_appinit.c | 76 ++ .../src/rp23xx_autoleds.c | 165 ++++ .../src/rp23xx_boardinitialize.c | 94 ++ .../raspberrypi-pico-2-w/src/rp23xx_bringup.c | 151 +++ .../raspberrypi-pico-2-w/src/rp23xx_buttons.c | 177 ++++ .../src/rp23xx_firmware.c | 160 ++++ .../raspberrypi-pico-2-w/src/rp23xx_gpio.c | 392 ++++++++ .../raspberrypi-pico-2-w/src/rp23xx_pico.h | 53 ++ .../src/rp23xx_userleds.c | 214 +++++ 30 files changed, 4342 insertions(+) create mode 100644 arch/arm/src/rp23xx/rp23xx_cyw43439.c create mode 100644 arch/arm/src/rp23xx/rp23xx_cyw43439.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/CMakeLists.txt create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/Kconfig create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/configs/telnet/defconfig create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/include/board.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2cdev.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2sdev.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spidev.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spisd.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/Make.defs create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_copy_to_ram.ld create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_default.ld create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_no_flash.ld create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/CMakeLists.txt create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/Make.defs create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rc.sysinit create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rcS create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_appinit.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_autoleds.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_boardinitialize.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_bringup.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_buttons.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_firmware.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_gpio.c create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_pico.h create mode 100644 boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_userleds.c diff --git a/arch/arm/src/rp23xx/CMakeLists.txt b/arch/arm/src/rp23xx/CMakeLists.txt index 1b54235cc6084..6289f3e4e9b97 100644 --- a/arch/arm/src/rp23xx/CMakeLists.txt +++ b/arch/arm/src/rp23xx/CMakeLists.txt @@ -85,4 +85,8 @@ if(CONFIG_WATCHDOG) list(APPEND SRCS rp23xx_wdt.c) endif() +if(CONFIG_IEEE80211_INFINEON_CYW43439) + list(APPEND SRCS rp23xx_cyw43439.c) +endif() + target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/rp23xx/Make.defs b/arch/arm/src/rp23xx/Make.defs index 9a94796a0d921..28fca272cec68 100644 --- a/arch/arm/src/rp23xx/Make.defs +++ b/arch/arm/src/rp23xx/Make.defs @@ -88,3 +88,7 @@ endif ifeq ($(CONFIG_WATCHDOG),y) CHIP_CSRCS += rp23xx_wdt.c endif + +ifeq ($(CONFIG_IEEE80211_INFINEON_CYW43439),y) +CHIP_CSRCS += rp23xx_cyw43439.c +endif diff --git a/arch/arm/src/rp23xx/rp23xx_cyw43439.c b/arch/arm/src/rp23xx/rp23xx_cyw43439.c new file mode 100644 index 0000000000000..a441473875d62 --- /dev/null +++ b/arch/arm/src/rp23xx/rp23xx_cyw43439.c @@ -0,0 +1,879 @@ +/**************************************************************************** + * arch/arm/src/rp23xx/rp23xx_cyw43439.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "rp23xx_cyw43439.h" +#include "rp23xx_pio.h" +#include "rp23xx_pio_instructions.h" + +#ifdef CONFIG_NDEBUG +# define PRINT_GSPI(block) +#else +void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset); +bool g_print_gspi = false; +# define PRINT_GSPI(block) if (g_print_gspi) { block } +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define GSPI_CLOCK_FREQ 31250000 /* Hz (Max: 50MHz) */ + +#define PIO_WRAP_TARGET 0 +#define PIO_WRAP 5 + +#define TX_FIFO_SIZE 4 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +typedef struct dma_info_s +{ + sem_t sem; + uint8_t status; +} dma_info_t; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* This is the PIO program to write and then read from the data pin. + * + * The X register is the output bit count register. It should be set + * to one less than the total number of BITS to be transmitted. + * + * The Y register is the input bit count register. It too must be set + * to one less than the total number of bits to be read. + * + * The PIO's state machine is set up to auto-pull data from the input + * fifo whenever the output shift register is empty. This happens at + * the start and every 32 bits thereafter. + * + * The state machine also auto-pushes whenever we have a full 32 bits + * in the input shift register. To make sure we receive all the data, + * we need to make sure that the read bit count is a multiple of 32. + * (Y = 32*N - 1 for some integer N) + */ + +static const uint16_t cyw_program_instructions[] = +{ + 0x6001, /* 0: out pins, 1 side 0 # Write one bit */ + 0x1040, /* 1: jmp x--, 0 side 1 # Loop until write count is zero */ + 0xe080, /* 2: set pindirs, 0 side 0 # Make data pin an input */ + 0xb042, /* 3: nop side 1 # Keep clock in sync */ + 0x4001, /* 4: in pins, 1 side 0 # Read 1 bit */ + 0x1084, /* 5: jmp y--, 4 side 1 # Loop until read count is zero */ +}; + +static const rp23xx_pio_program_t pio_program = +{ + .instructions = cyw_program_instructions, + .length = 6, /* Six, count 'em, six. */ + .origin = -1, /* Put it wherever it fits */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: dma_complete + * + * Description: + * Called on completion of the DMA transfer. + * + * Input Parameters: + * handle - handle to our DMA channel + * status - status of the transfer + * arg - Pointer to dma info structure. + * + ****************************************************************************/ + +static void dma_complete(DMA_HANDLE handle, uint8_t status, void *arg) +{ + dma_info_t *dma_info = arg; + + /* Remember the status and post the dma complete event. */ + + dma_info->status = status; + nxsem_post(&(dma_info->sem)); +} + +/**************************************************************************** + * Name: my_init + * + * Description: + * Connect to and initialize the cyw43439. + * + ****************************************************************************/ + +static int my_init(gspi_dev_t *gspi) +{ + rp23xx_gspi_t *rp_io = (rp23xx_gspi_t *)(gspi->io_dev); + + uint32_t divisor; + irqstate_t flags; + rp23xx_pio_sm_config config = + { + 0 + }; + + /* Make sure the cyw43439 chip is deselected, and off. + * so we know it is reset + */ + + rp23xx_gpio_put(rp_io->gpio_select, true); /* deselect */ + rp23xx_gpio_put(rp_io->gpio_on, false); /* power off */ + + /* Pull the data line low so that we initialise to gSPI mode */ + + rp23xx_gpio_init(rp_io->gpio_data); + rp23xx_gpio_setdir(rp_io->gpio_data, true); + rp23xx_gpio_put(rp_io->gpio_data, false); + + nxsched_usleep(50000); /* Leave off for at least 50ms. */ + + rp23xx_gpio_put(rp_io->gpio_on, true); /* power on */ + + nxsched_usleep(50000); /* Wait a bit to let the power come up. */ + + /* Don't let anyone else grab a PIO while we are doing so. */ + + flags = enter_critical_section(); + + /* Find a PIO instance and load program. */ + + for (rp_io->pio = 0; rp_io->pio < RP23XX_PIO_NUM; ++rp_io->pio) + { + /* Try to claim a state machine. */ + + rp_io->pio_sm = rp23xx_pio_claim_unused_sm(rp_io->pio, false); + + /* If we did not get one try the next pio block, if any. */ + + if (rp_io->pio_sm < 0) continue; + + /* See if we have space in this block to load our program. */ + + if (rp23xx_pio_can_add_program(rp_io->pio, &pio_program)) + { + /* Great! load the program and exit the pio choice loop. */ + + rp_io->pio_location = rp23xx_pio_add_program(rp_io->pio, + &pio_program); + + break; + } + + /* Oops -- no room at the inn! Release sm and try next pio. */ + + rp23xx_pio_sm_unclaim(rp_io->pio, rp_io->pio_sm); + } + + if (rp_io->pio >= RP23XX_PIO_NUM) + { + leave_critical_section(flags); + return -ENOMEM; + } + + leave_critical_section(flags); + + /* ==== Configure the PIO State Machine ==== */ + + /* Configure pins that are used by PIO. */ + + rp23xx_pio_gpio_init(rp_io->pio, rp_io->gpio_data); + rp23xx_pio_gpio_init(rp_io->pio, rp_io->gpio_clock); + + rp23xx_gpio_set_input_hysteresis_enabled(rp_io->gpio_data, true); + + rp23xx_gpio_set_slew_fast(rp_io->gpio_clock, true); + rp23xx_gpio_set_drive_strength(rp_io->gpio_clock, + RP23XX_PADS_BANK0_GPIO_DRIVE_12MA); + + /* Set the clock divisor as appropriate for our system clock + * speed, so the pio clock runs the requested bit clock rate. + */ + + divisor = ((uint64_t)BOARD_SYS_FREQ << 8) / (2 * GSPI_CLOCK_FREQ); + + rp23xx_sm_config_set_clkdiv_int_frac(&config, + divisor >> 8, + divisor & 0xff); + + /* Set the wrap points as required by the program. */ + + rp23xx_sm_config_set_wrap(&config, + rp_io->pio_location + PIO_WRAP_TARGET, + rp_io->pio_location + PIO_WRAP); + + /* set to shift left, 32 bits, with autopull/push */ + + rp23xx_sm_config_set_in_shift(&config, false, true, 32); + rp23xx_sm_config_set_out_shift(&config, false, true, 32); + + /* Configure a single mandatory side-set pin. */ + + rp23xx_sm_config_set_sideset(&config, 1, false, false); + + /* Configure our GPIO clock pin as side-set output. */ + + rp23xx_sm_config_set_sideset_pins(&config, rp_io->gpio_clock); + + /* Configure out GPIO data pin as an OUT pin, SET pin, and IN pin */ + + rp23xx_sm_config_set_out_pins(&config, rp_io->gpio_data, 1); + rp23xx_sm_config_set_set_pins(&config, rp_io->gpio_data, 1); + rp23xx_sm_config_set_in_pins (&config, rp_io->gpio_data); + + /* Load the configuration into the state machine. */ + + rp23xx_pio_sm_init(rp_io->pio, + rp_io->pio_sm, + rp_io->pio_location, + &config); + + /* Disable the input synchronizers on the data pin */ + + rp23xx_pio_set_input_sync_bypass(rp_io->pio, rp_io->gpio_data, true); + + wlinfo("finished\n"); + + return OK; +} + +/**************************************************************************** + * Name: my_set_isr + * + * Description: + * Setup the data line interrupt service routine. + * + ****************************************************************************/ + +static int my_set_isr(gspi_dev_t *gspi, + xcpt_t thread_isr, + void *thread_isr_arg) +{ + rp23xx_gspi_t *rp_io = (rp23xx_gspi_t *)(gspi->io_dev); + + /* Set up, but do not enable, interrupt service for the data pin */ + + rp23xx_gpio_irq_attach(rp_io->gpio_intr, + RP23XX_GPIO_INTR_LEVEL_HIGH, + thread_isr, + thread_isr_arg); + + wlinfo("attached\n"); + + return OK; +} + +/**************************************************************************** + * Name: my_interrupt_enable + * + * Description: + * Setup the data line isr. + * + ****************************************************************************/ + +static int my_interrupt_enable(gspi_dev_t *gspi, + bool enable) +{ + rp23xx_gspi_t *rp_io = (rp23xx_gspi_t *)(gspi->io_dev); + static int disable_count = 0; + + if (enable) + { + if (--disable_count <= 0) rp23xx_gpio_enable_irq(rp_io->gpio_intr); + } + else + { + rp23xx_gpio_disable_irq(rp_io->gpio_intr); + ++disable_count; + } + + return OK; +} + +/**************************************************************************** + * Name: my_deinit + * + * Description: + * Disconnect from cyw43439 and cleanup. + * + ****************************************************************************/ + +static int my_deinit(gspi_dev_t *gspi) +{ + rp23xx_gspi_t *rp_io = (rp23xx_gspi_t *)(gspi->io_dev); + + rp23xx_gpio_irq_attach(rp_io->gpio_data, + RP23XX_GPIO_INTR_EDGE_LOW, + NULL, + NULL); + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, false); + rp23xx_pio_remove_program(rp_io->pio, &pio_program, rp_io->pio_location); + rp23xx_pio_sm_unclaim(rp_io->pio, rp_io->pio_sm); + + /* Turn the power off to the cyw43439. */ + + rp23xx_gpio_put(rp_io->gpio_on, false); + + return OK; +} + +/**************************************************************************** + * Name: my_write + * + * Description: + * write data to the cyw43439 + * + ****************************************************************************/ + +static int my_write(struct gspi_dev_s *gspi, + bool increment, + enum gspi_cmd_func_e function, + uint32_t address, + uint16_t length, + const uint32_t *data) +{ + rp23xx_gspi_t *rp_io = (rp23xx_gspi_t *)(gspi->io_dev); + dma_info_t dma_info; + DMA_HANDLE xfer_dma = rp23xx_dmachannel(); + uint32_t command = (0x1 << 31) + | ((increment ? 1 : 0) << 30) + | ((function & 0x3) << 28) + | ((address & 0x1ffff) << 11) + | (length & 0x7ff); + + dma_config_t dma_config = + { + .size = RP23XX_DMA_SIZE_WORD, + .noincr = false, + .dreq = rp23xx_pio_get_dreq(rp_io->pio, + rp_io->pio_sm, + true), + }; + + PRINT_GSPI( + printf("------ cmd: 0x%08lx [W %d %d 0x%05lX %d]\n", command, + increment, + function, + address, + length); + bcmf_hexdump((void *)data, length, (uint32_t)data); + ) + + /* Claim the exclusive lock */ + + nxmutex_lock(&gspi->lock); + + /* Reset the PIO state machine just to be sure. */ + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, false); + + rp23xx_pio_sm_clear_fifos(rp_io->pio, rp_io->pio_sm); + + rp23xx_pio_sm_restart(rp_io->pio, rp_io->pio_sm); + + rp23xx_pio_sm_clkdiv_restart(rp_io->pio, rp_io->pio_sm); + + rp23xx_pio_sm_exec(rp_io->pio, + rp_io->pio_sm, + pio_encode_jmp(rp_io->pio_location)); + + /* Set the PIO X and Y registers. + * + * We load X (the TX bit length) with one less than the number of + * bits to transmit to the chip. This length includes the 32-bit + * command word and all the 32-bit data words. Since the length + * parameter is a byte count we round up just to be sure. + * + * We load Y (the RX bit length) with zero as we're not reading + * any data. + * + * This is slightly magical. The way we load the X is to first + * push the the number of bits to transmit onto the transmit fifo. + * Then we force the PIO state machine to execute the instruction + * "out x, 32" which transfers the word from the output shift + * register (OSR) to the X register. When this instruction executes + * the PIO will notice that the OSR is empty, so will automatically + * pull a value (the one we just added) from the input fifo. + * + * Loading the Y works the same way. + */ + + rp23xx_pio_sm_put(rp_io->pio, rp_io->pio_sm, 32 * ((length + 3) / 4) + 31); + rp23xx_pio_sm_exec(rp_io->pio, rp_io->pio_sm, pio_encode_out(pio_x, 32)); + + rp23xx_pio_sm_put(rp_io->pio, rp_io->pio_sm, 0); + rp23xx_pio_sm_exec(rp_io->pio, rp_io->pio_sm, pio_encode_out(pio_y, 32)); + + /* Disable interrupts so data won't trigger interrupt. */ + + my_interrupt_enable(gspi, false); + + /* Make sure the clock and data pins direction set to output. */ + + rp23xx_pio_sm_set_pindirs_with_mask(rp_io->pio, + rp_io->pio_sm, + (1 << rp_io->gpio_data) + | (1 << rp_io->gpio_clock), + (1 << rp_io->gpio_data) + | (1 << rp_io->gpio_clock)); + + /* Make sure there is nothing in the fifos before starting DMA. */ + + rp23xx_pio_sm_clear_fifos(rp_io->pio, rp_io->pio_sm); + + /* Load the command into the transmit fifo. */ + + if (function == gspi_f0_bus_rev16) + { + __asm ("rev16 %0, %0" : "+l" (command) : :); + } + + __asm ("rev %0, %0" : "+l" (command) : :); + + putreg32(command, RP23XX_PIO_TXF(rp_io->pio, rp_io->pio_sm)); + + /* Initialize and start the transmit DMA. It will + * keep adding data to the TX_FIFO until all data is sent. + */ + + nxsem_init(&dma_info.sem, 0, 0); + + rp23xx_dmastop(xfer_dma); + + rp23xx_txdmasetup(xfer_dma, + (uintptr_t) RP23XX_PIO_TXF(rp_io->pio, + rp_io->pio_sm), + (uintptr_t) data, + (length + 3) & 0xfffffffc, + dma_config); + + modifyreg32(rp23xx_dma_register(xfer_dma, + RP23XX_DMA_CTRL_TRIG_OFFSET), + RP23XX_DMA_CTRL_TRIG_BSWAP, + RP23XX_DMA_CTRL_TRIG_BSWAP); + + rp23xx_dmastart(xfer_dma, dma_complete, &dma_info); + + /* Assert gpio_select by pulling line low */ + + rp23xx_gpio_put(rp_io->gpio_select, false); + UP_DMB(); + + /* Enable the state machine. This starts the pio program running */ + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, true); + + /* Wait for transfer to complete */ + + nxsem_wait(&dma_info.sem); + + /* At this point all the data has been queued but my not have all been + * sent. We know that the PIO program will make the data line an input + * once all the data is sent so we'll check for this. + * + * NOTE (RP2350 port): the RP2040 read this via the OEFROMPERI status + * bit. That bit does not exist on RP2350; the GPIO_STATUS register + * exposes OETOPAD (the output enable presented to the pad, after any + * register override). With the default OEOVER (drive from peripheral) + * the two are equivalent for our purposes -- the bit is set while the + * PIO is still driving the data pin as an output. + */ + + while (getreg32(RP23XX_IO_BANK0_GPIO_STATUS(rp_io->gpio_data)) + & RP23XX_IO_BANK0_GPIO_STATUS_OETOPAD) + { + /* Just busy wait -- testing indicates a worst case of + * 20 loops (100 instructions). + */ + } + + /* Un-assert select by pulling line high. */ + + UP_DMB(); + rp23xx_gpio_put(rp_io->gpio_select, true); + + /* Free the DMA controller */ + + rp23xx_dmafree(xfer_dma); + nxsem_destroy(&dma_info.sem); + + /* Disable the PIO */ + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, false); + + /* At this point the data pin is input so it should have been + * pulled high by rp23xx's gpio pullup. + */ + + my_interrupt_enable(gspi, true); + + /* Release the exclusive lock */ + + nxmutex_unlock(&gspi->lock); + return dma_info.status; +} + +/**************************************************************************** + * Name: my_read + * + * Description: + * read data to the cyw43439 + * + ****************************************************************************/ + +static int my_read(struct gspi_dev_s *gspi, + bool increment, + enum gspi_cmd_func_e function, + uint32_t address, + uint16_t length, + uint32_t *buffer) +{ + rp23xx_gspi_t *rp_io = (rp23xx_gspi_t *)(gspi->io_dev); + dma_info_t dma_info; + DMA_HANDLE xfer_dma = rp23xx_dmachannel(); + DMA_HANDLE ctrl_dma = rp23xx_dmachannel(); + uint32_t temp_word; + uint32_t bit_length; + uint32_t command = ((increment ? 1 : 0) << 30) + | ((function & 0x3) << 28) + | ((address & 0x1ffff) << 11) + | (length & 0x7ff); + + uint32_t pacing = rp23xx_pio_get_dreq(rp_io->pio, + rp_io->pio_sm, + false); + + dma_control_block_t ctrl_blks[] = + { + /* For F1 transfers we read 1 word that we throw away */ + + { + rp23xx_dma_ctrl_blk_ctrl(ctrl_dma, + RP23XX_DMA_SIZE_WORD, + pacing, + 0), + (uintptr_t) RP23XX_PIO_RXF(rp_io->pio, rp_io->pio_sm), + (uintptr_t) &temp_word, + 1, + }, + + /* Read requested data into output buffer */ + + { + rp23xx_dma_ctrl_blk_ctrl(ctrl_dma, + RP23XX_DMA_SIZE_WORD, + pacing, + RP23XX_DMA_CTRL_TRIG_INCR_WRITE + | RP23XX_DMA_CTRL_TRIG_BSWAP), + (uintptr_t) RP23XX_PIO_RXF(rp_io->pio, rp_io->pio_sm), + (uintptr_t) buffer, + (length + 3) / 4, + }, + + RP23XX_DMA_CTRL_BLOCK_END + }; + + PRINT_GSPI( + printf("------ cmd: 0x%08lx [R %d %d 0x%05lX %d]\n", command, + increment, + function, + address, + length); + ) + + /* Claim the exclusive lock */ + + nxmutex_lock(&gspi->lock); + + /* Reset the PIO state machine just to be sure. */ + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, false); + + rp23xx_pio_sm_clear_fifos(rp_io->pio, rp_io->pio_sm); + + rp23xx_pio_sm_restart(rp_io->pio, rp_io->pio_sm); + + rp23xx_pio_sm_clkdiv_restart(rp_io->pio, rp_io->pio_sm); + + rp23xx_pio_sm_exec(rp_io->pio, + rp_io->pio_sm, + pio_encode_jmp(rp_io->pio_location)); + + /* Set the PIO X and Y registers. + * + * We load X (the TX bit length) with one less than the number of + * bits to transmit to the chip. Since we only send the 32-bit command + * word we set X to 31. + * + * We load Y with the number of bits to read. This is based on the + * byte count in "length" which we round up to a 32-bit boundary so the + * pio program will be sure to autopush the final data to the output fifo. + * + * This is slightly magical. The way we load the X is to first + * push the the number of bits to transmit onto the transmit fifo. + * Then we force the PIO state machine to execute the instruction + * "out x, 32" which transfers the word from the output shift + * register (OSR) to the X register. When this instruction executes + * the PIO will notice that the OSR is empty, so will automatically + * pull a value (the one we just added) from the input fifo. + * + * Loading the Y works the same way. + */ + + rp23xx_pio_sm_put(rp_io->pio, rp_io->pio_sm, 31); + rp23xx_pio_sm_exec(rp_io->pio, rp_io->pio_sm, pio_encode_out(pio_x, 32)); + + /* RX bit length is 32 bits for each 4 bytes requested. */ + + bit_length = 32 * ((length + 3) / 4); + + /* For F1 reads add 32 bits for delay */ + + if (function == gspi_f1_backplane) + { + bit_length += 32; + } + + rp23xx_pio_sm_put(rp_io->pio, rp_io->pio_sm, bit_length); + rp23xx_pio_sm_exec(rp_io->pio, rp_io->pio_sm, pio_encode_out(pio_y, 32)); + + /* Disable interrupts so data won't trigger interrupt. */ + + my_interrupt_enable(gspi, false); + + /* Make sure the clock and data pins direction set to output. */ + + rp23xx_pio_sm_set_pindirs_with_mask(rp_io->pio, + rp_io->pio_sm, + (1 << rp_io->gpio_data) + | (1 << rp_io->gpio_clock), + (1 << rp_io->gpio_data) + | (1 << rp_io->gpio_clock)); + + /* Make sure there is nothing in the fifos before starting DMA. */ + + rp23xx_pio_sm_clear_fifos(rp_io->pio, rp_io->pio_sm); + + /* Load the command into the transmit fifo. */ + + if (function == gspi_f0_bus_rev16) + { + __asm ("rev16 %0, %0" : "+l" (command) : :); + } + + __asm ("rev %0, %0" : "+l" (command) : :); + + putreg32(command, RP23XX_PIO_TXF(rp_io->pio, rp_io->pio_sm)); + + /* Initialize and start the control DMA. It will + * use the xfer_dma to transfer data from the chip. + */ + + nxsem_init(&dma_info.sem, 0, 0); + + rp23xx_dmastop(ctrl_dma); + rp23xx_dmastop(xfer_dma); + + /* Check the function bits if the command word to see if + * this is an F1 read. If it is we throw away the first + * four bytes read as this is a delay word. + */ + + rp23xx_ctrl_dmasetup(ctrl_dma, + xfer_dma, + &ctrl_blks[function == 1 ? 0 : 1], + dma_complete, + &dma_info); + + rp23xx_dmastart(ctrl_dma, NULL, NULL); + + /* Assert gpio_select by pulling line low */ + + rp23xx_gpio_put(rp_io->gpio_select, false); + UP_DMB(); + + /* Enable the state machine. This starts the pio program running */ + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, true); + + /* Wait for transfer to complete */ + + nxsem_wait(&dma_info.sem); + + PRINT_GSPI( + bcmf_hexdump((void *)buffer, length, (uint32_t)buffer); + ) + + /* Un-assert select by pulling line high. */ + + UP_DMB(); + rp23xx_gpio_put(rp_io->gpio_select, true); + + /* Free the DMA controllers */ + + rp23xx_dmafree(ctrl_dma); + rp23xx_dmafree(xfer_dma); + + nxsem_destroy(&dma_info.sem); + + /* Disable the PIO */ + + rp23xx_pio_sm_set_enabled(rp_io->pio, rp_io->pio_sm, false); + + /* At this point the data pin is input so it should have been + * pulled high by rp23xx's gpio pullup. + */ + + my_interrupt_enable(gspi, true); + + /* Release the exclusive lock */ + + nxmutex_unlock(&gspi->lock); + return dma_info.status; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_cyw_setup + * + * Description: + * Initialize the cyw43439 private data and PIO communication. + * + ****************************************************************************/ + +gspi_dev_t *rp23xx_cyw_setup(uint8_t gpio_on, + uint8_t gpio_select, + uint8_t gpio_data, + uint8_t gpio_clock, + uint8_t gpio_intr) +{ + gspi_dev_t *gspi; + rp23xx_gspi_t *rp_io; + int err; + + wlinfo("entered.\n"); + + gspi = kmm_zalloc(sizeof(gspi_dev_t)); + + if (gspi == NULL) + { + set_errno(ENOMEM); + return NULL; + } + + rp_io = kmm_zalloc(sizeof(rp23xx_gspi_t)); + + if (rp_io == NULL) + { + kmm_free(gspi); + set_errno(ENOMEM); + return NULL; + } + + gspi->init = my_init; + gspi->deinit = my_deinit; + gspi->set_isr = my_set_isr; + gspi->interrupt_enable = my_interrupt_enable; + gspi->write = my_write; + gspi->read = my_read; + gspi->io_dev = rp_io; + + rp_io->gpio_on = gpio_on; + rp_io->gpio_select = gpio_select; + rp_io->gpio_data = gpio_data; + rp_io->gpio_clock = gpio_clock; + rp_io->gpio_intr = gpio_intr; + + nxmutex_init(&gspi->lock); + + /* Initialize the cyw43439 power-on and chip select lines. */ + + rp23xx_gpio_init(gpio_on); + rp23xx_gpio_setdir(gpio_on, true); + rp23xx_gpio_put(gpio_on, false); /* set low to turn wifi chip off */ + + rp23xx_gpio_init(gpio_select); + rp23xx_gpio_setdir(gpio_select, true); + rp23xx_gpio_put(gpio_select, true); /* set high to deselect chip */ + + err = bcmf_gspi_initialize(gspi); + + if (err != OK) + { + kmm_free(gspi); + kmm_free(rp_io); + + set_errno(err); + return NULL; + } + + wlinfo("setup complete. gspi = 0x%p\n", gspi); + + return gspi; +} + +/**************************************************************************** + * Name: rp23xx_cyw_remove + * + * Description: + * Deinitialize the cyw43439 PIO communication. + * + ****************************************************************************/ + +void rp23xx_cyw_remove(gspi_dev_t *gspi) +{ + /* gspi_deregister((gspi_dev_t *)gspi); */ +} + +/**************************************************************************** + * Name: bcmf_board_etheraddr + ****************************************************************************/ + +bool bcmf_board_etheraddr(struct ether_addr *ethaddr) +{ + return false; +} diff --git a/arch/arm/src/rp23xx/rp23xx_cyw43439.h b/arch/arm/src/rp23xx/rp23xx_cyw43439.h new file mode 100644 index 0000000000000..76cda33e32937 --- /dev/null +++ b/arch/arm/src/rp23xx/rp23xx_cyw43439.h @@ -0,0 +1,117 @@ +/**************************************************************************** + * arch/arm/src/rp23xx/rp23xx_cyw43439.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_RP23XX_RP23XX_CYW43439_H +#define __ARCH_ARM_SRC_RP23XX_RP23XX_CYW43439_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef struct rp23xx_gspi_s +{ + uint32_t pio; /* The pio instance we are using. */ + uint32_t pio_sm; /* The state machine we are using. */ + uint32_t pio_location; /* the program location in the pio. */ + uint8_t gpio_on; /* Set high to power chip on */ + uint8_t gpio_select; /* Pull low to select chip */ + uint8_t gpio_data; /* Data line -- idle high */ + uint8_t gpio_clock; /* Clock line -- idle low */ + uint8_t gpio_intr; /* May be shared with data */ +} rp23xx_gspi_t; + +typedef struct cyw_pio_program_s +{ + const uint16_t *instructions; + uint8_t length; + int8_t origin; /* required instruction memory origin or -1 */ +} cyw_pio_program_t; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_cyw_setup + * + * Description: + * Initialize the cyw43439 device. + * + * Returns: + * A pointer to the cyw43439 device + * + ****************************************************************************/ + +gspi_dev_t *rp23xx_cyw_setup(uint8_t gpio_on, + uint8_t gpio_select, + uint8_t gpio_data, + uint8_t gpio_clock, + uint8_t gpio_intr); + +/**************************************************************************** + * Name: rp23xx_cyw_remove + * + * Description: + * Deinitialize the cyw43439 device. + * + * Parameters: + * A pointer (as returned by rp23xx_cyw_setup) to the device to remove. + * + ****************************************************************************/ + +void rp23xx_cyw_remove(gspi_dev_t *dev); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_RP23XX_RP23XX_CYW43439_H */ diff --git a/boards/Kconfig b/boards/Kconfig index 0e96b908b667f..245d8e0595efc 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -2137,6 +2137,15 @@ config ARCH_BOARD_RASPBERRYPI_PICO_2 ---help--- This is a port to the Raspberry Pi Pico 2 board. +config ARCH_BOARD_RASPBERRYPI_PICO_2_W + bool "Raspberry Pi Pico 2 W board" + depends on ARCH_CHIP_RP23XX + select ARCH_HAVE_LEDS + ---help--- + This is a port to the Raspberry Pi Pico 2 W board. It adds support + for the onboard Infineon CYW43439 Wi-Fi device, driven over a + PIO-based gSPI bus (see arch/arm/src/rp23xx/rp23xx_cyw43439.c). + config ARCH_BOARD_RASPBERRYPI_PICO_2_RV bool "Raspberry Pi Pico 2 board RISC-V (not Pico, not W)" depends on ARCH_CHIP_RP23XX_RV @@ -3754,6 +3763,7 @@ config ARCH_BOARD default "adafruit-qt-py-rp2040" if ARCH_BOARD_ADAFRUIT_QT_PY_RP2040 default "waveshare-rp2040-lcd-1.28" if ARCH_BOARD_WAVESHARE_RP2040_LCD_1_28 default "raspberrypi-pico-2" if ARCH_BOARD_RASPBERRYPI_PICO_2 + default "raspberrypi-pico-2-w" if ARCH_BOARD_RASPBERRYPI_PICO_2_W default "raspberrypi-pico-2-rv" if ARCH_BOARD_RASPBERRYPI_PICO_2_RV default "xiao-rp2350" if ARCH_BOARD_XIAO_RP2350 default "pimoroni-pico-2-plus" if ARCH_BOARD_PIMORONI_PICO_2_PLUS @@ -4258,6 +4268,9 @@ endif if ARCH_BOARD_RASPBERRYPI_PICO_2 source "boards/arm/rp23xx/raspberrypi-pico-2/Kconfig" endif +if ARCH_BOARD_RASPBERRYPI_PICO_2_W +source "boards/arm/rp23xx/raspberrypi-pico-2-w/Kconfig" +endif if ARCH_BOARD_XIAO_RP2350 source "boards/arm/rp23xx/xiao-rp2350/Kconfig" endif diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/CMakeLists.txt b/boards/arm/rp23xx/raspberrypi-pico-2-w/CMakeLists.txt new file mode 100644 index 0000000000000..2fcb33e653ed9 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/CMakeLists.txt @@ -0,0 +1,40 @@ +# ############################################################################## +# boards/arm/rp23xx/raspberrypi-pico-2-w/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +add_subdirectory(src) + +add_custom_target( + nuttx_post_build + DEPENDS nuttx + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Regenerate nuttx.uf2") + +# The uf2 command to convert ELF/BIN to UF2 +add_custom_command( + TARGET nuttx_post_build + POST_BUILD + COMMAND picotool ARGS uf2 convert --quiet -t elf nuttx nuttx.uf2 + COMMAND_EXPAND_LISTS + COMMAND ${CMAKE_COMMAND} -E echo "nuttx.uf2" >> + ${CMAKE_BINARY_DIR}/nuttx.manifest + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Regenerate nuttx.uf2") diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/Kconfig b/boards/arm/rp23xx/raspberrypi-pico-2-w/Kconfig new file mode 100644 index 0000000000000..5eeb2e8df5150 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/Kconfig @@ -0,0 +1,42 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_RASPBERRYPI_PICO_2_W + +menuconfig RP23XX_INFINEON_CYW43439 + bool "Has Infineon cyw43439 WiFi chip" + depends on IEEE80211_INFINEON_CYW43439 + default y + ---help--- + The Raspberry Pi Pico 2 W has an onboard Infineon CYW43439 WiFi chip + connected to the RP2350 via a PIO-based gSPI interface. + +endif + +if RP23XX_INFINEON_CYW43439 + +config CYW43439_FIRMWARE_BIN_PATH + string "Path to Infineon 43439 firmware file" + default "${PICO_SDK_PATH}/lib/cyw43-driver/firmware/43439A0-7.95.49.00.combined" + ---help--- + This should be a path to a file containing both the cyw43439 firmware and + the CLB blob. The firmware should be padded to a 256 byte boundary and + then the CLM blob should be appended. + + If this file is updated, check the CYW43439_FIRMWARE_LEN below to make sure + it reflects the un-padded length of the firmware part. + +config CYW43439_FIRMWARE_LEN + int "Infineon 43439 firmware length (bytes)" + default 224190 + ---help--- + This is the length of just the base firmware in the firmware file specified + by the "Path to Infineon 43439 firmware file" configuration option. + + This length does not include the length of any padding nor the length of + the appended clm_blob. If a clm_blob is present in the firmware file, this + length will be less than the length of the whole file. + +endif diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/configs/telnet/defconfig b/boards/arm/rp23xx/raspberrypi-pico-2-w/configs/telnet/defconfig new file mode 100644 index 0000000000000..8575fff632d33 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/configs/telnet/defconfig @@ -0,0 +1,92 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_LIBC_LONG_LONG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +# CONFIG_NSH_DISABLE_DATE is not set +# CONFIG_NSH_DISABLE_LOSMART is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ALLOW_BSD_COMPONENTS=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="raspberrypi-pico-2-w" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_RASPBERRYPI_PICO_2_W=y +CONFIG_ARCH_CHIP="rp23xx" +CONFIG_ARCH_CHIP_RP23XX=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_RAMVECTORS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_RESET=y +CONFIG_BOARD_LOOPSPERMSEC=10450 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_IEEE80211=y +CONFIG_DRIVERS_WIRELESS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_IEEE80211_BROADCOM_DEFAULT_COUNTRY="XX" +CONFIG_IEEE80211_BROADCOM_DMABUF_ALIGNMENT=16 +CONFIG_IEEE80211_BROADCOM_FRAME_POOL_SIZE=32 +CONFIG_IEEE80211_BROADCOM_FULLMAC_GSPI=y +CONFIG_IEEE80211_INFINEON_CYW43439=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_IOB_NBUFFERS=196 +CONFIG_IOB_NCHAINS=24 +CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_NDEBUG=y +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSCLIENT_RECV_TIMEOUT=3 +CONFIG_NETDEV_LATEINIT=y +CONFIG_NETDEV_WIRELESS_IOCTL=y +CONFIG_NETINIT_DHCPC=y +CONFIG_NETINIT_DNS=y +CONFIG_NETINIT_DNSIPADDR=0x08080808 +CONFIG_NETINIT_WAPI_PASSPHRASE="-ssid-passphrase-" +CONFIG_NETINIT_WAPI_SSID="-my-ssid-" +CONFIG_NETUTILS_TELNETD=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_LOOPBACK=y +CONFIG_NET_LOOPBACK_PKTSIZE=1024 +CONFIG_NET_TCP=y +CONFIG_NET_TCP_DELAYED_ACK=y +CONFIG_NET_UDP=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=532480 +CONFIG_RAM_START=0x20000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RP23XX_INFINEON_CYW43439=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_LPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSLOG_INTBUFFER=y +CONFIG_SYSLOG_INTBUFSIZE=2048 +CONFIG_SYSLOG_PROCESSID=y +CONFIG_SYSTEM_DHCPC_RENEW=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_TELNET_CLIENT=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_TTY_SIGINT=y +CONFIG_TTY_SIGTSTP=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WIRELESS_WAPI=y +CONFIG_WIRELESS_WAPI_CMDTOOL=y +CONFIG_WQUEUE_NOTIFIER=y diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/include/board.h b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/board.h new file mode 100644 index 0000000000000..37c8afc1d392c --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/board.h @@ -0,0 +1,169 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/include/board.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_BOARD_H +#define __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "rp23xx_i2cdev.h" +#include "rp23xx_spidev.h" +#include "rp23xx_i2sdev.h" +#include "rp23xx_spisd.h" + +#ifndef __ASSEMBLY__ +# include +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +#define MHZ 1000000 + +#define BOARD_XOSC_FREQ (12 * MHZ) +#define BOARD_XOSC_STARTUPDELAY 1 +#define BOARD_PLL_SYS_FREQ (150 * MHZ) +#define BOARD_PLL_USB_FREQ (48 * MHZ) + +#define BOARD_REF_FREQ (12 * MHZ) +#define BOARD_SYS_FREQ (150 * MHZ) +#define BOARD_PERI_FREQ (150 * MHZ) +#define BOARD_USB_FREQ (48 * MHZ) +#define BOARD_ADC_FREQ (48 * MHZ) +#define BOARD_HSTX_FREQ (150 * MHZ) + +#define BOARD_UART_BASEFREQ BOARD_PERI_FREQ + +#define BOARD_TICK_CLOCK (1 * MHZ) + +/* definitions for pico-sdk */ + +/* GPIO definitions *********************************************************/ + +#define BOARD_GPIO_LED_PIN 25 +#define BOARD_NGPIOOUT 1 +#define BOARD_NGPIOIN 1 +#define BOARD_NGPIOINT 1 + +/* LED definitions **********************************************************/ + +/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs + * in any way. The following definitions are used to access individual LEDs. + */ + +/* LED index values for use with board_userled() */ + +#define BOARD_LED1 0 +#define BOARD_NLEDS 1 + +#define BOARD_LED_GREEN BOARD_LED1 + +/* LED bits for use with board_userled_all() */ + +#define BOARD_LED1_BIT (1 << BOARD_LED1) + +/* This LED is not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/rp23xx_autoleds.c. The LED is used to encode + * OS-related events as follows: + * + * -------------------- ----------------------------- ------ + * SYMBOL Meaning LED + * -------------------- ----------------------------- ------ + */ + +#define LED_STARTED 0 /* NuttX has been started OFF */ +#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */ +#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */ +#define LED_STACKCREATED 1 /* Idle stack created ON */ +#define LED_INIRQ 2 /* In an interrupt N/C */ +#define LED_SIGNAL 2 /* In a signal handler N/C */ +#define LED_ASSERTION 2 /* An assertion failed N/C */ +#define LED_PANIC 3 /* The system has crashed FLASH */ +#undef LED_IDLE /* Not used */ + +/* Thus if the LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If the LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ + +/* BUTTON definitions *******************************************************/ + +#define NUM_BUTTONS 0 + +#define BUTTON_USER1 0 +#define BUTTON_USER2 1 +#define BUTTON_USER1_BIT (1 << BUTTON_USER1) +#define BUTTON_USER2_BIT (1 << BUTTON_USER2) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_boardearlyinitialize + * + * Description: + * + ****************************************************************************/ + +void rp23xx_boardearlyinitialize(void); + +/**************************************************************************** + * Name: rp23xx_boardinitialize + * + * Description: + * + ****************************************************************************/ + +void rp23xx_boardinitialize(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_BOARD_H */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2cdev.h b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2cdev.h new file mode 100644 index 0000000000000..bf8a179935228 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2cdev.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2cdev.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_I2CDEV_H +#define __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_I2CDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_i2cdev_initialize + * + * Description: + * Initialize i2c driver and register the /dev/i2c device. + * + ****************************************************************************/ + +#ifdef CONFIG_RP23XX_I2C_DRIVER +int board_i2cdev_initialize(int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_I2CDEV_H */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2sdev.h b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2sdev.h new file mode 100644 index 0000000000000..41d68d519c019 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2sdev.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_i2sdev.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_I2SDEV_H +#define __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_I2SDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_i2sdev_initialize + * + * Description: + * Initialize i2s driver and register the /dev/audio/pcm0 device. + * + ****************************************************************************/ + +#ifdef CONFIG_RP23XX_I2S +int board_i2sdev_initialize(int bus); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_I2SDEV_H */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spidev.h b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spidev.h new file mode 100644 index 0000000000000..df4c73eae1731 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spidev.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spidev.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_SPIDEV_H +#define __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_SPIDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_spidev_initialize + * + * Description: + * Initialize spi driver and register the /dev/spi device. + * + ****************************************************************************/ + +int board_spidev_initialize(int bus); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_SPIDEV_H */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spisd.h b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spisd.h new file mode 100644 index 0000000000000..1f71de10ee91f --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spisd.h @@ -0,0 +1,83 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/include/rp23xx_spisd.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_SPISD_H +#define __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_SPISD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: board_spisd_initialize + * + * Description: + * Initialize the SPI-based SD card. + * + ****************************************************************************/ + +#ifdef CONFIG_RP23XX_SPISD +int board_spisd_initialize(int minor, int bus); +#endif + +/**************************************************************************** + * Name: board_spisd_status + * + * Description: + * Get the status whether SD Card is present or not. + * + ****************************************************************************/ + +#ifdef CONFIG_RP23XX_SPISD +uint8_t board_spisd_status(struct spi_dev_s *dev, uint32_t devid); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_INCLUDE_RP23XX_SPISD_H */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/Make.defs b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/Make.defs new file mode 100644 index 0000000000000..cf214e955c780 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/Make.defs @@ -0,0 +1,47 @@ +############################################################################ +# boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/tools/rp23xx/Config.mk +include $(TOPDIR)/arch/arm/src/armv8-m/Toolchain.defs + +ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y) + LDSCRIPT = memmap_default.ld +else ifeq ($(CONFIG_BOOT_COPYTORAM),y) + LDSCRIPT = memmap_copy_to_ram.ld +else + LDSCRIPT = memmap_no_flash.ld +endif + +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_copy_to_ram.ld b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_copy_to_ram.ld new file mode 100644 index 0000000000000..db52cb5543507 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_copy_to_ram.ld @@ -0,0 +1,331 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_copy_to_ram.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* Based on GCC ARM embedded samples. + Defines the following symbols for use by code: + __exidx_start + __exidx_end + __etext + __data_start__ + __preinit_array_start + __preinit_array_end + __init_array_start + __init_array_end + __fini_array_start + __fini_array_end + __data_end__ + __bss_start__ + __bss_end__ + __end__ + end + __HeapLimit + __StackLimit + __StackTop + __stack (== StackTop) +*/ + +MEMORY +{ + FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 4096k + RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k + SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k + SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k +} + +ENTRY(_entry_point) + +SECTIONS +{ + /* Second stage bootloader is prepended to the image. It must be 256 bytes big + and checksummed. It is usually built by the boot_stage2 target + in the Raspberry Pi Pico SDK + */ + + .flash_begin : { + __flash_binary_start = .; + } > FLASH + + /* The bootrom will enter the image at the point indicated in your + IMAGE_DEF, which is usually the reset handler of your vector table. + + The debugger will use the ELF entry point, which is the _entry_point + symbol, and in our case is *different from the bootrom's entry point.* + This is used to go back through the bootrom on debugger launches only, + to perform the same initial flash setup that would be performed on a + cold boot. + */ + + .flashtext : { + __logical_binary_start = .; + KEEP (*(.vectors)) + KEEP (*(.binary_info_header)) + __binary_info_header_end = .; + KEEP (*(.embedded_block)) + __embedded_block_end = .; + KEEP (*(.reset)) + . = ALIGN(4); + } > FLASH + + /* Note the boot2 section is optional, and should be discarded if there is + no reference to it *inside* the binary, as it is not called by the + bootrom. (The bootrom performs a simple best-effort XIP setup and + leaves it to the binary to do anything more sophisticated.) However + there is still a size limit of 256 bytes, to ensure the boot2 can be + stored in boot RAM. + + Really this is a "XIP setup function" -- the name boot2 is historic and + refers to its dual-purpose on RP2040, where it also handled vectoring + from the bootrom into the user image. + */ + + .boot2 : { + __boot2_start__ = .; + *(.boot2) + __boot2_end__ = .; + } > FLASH + + ASSERT(__boot2_end__ - __boot2_start__ <= 256, + "ERROR: Pico second stage bootloader must be no more than 256 bytes in size") + + .rodata : { + /* segments not marked as .flashdata are instead pulled into .data (in RAM) to avoid accidental flash accesses */ + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) + . = ALIGN(4); + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* Machine inspectable binary information */ + . = ALIGN(4); + __binary_info_start = .; + .binary_info : + { + KEEP(*(.binary_info.keep.*)) + *(.binary_info.*) + } > FLASH + __binary_info_end = .; + . = ALIGN(4); + + /* Vector table goes first in RAM, to avoid large alignment hole */ + .ram_vector_table (NOLOAD): { + *(.ram_vector_table) + } > RAM + + .uninitialized_data (NOLOAD): { + . = ALIGN(4); + *(.uninitialized_data*) + } > RAM + + .text : { + __ram_text_start__ = .; + *(.init) + *(.text*) + *(.fini) + /* Pull all c'tors into .text */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + /* Followed by destructors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.eh_frame*) + . = ALIGN(4); + __ram_text_end__ = .; + } > RAM AT> FLASH + __ram_text_source__ = LOADADDR(.text); + . = ALIGN(4); + + .data : { + __data_start__ = .; + *(vtable) + + *(.time_critical*) + + . = ALIGN(4); + *(.rodata*) + *(.srodata*) + . = ALIGN(4); + + *(.data*) + *(.sdata*) + + . = ALIGN(4); + *(.after_data.*) + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__mutex_array_start = .); + KEEP(*(SORT(.mutex_array.*))) + KEEP(*(.mutex_array)) + PROVIDE_HIDDEN (__mutex_array_end = .); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(SORT(.preinit_array.*))) + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + *(.fini_array) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + } > RAM AT> FLASH + + .tdata : { + . = ALIGN(4); + *(.tdata .tdata.* .gnu.linkonce.td.*) + /* All data end */ + __tdata_end = .; + } > RAM AT> FLASH + PROVIDE(__data_end__ = .); + + /* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */ + __etext = LOADADDR(.data); + + .tbss (NOLOAD) : { + . = ALIGN(4); + __bss_start__ = .; + __tls_base = .; + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon) + + __tls_end = .; + } > RAM + + .bss : { + . = ALIGN(4); + __tbss_end = .; + + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) + *(COMMON) + PROVIDE(__global_pointer$ = . + 2K); + *(.sbss*) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (NOLOAD): + { + __end__ = .; + end = __end__; + KEEP(*(.heap*)) + } > RAM + /* historically on GCC sbrk was growing past __HeapLimit to __StackLimit, however + to be more compatible, we now set __HeapLimit explicitly to where the end of the heap is */ + __HeapLimit = ORIGIN(RAM) + LENGTH(RAM); + + + /* Start and end symbols must be word-aligned */ + .scratch_x : { + __scratch_x_start__ = .; + *(.scratch_x.*) + . = ALIGN(4); + __scratch_x_end__ = .; + } > SCRATCH_X AT > FLASH + __scratch_x_source__ = LOADADDR(.scratch_x); + + .scratch_y : { + __scratch_y_start__ = .; + *(.scratch_y.*) + . = ALIGN(4); + __scratch_y_end__ = .; + } > SCRATCH_Y AT > FLASH + __scratch_y_source__ = LOADADDR(.scratch_y); + + /* .stack*_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later + * + * stack1 section may be empty/missing if platform_launch_core1 is not used */ + + /* by default we put core 0 stack at the end of scratch Y, so that if core 1 + * stack is not used then all of SCRATCH_X is free. + */ + .stack1_dummy (NOLOAD): + { + *(.stack1*) + } > SCRATCH_X + .stack_dummy (NOLOAD): + { + KEEP(*(.stack*)) + } > SCRATCH_Y + + .flash_end : { + KEEP(*(.embedded_end_block*)) + PROVIDE(__flash_binary_end = .); + } > FLASH =0xaa + + /* stack limit is poorly named, but historically is maximum heap ptr */ + __StackLimit = ORIGIN(RAM) + LENGTH(RAM); + __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); + __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); + __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); + __StackBottom = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* picolibc and LLVM */ + PROVIDE (__heap_start = __end__); + PROVIDE (__heap_end = __HeapLimit); + PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) ); + PROVIDE( __tls_size_align = (__tls_size + __tls_align - 1) & ~(__tls_align - 1)); + PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) ); + + /* llvm-libc */ + PROVIDE (_end = __end__); + PROVIDE (__llvm_libc_heap_limit = __HeapLimit); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") + + ASSERT( __binary_info_header_end - __logical_binary_start <= 1024, "Binary info must be in first 1024 bytes of the binary") + ASSERT( __embedded_block_end - __logical_binary_start <= 4096, "Embedded block must be in first 4096 bytes of the binary") + + /* todo assert on extra code */ +} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_default.ld b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_default.ld new file mode 100644 index 0000000000000..07328ad23c211 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_default.ld @@ -0,0 +1,343 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_default.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* Based on GCC ARM embedded samples. + Defines the following symbols for use by code: + __exidx_start + __exidx_end + __etext + __data_start__ + __preinit_array_start + __preinit_array_end + __init_array_start + __init_array_end + __fini_array_start + __fini_array_end + __data_end__ + __bss_start__ + __bss_end__ + __end__ + end + __HeapLimit + __StackLimit + __StackTop + __stack (== StackTop) +*/ + +MEMORY +{ + FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 4096k + RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k + SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k + SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k +} + +ENTRY(_entry_point) + +SECTIONS +{ + .flash_begin : { + __flash_binary_start = .; + } > FLASH + + /* The bootrom will enter the image at the point indicated in your + IMAGE_DEF, which is usually the reset handler of your vector table. + + The debugger will use the ELF entry point, which is the _entry_point + symbol, and in our case is *different from the bootrom's entry point.* + This is used to go back through the bootrom on debugger launches only, + to perform the same initial flash setup that would be performed on a + cold boot. + */ + + .text : { + __logical_binary_start = .; + _stext = ABSOLUTE(.); + + KEEP (*(.vectors)) + + LONG(0xffffded3) + LONG(0x10210142) + LONG(0x000001ff) + LONG(0x00000000) + LONG(0xab123579) + + KEEP (*(.binary_info_header)) + __binary_info_header_end = .; + KEEP (*(.embedded_block)) + __embedded_block_end = .; + KEEP (*(.reset)) + /* TODO revisit this now memset/memcpy/float in ROM */ + /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from + * FLASH ... we will include any thing excluded here in .data below by default */ + *(.init) + *libgcc.a:cmse_nonsecure_call.o + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) + *(.fini) + /* Pull all c'tors into .text */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + /* Followed by destructors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(SORT(.preinit_array.*))) + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + *(.fini_array) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.eh_frame*) + . = ALIGN(4); + _etext = ABSOLUTE(.); + } > FLASH + + /* Note the boot2 section is optional, and should be discarded if there is + no reference to it *inside* the binary, as it is not called by the + bootrom. (The bootrom performs a simple best-effort XIP setup and + leaves it to the binary to do anything more sophisticated.) However + there is still a size limit of 256 bytes, to ensure the boot2 can be + stored in boot RAM. + + Really this is a "XIP setup function" -- the name boot2 is historic and + refers to its dual-purpose on RP2040, where it also handled vectoring + from the bootrom into the user image. + */ + + .boot2 : { + __boot2_start__ = .; + *(.boot2) + __boot2_end__ = .; + } > FLASH + + ASSERT(__boot2_end__ - __boot2_start__ <= 256, + "ERROR: Pico second stage bootloader must be no more than 256 bytes in size") + + .rodata : { + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) + *(.srodata*) + . = ALIGN(4); + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) + . = ALIGN(4); + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + /* Machine inspectable binary information */ + . = ALIGN(4); + __binary_info_start = .; + .binary_info : + { + KEEP(*(.binary_info.keep.*)) + *(.binary_info.*) + } > FLASH + _eronly = ABSOLUTE(.); + __binary_info_end = .; + . = ALIGN(4); + + .ram_vector_table (NOLOAD): { + *(.ram_vector_table) + } > RAM + + .uninitialized_data (NOLOAD): { + . = ALIGN(4); + *(.uninitialized_data*) + } > RAM + + .data : { + __data_start__ = .; + _sdata = ABSOLUTE(.); + + *(vtable) + + *(.time_critical*) + + /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ + *(.text*) + . = ALIGN(4); + *(.rodata*) + . = ALIGN(4); + + *(.data*) + *(.sdata*) + + . = ALIGN(4); + *(.after_data.*) + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__mutex_array_start = .); + KEEP(*(SORT(.mutex_array.*))) + KEEP(*(.mutex_array)) + PROVIDE_HIDDEN (__mutex_array_end = .); + + *(.jcr) + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > RAM AT> FLASH + + .tdata : { + _stdata = ABSOLUTE(.); + . = ALIGN(4); + *(.tdata .tdata.* .gnu.linkonce.td.*) + /* All data end */ + __tdata_end = .; + _etdata = ABSOLUTE(.); + } > RAM AT> FLASH + PROVIDE(__data_end__ = .); + + /* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */ + __etext = LOADADDR(.data); + + .tbss (NOLOAD) : { + _stbss = ABSOLUTE(.); + . = ALIGN(4); + __bss_start__ = .; + _sbss = ABSOLUTE(.); + __tls_base = .; + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon) + + __tls_end = .; + _etbss = ABSOLUTE(.); + } > RAM + + .bss (NOLOAD) : { + . = ALIGN(4); + __tbss_end = .; + + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) + *(COMMON) + PROVIDE(__global_pointer$ = . + 2K); + *(.sbss*) + . = ALIGN(4); + __bss_end__ = .; + _ebss = ABSOLUTE(.); + } > RAM + + .heap (NOLOAD): + { + __end__ = .; + end = __end__; + KEEP(*(.heap*)) + } > RAM + /* historically on GCC sbrk was growing past __HeapLimit to __StackLimit, however + to be more compatible, we now set __HeapLimit explicitly to where the end of the heap is */ + __HeapLimit = ORIGIN(RAM) + LENGTH(RAM); + + /* Start and end symbols must be word-aligned */ + .scratch_x : { + __scratch_x_start__ = .; + *(.scratch_x.*) + . = ALIGN(4); + __scratch_x_end__ = .; + } > SCRATCH_X AT > FLASH + __scratch_x_source__ = LOADADDR(.scratch_x); + + .scratch_y : { + __scratch_y_start__ = .; + *(.scratch_y.*) + . = ALIGN(4); + __scratch_y_end__ = .; + } > SCRATCH_Y AT > FLASH + __scratch_y_source__ = LOADADDR(.scratch_y); + + /* .stack*_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later + * + * stack1 section may be empty/missing if platform_launch_core1 is not used */ + + /* by default we put core 0 stack at the end of scratch Y, so that if core 1 + * stack is not used then all of SCRATCH_X is free. + */ + .stack1_dummy (NOLOAD): + { + *(.stack1*) + } > SCRATCH_X + .stack_dummy (NOLOAD): + { + KEEP(*(.stack*)) + } > SCRATCH_Y + + .flash_end : { + KEEP(*(.embedded_end_block*)) + PROVIDE(__flash_binary_end = .); + } > FLASH =0xaa + + /* stack limit is poorly named, but historically is maximum heap ptr */ + __StackLimit = ORIGIN(RAM) + LENGTH(RAM); + __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); + __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); + __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); + __StackBottom = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* picolibc and LLVM */ + PROVIDE (__heap_start = __end__); + PROVIDE (__heap_end = __HeapLimit); + PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) ); + PROVIDE( __tls_size_align = (__tls_size + __tls_align - 1) & ~(__tls_align - 1)); + PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) ); + + /* llvm-libc */ + PROVIDE (_end = __end__); + PROVIDE (__llvm_libc_heap_limit = __HeapLimit); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") + + ASSERT( __binary_info_header_end - __logical_binary_start <= 1024, "Binary info must be in first 1024 bytes of the binary") + ASSERT( __embedded_block_end - __logical_binary_start <= 4096, "Embedded block must be in first 4096 bytes of the binary") + + /* todo assert on extra code */ +} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_no_flash.ld b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_no_flash.ld new file mode 100644 index 0000000000000..0900fb9e61b9f --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_no_flash.ld @@ -0,0 +1,284 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/scripts/memmap_no_flash.ld + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* Based on GCC ARM embedded samples. + Defines the following symbols for use by code: + __exidx_start + __exidx_end + __etext + __data_start__ + __preinit_array_start + __preinit_array_end + __init_array_start + __init_array_end + __fini_array_start + __fini_array_end + __data_end__ + __bss_start__ + __bss_end__ + __end__ + end + __HeapLimit + __StackLimit + __StackTop + __stack (== StackTop) +*/ + +MEMORY +{ + RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 512k + SCRATCH_X(rwx) : ORIGIN = 0x20080000, LENGTH = 4k + SCRATCH_Y(rwx) : ORIGIN = 0x20081000, LENGTH = 4k +} + +ENTRY(_entry_point) + +SECTIONS +{ + /* Note unlike RP2040, we start the image with a vector table even for + NO_FLASH builds. On Arm, the bootrom expects a VT at the start of the + image by default; on RISC-V, the default is to enter the image at its + lowest address, so an IMAGEDEF item is required to specify the + nondefault entry point. */ + + .text : { + __logical_binary_start = .; + _stext = ABSOLUTE(.); + /* Vectors require 512-byte alignment on v8-M when >48 IRQs are used, + so we would waste RAM if the vector table were not at the + start. */ + KEEP (*(.vectors)) + KEEP (*(.binary_info_header)) + __binary_info_header_end = .; + KEEP (*(.embedded_block)) + __embedded_block_end = .; + __reset_start = .; + KEEP (*(.reset)) + __reset_end = .; + *(.time_critical*) + *(.text*) + . = ALIGN(4); + *(.init) + *(.fini) + /* Pull all c'tors into .text */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + /* Followed by destructors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.eh_frame*) + } > RAM + + .rodata : { + . = ALIGN(4); + *(.rodata*) + *(.srodata*) + . = ALIGN(4); + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) + . = ALIGN(4); + } > RAM + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > RAM + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > RAM + __exidx_end = .; + + /* Machine inspectable binary information */ + . = ALIGN(4); + __binary_info_start = .; + .binary_info : + { + KEEP(*(.binary_info.keep.*)) + *(.binary_info.*) + } > RAM + __binary_info_end = .; + . = ALIGN(4); + + .data : { + __data_start__ = .; + *(vtable) + *(.data*) + *(.sdata*) + + . = ALIGN(4); + *(.after_data.*) + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__mutex_array_start = .); + KEEP(*(SORT(.mutex_array.*))) + KEEP(*(.mutex_array)) + PROVIDE_HIDDEN (__mutex_array_end = .); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(SORT(.preinit_array.*))) + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + *(.fini_array) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + } > RAM + + .tdata : { + . = ALIGN(4); + *(.tdata .tdata.* .gnu.linkonce.td.*) + /* All data end */ + __tdata_end = .; + } > RAM + PROVIDE(__data_end__ = .); + + .uninitialized_data (NOLOAD): { + . = ALIGN(4); + *(.uninitialized_data*) + } > RAM + /* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */ + __etext = LOADADDR(.data); + _etext = LOADADDR(.data); + + + .tbss (NOLOAD) : { + . = ALIGN(4); + __bss_start__ = .; + _stbss = ABSOLUTE(.); + __tls_base = .; + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon) + + __tls_end = .; + _etbss = ABSOLUTE(.); + } > RAM + + .bss (NOLOAD) : { + . = ALIGN(4); + _sbss = ABSOLUTE(.); + __tbss_end = .; + + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) + *(COMMON) + PROVIDE(__global_pointer$ = . + 2K); + *(.sbss*) + . = ALIGN(4); + __bss_end__ = .; + _ebss = ABSOLUTE(.); + } > RAM + + .heap (NOLOAD): + { + __end__ = .; + end = __end__; + KEEP(*(.heap*)) + } > RAM + /* historically on GCC sbrk was growing past __HeapLimit to __StackLimit, however + to be more compatible, we now set __HeapLimit explicitly to where the end of the heap is */ + __HeapLimit = ORIGIN(RAM) + LENGTH(RAM); + + /* Start and end symbols must be word-aligned */ + .scratch_x : { + __scratch_x_start__ = .; + *(.scratch_x.*) + . = ALIGN(4); + __scratch_x_end__ = .; + } > SCRATCH_X + __scratch_x_source__ = LOADADDR(.scratch_x); + + .scratch_y : { + __scratch_y_start__ = .; + *(.scratch_y.*) + . = ALIGN(4); + __scratch_y_end__ = .; + } > SCRATCH_Y + __scratch_y_source__ = LOADADDR(.scratch_y); + + /* .stack*_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later + * + * stack1 section may be empty/missing if platform_launch_core1 is not used */ + + /* by default we put core 0 stack at the end of scratch Y, so that if core 1 + * stack is not used then all of SCRATCH_X is free. + */ + .stack1_dummy (NOLOAD): + { + *(.stack1*) + } > SCRATCH_X + .stack_dummy (NOLOAD): + { + KEEP(*(.stack*)) + } > SCRATCH_Y + + /* stack limit is poorly named, but historically is maximum heap ptr */ + __StackLimit = ORIGIN(RAM) + LENGTH(RAM); + __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); + __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); + __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); + __StackBottom = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* picolibc and LLVM */ + PROVIDE (__heap_start = __end__); + PROVIDE (__heap_end = __HeapLimit); + PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) ); + PROVIDE( __tls_size_align = (__tls_size + __tls_align - 1) & ~(__tls_align - 1)); + PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) ); + + /* llvm-libc */ + PROVIDE (_end = __end__); + PROVIDE (__llvm_libc_heap_limit = __HeapLimit); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") + + ASSERT( __binary_info_header_end - __logical_binary_start <= 1024, "Binary info must be in first 1024 bytes of the binary") + ASSERT( __embedded_block_end - __logical_binary_start <= 4096, "Embedded block must be in first 4096 bytes of the binary") + + /* todo assert on extra code */ +} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/CMakeLists.txt b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/CMakeLists.txt new file mode 100644 index 0000000000000..7f459ff9cef63 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/CMakeLists.txt @@ -0,0 +1,57 @@ +# ############################################################################## +# boards/arm/rp23xx/raspberrypi-pico-2-w/src/CMakeLists.txt +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +set(SRCS rp23xx_boardinitialize.c rp23xx_bringup.c) + +if(CONFIG_DEV_GPIO) + list(APPEND SRCS rp23xx_gpio.c) +endif() + +if(CONFIG_ARCH_LEDS) + list(APPEND SRCS rp23xx_autoleds.c) +else() + list(APPEND SRCS rp23xx_userleds.c) +endif() + +if(CONFIG_ARCH_BUTTONS) + list(APPEND SRCS rp23xx_buttons.c) +endif() + +if(CONFIG_BOARDCTL) + list(APPEND SRCS rp23xx_appinit.c) +endif() + +target_sources(board PRIVATE ${SRCS}) + +if(CONFIG_BOOT_RUNFROMFLASH) + set_property(GLOBAL PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/memmap_default.ld") +elseif(CONFIG_BOOT_COPYTORAM) + set_property( + GLOBAL PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/memmap_copy_to_ram.ld") +else() + set_property(GLOBAL PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/memmap_no_flash.ld") +endif() + +if(CONFIG_ETC_ROMFS) + # TODO: etc/init.d/rc.sysinit etc/init.d/rcS +endif() diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/Make.defs b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/Make.defs new file mode 100644 index 0000000000000..0e9cfaf8184a1 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/Make.defs @@ -0,0 +1,95 @@ +############################################################################ +# boards/arm/rp23xx/raspberrypi-pico-2-w/src/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/Make.defs + +CSRCS = rp23xx_boardinitialize.c +CSRCS += rp23xx_appinit.c +CSRCS += rp23xx_bringup.c + +ifeq ($(CONFIG_DEV_GPIO),y) +CSRCS += rp23xx_gpio.c +endif + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += rp23xx_autoleds.c +else +CSRCS += rp23xx_userleds.c +endif + +ifeq ($(CONFIG_ARCH_BUTTONS),y) + CSRCS += rp23xx_buttons.c +endif + +ifeq ($(CONFIG_ETC_ROMFS),y) + RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS +endif + +CSRCS += rp23xx_firmware.c + +DEPPATH += --dep-path board +VPATH += :board +CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board + +############################################################################ +# The rules below copy the cyw43439 blob from the pico-sdk. The firmware +# source path is configured via CONFIG_CYW43439_FIRMWARE_BIN_PATH. +############################################################################ + +ifeq ($(CONFIG_IEEE80211_INFINEON_CYW43439),y) + +# When CONFIG_ARCH_BOARD_COMMON is selected, the libboard build runs from +# the common board directory and reaches these board-specific sources via +# the "board" symlink (arch/arm/src/board/board -> this src dir). The +# firmware blob is therefore generated alongside rp23xx_firmware.c so that +# the assembler's ".incbin" (which searches the source file's directory) +# can find it, and the object is made to depend on it so generation always +# runs before the compile. + +FIRMWARE = board$(DELIM)cyw43439.firmware.image + +# --- If PICO_SDK_PATH is not defined set a dummy path. -------------------- +# See comment below. + +ifeq ($(PICO_SDK_PATH),) + PICO_SDK_PATH = /tmp +endif + +FIRMWARE_SRC := $(patsubst "%",%,$(CONFIG_CYW43439_FIRMWARE_BIN_PATH)) + +# --- If the firmware source does not exist create a dummy file. ----------- +# NuttX built with the cyw43439 driver will not run successfully +# when built with this dummy file. The sole purpose of adding +# this dummy is so the build (and GitHub's validation tests) will +# not fail when the real firmware blob is not present. + +$(FIRMWARE_SRC): + mkdir -p `dirname $(FIRMWARE_SRC)` + echo "dummy" >$(FIRMWARE_SRC) + +$(FIRMWARE): $(FIRMWARE_SRC) + $(call CATFILE, $(FIRMWARE), $(FIRMWARE_SRC)) + +rp23xx_firmware$(OBJEXT): $(FIRMWARE) + +distclean:: + $(call DELFILE, board$(DELIM)cyw43439.firmware.image) + +endif diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rc.sysinit b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rc.sysinit new file mode 100644 index 0000000000000..08bd5e859c096 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rc.sysinit @@ -0,0 +1,23 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2/src/etc/init.d/rc.sysinit + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#include diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rcS b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rcS new file mode 100644 index 0000000000000..7eb0115571682 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/etc/init.d/rcS @@ -0,0 +1,24 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2/src/etc/init.d/rcS + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#include + diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_appinit.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_appinit.c new file mode 100644 index 0000000000000..bea44c62dd2c8 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_appinit.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_appinit.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "rp23xx_pico.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_app_initialize + * + * Description: + * Perform application specific initialization. This function is never + * called directly from application code, but only indirectly via the + * (non-standard) boardctl() interface using the command BOARDIOC_INIT. + * + * Input Parameters: + * arg - The boardctl() argument is passed to the board_app_initialize() + * implementation without modification. The argument has no + * meaning to NuttX; the meaning of the argument is a contract + * between the board-specific initialization logic and the + * matching application logic. The value could be such things as a + * mode enumeration value, a set of DIP switch switch settings, a + * pointer to configuration data read from a file or serial FLASH, + * or whatever you would like to do with it. Every implementation + * should accept zero/NULL as a default configuration. + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure to indicate the nature of the failure. + * + ****************************************************************************/ + +int board_app_initialize(uintptr_t arg) +{ +#ifdef CONFIG_BOARD_LATE_INITIALIZE + /* Board initialization already performed by board_late_initialize() */ + + return OK; +#else + /* Perform board-specific initialization */ + + return rp23xx_bringup(); +#endif +} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_autoleds.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_autoleds.c new file mode 100644 index 0000000000000..cbe1ae50e60e8 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_autoleds.c @@ -0,0 +1,165 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_autoleds.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* There are four LED status indicators located on the EVK Board. The + * functions of these LEDs include: + * + * - Main Power Supply(D3) + * Green: DC 5V main supply is normal. + * Red: J2 input voltage is over 5.6V. + * Off: The board is not powered. + * - Reset RED LED(D15) + * - OpenSDA LED(D16) + * - USER LED(D18) + * + * Only a single LED, D18, is under software control. + * + * This LED is not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/rp23xx_autoleds.c. The LED is used to encode + * OS-related events as follows: + * + * -------------------- ----------------------- ------ + * SYMBOL Meaning LED + * -------------------- ----------------------- ------ + * + * LED_STARTED 0 NuttX has been started OFF + * LED_HEAPALLOCATE 0 Heap has been allocated OFF + * LED_IRQSENABLED 0 Interrupts enabled OFF + * LED_STACKCREATED 1 Idle stack created ON + * LED_INIRQ 2 In an interrupt N/C + * LED_SIGNAL 2 In a signal handler N/C + * LED_ASSERTION 2 An assertion failed N/C + * LED_PANIC 3 The system has crashed FLASH + * LED_IDLE Not used + * + * Thus if the LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If the LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include "rp23xx_gpio.h" + +#include "rp23xx_pico.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_autoled_initialize + * + * Description: + * Initialize NuttX-controlled LED logic + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + /* Configure LED GPIO for output */ + + rp23xx_gpio_init(GPIO_LED1); + rp23xx_gpio_setdir(GPIO_LED1, true); +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Turn on the "logical" LED state + * + * Input Parameters: + * led - Identifies the "logical" LED state (see definitions in + * include/board.h) + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + bool ledon = true; + + switch (led) + { + case 0: /* LED Off */ + ledon = false; + break; + + case 2: /* LED No change */ + return; + + case 1: /* LED On */ + case 3: /* LED On */ + break; + } + + rp23xx_gpio_put(GPIO_LED1, ledon); /* High illuminates */ +} + +/**************************************************************************** + * Name: board_autoled_off + * + * Description: + * Turn off the "logical" LED state + * + * Input Parameters: + * led - Identifies the "logical" LED state (see definitions in + * include/board.h) + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_autoled_off(int led) +{ + switch (led) + { + case 0: /* LED Off */ + case 1: /* LED Off */ + case 3: /* LED Off */ + break; + + case 2: /* LED No change */ + return; + } + + rp23xx_gpio_put(GPIO_LED1, false); /* High illuminates */ +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_boardinitialize.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_boardinitialize.c new file mode 100644 index 0000000000000..1d720f5526a97 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_boardinitialize.c @@ -0,0 +1,94 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_boardinitialize.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include + +#include "rp23xx_gpio.h" + +#ifdef CONFIG_RP23XX_PSRAM +#include "rp23xx_psram.h" +#endif + +#ifdef CONFIG_ARCH_BOARD_COMMON +#include "rp23xx_common_initialize.h" +#endif /* CONFIG_ARCH_BOARD_COMMON */ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_boardearlyinitialize + * + * Description: + * + ****************************************************************************/ + +void rp23xx_boardearlyinitialize(void) +{ + #ifdef CONFIG_ARCH_BOARD_COMMON + rp23xx_common_earlyinitialize(); + #endif + + /* --- Place any board specific early initialization here --- */ + + /* Set board LED pin */ + + rp23xx_gpio_init(BOARD_GPIO_LED_PIN); + rp23xx_gpio_setdir(BOARD_GPIO_LED_PIN, true); + rp23xx_gpio_put(BOARD_GPIO_LED_PIN, true); +} + +/**************************************************************************** + * Name: rp23xx_boardinitialize + * + * Description: + * + ****************************************************************************/ + +void rp23xx_boardinitialize(void) +{ + #ifdef CONFIG_ARCH_BOARD_COMMON + rp23xx_common_initialize(); + #endif + + #ifdef CONFIG_RP23XX_PSRAM + rp23xx_psramconfig(); + #endif + + /* --- Place any board specific initialization here --- */ +} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_bringup.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_bringup.c new file mode 100644 index 0000000000000..d8455f40201c4 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_bringup.c @@ -0,0 +1,151 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_bringup.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include + +#include + +#include "rp23xx_pico.h" + +#ifdef CONFIG_ARCH_BOARD_COMMON +#include "rp23xx_common_bringup.h" +#endif /* CONFIG_ARCH_BOARD_COMMON */ + +#ifdef CONFIG_USERLED +# include +#endif + +#ifdef CONFIG_RP23XX_INFINEON_CYW43439 +#include "rp23xx_cyw43439.h" +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_RP23XX_INFINEON_CYW43439 + +/* CYW43439 wireless host-interface GPIO assignments. + * + * These match the Raspberry Pi Pico W (RP2040) wiring, which the Pico 2 W + * carries over unchanged so that existing CYW43 software keeps working. + * The data line is bidirectional (single-wire gSPI), so it is also used as + * the host-wake interrupt line. + * + * VERIFY: Pico 2 W datasheet -- confirm these GPIO numbers against the + * official Raspberry Pi Pico 2 W datasheet / schematic before relying on a + * hardware bring-up. + */ + +# define CYW43439_POWER_ON_GPIO 23 /* WL_ON - power/enable */ +# define CYW43439_CHIP_SELECT_GPIO 25 /* WL_CS - chip select (active 0) */ +# define CYW43439_DATA_GPIO 24 /* WL_D - bidirectional gSPI data */ +# define CYW43439_CLOCK_GPIO 29 /* WL_CLK - gSPI clock */ + +#endif + +/**************************************************************************** + * Global Data + ****************************************************************************/ + +#ifdef CONFIG_RP23XX_INFINEON_CYW43439 +gspi_dev_t *g_cyw43439 = NULL; +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_bringup + ****************************************************************************/ + +int rp23xx_bringup(void) +{ + int ret = OK; + +#ifdef CONFIG_ARCH_BOARD_COMMON + + ret = rp23xx_common_bringup(); + if (ret < 0) + { + return ret; + } + +#endif /* CONFIG_ARCH_BOARD_COMMON */ + + /* --- Place any board specific bringup code here --- */ + +#ifdef CONFIG_USERLED + /* Register the LED driver */ + + ret = userled_lower_initialize("/dev/userleds"); + if (ret < 0) + { + syslog(LOG_ERR, \ + "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_INPUT_BUTTONS + /* Register the BUTTON driver */ + + ret = btn_lower_initialize("/dev/buttons"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_RP23XX_INFINEON_CYW43439 + /* Initialize the cyw43439 (onboard WiFi chip) over PIO-based gSPI. */ + + g_cyw43439 = rp23xx_cyw_setup(CYW43439_POWER_ON_GPIO, + CYW43439_CHIP_SELECT_GPIO, + CYW43439_DATA_GPIO, + CYW43439_CLOCK_GPIO, + CYW43439_DATA_GPIO); + + if (g_cyw43439 == NULL) + { + ret = errno; + + syslog(LOG_ERR, + "Failed to initialize cyw43439 (WiFi chip): %d\n", + ret); + + return ret; + } +#endif + + return ret; +} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_buttons.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_buttons.c new file mode 100644 index 0000000000000..b984c6458e5fc --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_buttons.c @@ -0,0 +1,177 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_buttons.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +#include "rp23xx_gpio.h" +#include "rp23xx_pico.h" + +#if defined(CONFIG_ARCH_BUTTONS) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#if defined(CONFIG_INPUT_BUTTONS) && !defined(CONFIG_ARCH_IRQBUTTONS) +# error "The NuttX Buttons Driver depends on IRQ support to work!\n" +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* Pin configuration for external raspberrypi-pico-2 buttons. */ + +static const uint32_t g_buttons[NUM_BUTTONS] = +{ + GPIO_BTN_USER1, GPIO_BTN_USER2 +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_button_initialize + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + ****************************************************************************/ + +uint32_t board_button_initialize(void) +{ + int i; + + /* Configure the GPIO pins as inputs. And we will use interrupts */ + + for (i = 0; i < NUM_BUTTONS; i++) + { + /* Initialize input pin */ + + rp23xx_gpio_init(g_buttons[i]); + + /* pull-up = false : pull-down = false */ + + rp23xx_gpio_set_pulls(g_buttons[i], false, false); + } + + return NUM_BUTTONS; +} + +/**************************************************************************** + * Name: board_buttons + ****************************************************************************/ + +uint32_t board_buttons(void) +{ + uint32_t ret = 0; + int i; + + /* Check that state of each key */ + + for (i = 0; i < NUM_BUTTONS; i++) + { + /* A LOW value means that the key is pressed. */ + + bool released = rp23xx_gpio_get(g_buttons[i]); + + /* Accumulate the set of depressed (not released) keys */ + + if (!released) + { + ret |= (1 << i); + } + } + + return ret; +} + +/**************************************************************************** + * Button support. + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns + * an 32-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT definitions in board.h for the meaning of each bit. + * + * board_button_irq() may be called to register an interrupt handler that + * will be called when a button is depressed or released. The ID value is + * a button enumeration value that uniquely identifies a button resource. + * See the BUTTON_* definitions in board.h for the meaning of enumeration + * value. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_IRQBUTTONS +int board_button_irq(int id, xcpt_t irqhandler, void *arg) +{ + int ret = -EINVAL; + + /* The following should be atomic */ + + if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) + { + /* Make sure the interrupt is disabled */ + + rp23xx_gpio_disable_irq(g_buttons[id]); + + /* Attach the interrupt handler */ + + ret = rp23xx_gpio_irq_attach(g_buttons[id], + RP23XX_GPIO_INTR_EDGE_LOW, + irqhandler, + arg); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: irq_attach() failed: %d\n", ret); + return ret; + } + + /* Enable interruption for this pin */ + + rp23xx_gpio_enable_irq(g_buttons[id]); + } + + return ret; +} +#endif + +#endif /* CONFIG_ARCH_BUTTONS */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_firmware.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_firmware.c new file mode 100644 index 0000000000000..3389f67f59384 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_firmware.c @@ -0,0 +1,160 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_firmware.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define _STR(x) #x +#define STR(x) _STR(x) + +#define ROUNDED_FIRMWARE_LEN ((CONFIG_CYW43439_FIRMWARE_LEN + 0xff) & ~0xff) + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifdef CONFIG_IEEE80211_INFINEON_CYW43439 + +/**************************************************************************** + * Character array of NVRAM image + * Generated from cyw943439wlpth_rev1_0.txt + * $ Copyright Broadcom Corporation $ + ****************************************************************************/ + +const uint8_t g_cyw43439_nvram_image[] __attribute__((aligned(4))) = + "NVRAMRev=$Rev$" "\x00" + "manfid=0x2d0" "\x00" + "prodid=0x0727" "\x00" + "vendid=0x14e4" "\x00" + "devid=0x43e2" "\x00" + "boardtype=0x0887" "\x00" + "boardrev=0x1100" "\x00" + "boardnum=22" "\x00" + "macaddr=00:A0:50:b5:59:5e" "\x00" + "sromrev=11" "\x00" + "boardflags=0x00404001" "\x00" + "boardflags3=0x04000000" "\x00" + "xtalfreq=37400" "\x00" + "nocrc=1" "\x00" + "ag0=255" "\x00" + "aa2g=1" "\x00" + "ccode=ALL" "\x00" + "pa0itssit=0x20" "\x00" + "extpagain2g=0" "\x00" + "pa2ga0=-168,6649,-778" "\x00" + "AvVmid_c0=0x0,0xc8" "\x00" + "cckpwroffset0=5" "\x00" + "maxp2ga0=84" "\x00" + "txpwrbckof=6" "\x00" + "cckbw202gpo=0" "\x00" + "legofdmbw202gpo=0x66111111" "\x00" + "mcsbw202gpo=0x77711111" "\x00" + "propbw202gpo=0xdd" "\x00" + "ofdmdigfilttype=18" "\x00" + "ofdmdigfilttypebe=18" "\x00" + "papdmode=1" "\x00" + "papdvalidtest=1" "\x00" + "pacalidx2g=45" "\x00" + "papdepsoffset=-30" "\x00" + "papdendidx=58" "\x00" + "ltecxmux=0" "\x00" + "ltecxpadnum=0x0102" "\x00" + "ltecxfnsel=0x44" "\x00" + "ltecxgcigpio=0x01" "\x00" + "il0macaddr=00:90:4c:c5:12:38" "\x00" + "wl0id=0x431b" "\x00" + "deadman_to=0xffffffff" "\x00" + "muxenab=0x100" "\x00" + "spurconfig=0x3" "\x00" + "glitch_based_crsmin=1" "\x00" + "btc_mode=1" "\x00" + "\x00\x00"; + +const unsigned int g_cyw43439_nvram_len = sizeof(g_cyw43439_nvram_image); + +/**************************************************************************** + * Include the firmware blob. This assembly code defines the global + * symbol g_cyw43439_firmware_image as the address of this included + * blob. This is similar in effect to the C statement: + * const uint8_t g_cyw43439_firmware_image[] = {...}; + * const uint8_t ng_cyw43439_clm_blob_image[] = {...}; + ****************************************************************************/ + +/* These are defined as array because the symbols name an actual address + * not a pointer to an address. This is not one of the many cases where + * pointers and arrays are interchangeable in C. + */ + +extern const uint8_t g_cyw43439_firmware_image[]; +extern const uint8_t g_cyw43439_clm_blob_image[]; +extern const unsigned int g_cyw43439_clm_blob_len; + +/* This assembly code does the following: + * - Force 16-byte alignment + * - Defines g_cyw43439_firmware_image as a location in memory + * - Copies the firmware image file data to that location. + * - Defines g_cyw43439_firmware_end as the location directly beyond + * that data. + * - Defines g_cyw43439_clm_blob_image as a location within that + * data where the clm_blob begins. + * - Force 4-byte alignment + * - Allocates an integer named g_cyw43439_clm_blob_len that + * contains the length of the clm_blob. + */ + +__asm__("\n .balign 16" + "\n .globl g_cyw43439_firmware_image" + "\n .globl g_cyw43439_clm_blob_image" + "\n .globl g_cyw43439_clm_blob_len" + "\n g_cyw43439_firmware_image:" + "\n .incbin \"cyw43439.firmware.image\"" + "\n firmware_end:" + "\n g_cyw43439_clm_blob_image=g_cyw43439_firmware_image+" + STR(ROUNDED_FIRMWARE_LEN) + "\n .balign 4" + "\n g_cyw43439_clm_blob_len:" + "\n .word firmware_end-g_cyw43439_clm_blob_image" + "\n"); + +/**************************************************************************** + * Other CYW43439 Firmware global definitions + ****************************************************************************/ + +#ifndef CONFIG_IEEE80211_BROADCOM_FWFILES + +const unsigned int g_cyw43439_firmware_len = CONFIG_CYW43439_FIRMWARE_LEN; + +#endif /* CONFIG_IEEE80211_BROADCOM_FWFILES */ + +#endif /* CONFIG_IEEE80211_INFINEON_CYW43439 */ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_gpio.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_gpio.c new file mode 100644 index 0000000000000..cc6b3810ca39e --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_gpio.c @@ -0,0 +1,392 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_gpio.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "arm_internal.h" +#include "chip.h" +#include "rp23xx_gpio.h" + +#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF) + +/* Output pins. GPIO25 is onboard LED any other outputs could be used. + */ + +#define GPIO_OUT1 25 + +/* Input pins. + */ + +#define GPIO_IN1 6 + +/* Interrupt pins. + */ + +#define GPIO_IRQPIN1 14 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct rp23xxgpio_dev_s +{ + struct gpio_dev_s gpio; + uint8_t id; +}; + +struct rp23xxgpint_dev_s +{ + struct rp23xxgpio_dev_s rp23xxgpio; + pin_interrupt_t callback; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +#if BOARD_NGPIOOUT > 0 +static int gpout_read(struct gpio_dev_s *dev, bool *value); +static int gpout_write(struct gpio_dev_s *dev, bool value); +#endif + +#if BOARD_NGPIOIN > 0 +static int gpin_read(struct gpio_dev_s *dev, bool *value); +#endif + +#if BOARD_NGPIOINT > 0 +static int gpint_read(struct gpio_dev_s *dev, bool *value); +static int gpint_attach(struct gpio_dev_s *dev, + pin_interrupt_t callback); +static int gpint_enable(struct gpio_dev_s *dev, bool enable); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#if BOARD_NGPIOOUT > 0 +static const struct gpio_operations_s gpout_ops = +{ + .go_read = gpout_read, + .go_write = gpout_write, + .go_attach = NULL, + .go_enable = NULL, +}; + +/* This array maps the GPIO pins used as OUTPUT */ + +static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] = +{ + GPIO_OUT1 +}; + +static struct rp23xxgpio_dev_s g_gpout[BOARD_NGPIOOUT]; +#endif + +#if BOARD_NGPIOIN > 0 +static const struct gpio_operations_s gpin_ops = +{ + .go_read = gpin_read, + .go_write = NULL, + .go_attach = NULL, + .go_enable = NULL, +}; + +/* This array maps the GPIO pins used as INTERRUPT INPUTS */ + +static const uint32_t g_gpioinputs[BOARD_NGPIOIN] = +{ + GPIO_IN1 +}; + +static struct rp23xxgpio_dev_s g_gpin[BOARD_NGPIOIN]; +#endif + +#if BOARD_NGPIOINT > 0 +static const struct gpio_operations_s gpint_ops = +{ + .go_read = gpint_read, + .go_write = NULL, + .go_attach = gpint_attach, + .go_enable = gpint_enable, +}; + +/* This array maps the GPIO pins used as INTERRUPT INPUTS */ + +static const uint32_t g_gpiointinputs[BOARD_NGPIOINT] = +{ + GPIO_IRQPIN1, +}; + +static struct rp23xxgpint_dev_s g_gpint[BOARD_NGPIOINT]; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: gpout_read + ****************************************************************************/ + +#if BOARD_NGPIOOUT > 0 +static int gpout_read(struct gpio_dev_s *dev, bool *value) +{ + struct rp23xxgpio_dev_s *rp23xxgpio = + (struct rp23xxgpio_dev_s *)dev; + + DEBUGASSERT(rp23xxgpio != NULL && value != NULL); + DEBUGASSERT(rp23xxgpio->id < BOARD_NGPIOOUT); + gpioinfo("Reading...\n"); + + *value = rp23xx_gpio_get(g_gpiooutputs[rp23xxgpio->id]); + return OK; +} + +/**************************************************************************** + * Name: gpout_write + ****************************************************************************/ + +static int gpout_write(struct gpio_dev_s *dev, bool value) +{ + struct rp23xxgpio_dev_s *rp23xxgpio = + (struct rp23xxgpio_dev_s *)dev; + + DEBUGASSERT(rp23xxgpio != NULL); + DEBUGASSERT(rp23xxgpio->id < BOARD_NGPIOOUT); + gpioinfo("Writing %d\n", (int)value); + + rp23xx_gpio_put(g_gpiooutputs[rp23xxgpio->id], value); + return OK; +} +#endif + +/**************************************************************************** + * Name: gpin_read + ****************************************************************************/ + +#if BOARD_NGPIOIN > 0 +static int gpin_read(struct gpio_dev_s *dev, bool *value) +{ + struct rp23xxgpio_dev_s *rp23xxgpio = + (struct rp23xxgpio_dev_s *)dev; + + DEBUGASSERT(rp23xxgpio != NULL && value != NULL); + DEBUGASSERT(rp23xxgpio->id < BOARD_NGPIOIN); + gpioinfo("Reading... pin %d\n", (int)g_gpioinputs[rp23xxgpio->id]); + + *value = rp23xx_gpio_get(g_gpioinputs[rp23xxgpio->id]); + return OK; +} +#endif + +/**************************************************************************** + * Name: rp23xxgpio_interrupt + ****************************************************************************/ + +#if BOARD_NGPIOINT > 0 +static int rp23xxgpio_interrupt(int irq, void *context, void *arg) +{ + struct rp23xxgpint_dev_s *rp23xxgpint = + (struct rp23xxgpint_dev_s *)arg; + + DEBUGASSERT(rp23xxgpint != NULL && rp23xxgpint->callback != NULL); + gpioinfo("Interrupt! callback=%p\n", rp23xxgpint->callback); + + rp23xxgpint->callback(&rp23xxgpint->rp23xxgpio.gpio, + rp23xxgpint->rp23xxgpio.id); + return OK; +} + +/**************************************************************************** + * Name: gpint_read + ****************************************************************************/ + +static int gpint_read(struct gpio_dev_s *dev, bool *value) +{ + struct rp23xxgpint_dev_s *rp23xxgpint = + (struct rp23xxgpint_dev_s *)dev; + + DEBUGASSERT(rp23xxgpint != NULL && value != NULL); + DEBUGASSERT(rp23xxgpint->rp23xxgpio.id < BOARD_NGPIOINT); + gpioinfo("Reading int pin...\n"); + + *value = rp23xx_gpio_get(g_gpiointinputs[rp23xxgpint->rp23xxgpio.id]); + return OK; +} + +/**************************************************************************** + * Name: gpint_attach + ****************************************************************************/ + +static int gpint_attach(struct gpio_dev_s *dev, + pin_interrupt_t callback) +{ + struct rp23xxgpint_dev_s *rp23xxgpint = + (struct rp23xxgpint_dev_s *)dev; + int irq = g_gpiointinputs[rp23xxgpint->rp23xxgpio.id]; + int ret; + + gpioinfo("Attaching the callback\n"); + + /* Make sure the interrupt is disabled */ + + rp23xx_gpio_disable_irq(irq); + ret = rp23xx_gpio_irq_attach(irq, + RP23XX_GPIO_INTR_EDGE_LOW, + rp23xxgpio_interrupt, + &g_gpint[rp23xxgpint->rp23xxgpio.id]); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: gpint_attach() failed: %d\n", ret); + return ret; + } + + gpioinfo("Attach %p\n", callback); + rp23xxgpint->callback = callback; + return OK; +} + +/**************************************************************************** + * Name: gpint_enable + ****************************************************************************/ + +static int gpint_enable(struct gpio_dev_s *dev, bool enable) +{ + struct rp23xxgpint_dev_s *rp23xxgpint = + (struct rp23xxgpint_dev_s *)dev; + int irq = g_gpiointinputs[rp23xxgpint->rp23xxgpio.id]; + + if (enable) + { + if (rp23xxgpint->callback != NULL) + { + gpioinfo("Enabling the interrupt\n"); + + /* Configure the interrupt for rising edge */ + + rp23xx_gpio_enable_irq(irq); + } + } + else + { + gpioinfo("Disable the interrupt\n"); + rp23xx_gpio_disable_irq(irq); + } + + return OK; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rp23xx_dev_gpio_init + ****************************************************************************/ + +int rp23xx_dev_gpio_init(void) +{ + int i; + int pincount = 0; + +#if BOARD_NGPIOOUT > 0 + for (i = 0; i < BOARD_NGPIOOUT; i++) + { + /* Setup and register the GPIO pin */ + + g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN; + g_gpout[i].gpio.gp_ops = &gpout_ops; + g_gpout[i].id = i; + gpio_pin_register(&g_gpout[i].gpio, g_gpiooutputs[i]); + + /* Configure the pins that will be used as output */ + + rp23xx_gpio_init(g_gpiooutputs[i]); + rp23xx_gpio_setdir(g_gpiooutputs[i], true); + rp23xx_gpio_put(g_gpiooutputs[i], false); + + pincount++; + } +#endif + + pincount = 0; + +#if BOARD_NGPIOIN > 0 + for (i = 0; i < BOARD_NGPIOIN; i++) + { + /* Setup and register the GPIO pin */ + + g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN; + g_gpin[i].gpio.gp_ops = &gpin_ops; + g_gpin[i].id = i; + gpio_pin_register(&g_gpin[i].gpio, g_gpioinputs[i]); + + /* Configure the pins that will be used as INPUT */ + + rp23xx_gpio_init(g_gpioinputs[i]); + + pincount++; + } +#endif + + pincount = 0; + +#if BOARD_NGPIOINT > 0 + for (i = 0; i < BOARD_NGPIOINT; i++) + { + /* Setup and register the GPIO pin */ + + g_gpint[i].rp23xxgpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN; + g_gpint[i].rp23xxgpio.gpio.gp_ops = &gpint_ops; + g_gpint[i].rp23xxgpio.id = i; + gpio_pin_register(&g_gpint[i].rp23xxgpio.gpio, g_gpiointinputs[i]); + + /* Configure the pins that will be used as interrupt input */ + + rp23xx_gpio_init(g_gpiointinputs[i]); + + /* pull-up = false : pull-down = true */ + + rp23xx_gpio_set_pulls(g_gpiointinputs[i], false, true); + + pincount++; + } +#endif + + return OK; +} +#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_pico.h b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_pico.h new file mode 100644 index 0000000000000..65bf3393709c8 --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_pico.h @@ -0,0 +1,53 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_pico.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_SRC_RP23XX_PICO_H +#define __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_SRC_RP23XX_PICO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/* LEDs */ + +#define GPIO_LED1 25 /* The board's LED is connected to this pin */ + +/* Buttons */ + +/* Buttons GPIO pins definition */ + +#define GPIO_BTN_USER1 16 +#define GPIO_BTN_USER2 17 + +/* Buttons IRQ definitions */ + +#define MIN_IRQBUTTON BUTTON_USER1 +#define MAX_IRQBUTTON BUTTON_USER2 +#define NUM_IRQBUTTONS (BUTTON_USER1 - BUTTON_USER2 + 1) + +int rp23xx_bringup(void); + +#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_ARCH_BOARD_COMMON) +int rp23xx_dev_gpio_init(void); +#endif + +#endif /* __BOARDS_ARM_RP23XX_RASPBERRYPI_PICO_2_SRC_RP23XX_PICO_H */ diff --git a/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_userleds.c b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_userleds.c new file mode 100644 index 0000000000000..7e95de4917fcb --- /dev/null +++ b/boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_userleds.c @@ -0,0 +1,214 @@ +/**************************************************************************** + * boards/arm/rp23xx/raspberrypi-pico-2-w/src/rp23xx_userleds.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include "chip.h" +#include "rp23xx_gpio.h" + +#include "rp23xx_pico.h" + +#ifndef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* This array maps an LED number to GPIO pin configuration */ + +static uint32_t g_ledcfg[BOARD_NLEDS] = +{ + GPIO_LED1, +}; + +/**************************************************************************** + * Private Function Protototypes + ****************************************************************************/ + +/* LED Power Management */ + +#ifdef CONFIG_PM +static void led_pm_notify(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate); +static int led_pm_prepare(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef CONFIG_PM +static struct pm_callback_s g_ledscb = +{ + .notify = led_pm_notify, + .prepare = led_pm_prepare, +}; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: led_pm_notify + * + * Description: + * Notify the driver of new power state. This callback is called after + * all drivers have had the opportunity to prepare for the new power state. + * + ****************************************************************************/ + +#ifdef CONFIG_PM +static void led_pm_notify(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate) +{ + switch (pmstate) + { + case PM_NORMAL: + { + /* Restore normal LEDs operation */ + + board_userled(BOARD_LED, true); + } + break; + + case PM_IDLE: + { + /* Entering IDLE mode - Turn leds off */ + + board_userled(BOARD_LED, false); + } + break; + + case PM_STANDBY: + { + /* Entering STANDBY mode - Logic for PM_STANDBY goes here */ + } + break; + + case PM_SLEEP: + { + /* Entering SLEEP mode - Logic for PM_SLEEP goes here */ + } + break; + + default: + { + /* Should not get here */ + } + break; + } +} +#endif + +/**************************************************************************** + * Name: led_pm_prepare + * + * Description: + * Request the driver to prepare for a new power state. This is a warning + * that the system is about to enter into a new power state. The driver + * should begin whatever operations that may be required to enter power + * state. The driver may abort the state change mode by returning a + * non-zero value from the callback function. + * + ****************************************************************************/ + +#ifdef CONFIG_PM +static int led_pm_prepare(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate) +{ + /* No preparation to change power modes is required by the LEDs driver. + * We always accept the state change by returning OK. + */ + + return OK; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_userled_initialize + ****************************************************************************/ + +uint32_t board_userled_initialize(void) +{ + /* Configure LED GPIO for output */ + + rp23xx_gpio_init(GPIO_LED1); + rp23xx_gpio_setdir(GPIO_LED1, true); + + return BOARD_NLEDS; +} + +/**************************************************************************** + * Name: board_userled + ****************************************************************************/ + +void board_userled(int led, bool ledon) +{ + if ((unsigned)led < BOARD_NLEDS) + { + rp23xx_gpio_put(g_ledcfg[led], ledon); + } +} + +/**************************************************************************** + * Name: board_userled_all + ****************************************************************************/ + +void board_userled_all(uint32_t ledset) +{ + rp23xx_gpio_put(GPIO_LED1, (ledset & BOARD_LED1_BIT)); +} + +/**************************************************************************** + * Name: rp23xx_led_pminitialize + ****************************************************************************/ + +#ifdef CONFIG_PM +void rp23xx_led_pminitialize(void) +{ + /* Register to receive power management callbacks */ + + int ret = pm_register(&g_ledscb); + if (ret != OK) + { + board_autoled_on(LED_ASSERTION); + } +} +#endif /* CONFIG_PM */ + +#endif /* !CONFIG_ARCH_LEDS */