summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-04-25 23:00:48 +0700
committerhathach <[email protected]>2026-04-25 23:00:48 +0700
commit2dc90e364aa4354a2f07912a2fb6b22169928a35 (patch)
treeac006e58a7935c986882f546af5006a0cabbaa39 /hw
parentb87876b2760cf265b093637205c3e72e7550f521 (diff)
parent4c7fd70e53b34bf63ef9334f2b5624cac48299f1 (diff)
Merge branch 'master' into musb-followup-3594
# Conflicts: # src/common/tusb_types.h # src/portable/mentor/musb/dcd_musb.c
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/board.c4
-rw-r--r--hw/bsp/espressif/boards/family.c8
-rw-r--r--hw/bsp/espressif/family.cmake17
-rw-r--r--hw/bsp/mm32/family.c6
-rw-r--r--hw/bsp/samd11/family.c4
-rw-r--r--hw/bsp/samd2x_l2x/family.c2
-rw-r--r--hw/bsp/samg/family.c4
-rw-r--r--hw/bsp/tm4c/family.c2
8 files changed, 29 insertions, 18 deletions
diff --git a/hw/bsp/board.c b/hw/bsp/board.c
index ae58bb5fc..65b44e5f2 100644
--- a/hw/bsp/board.c
+++ b/hw/bsp/board.c
@@ -51,12 +51,12 @@ int sys_read(int fhdl, char *buf, size_t count) TU_ATTR_USED;
int sys_write(int fhdl, const char *buf, size_t count) {
(void) fhdl;
- return (int) SEGGER_RTT_Write(0, buf, (int) count);
+ return (int) SEGGER_RTT_Write(0, buf, (unsigned) count);
}
int sys_read(int fhdl, char *buf, size_t count) {
(void) fhdl;
- int rd = (int) SEGGER_RTT_Read(0, buf, count);
+ int rd = (int) SEGGER_RTT_Read(0, buf, (unsigned) count);
return (rd > 0) ? rd : -1;
}
#endif
diff --git a/hw/bsp/espressif/boards/family.c b/hw/bsp/espressif/boards/family.c
index 48b1253b6..4b28cecf2 100644
--- a/hw/bsp/espressif/boards/family.c
+++ b/hw/bsp/espressif/boards/family.c
@@ -49,7 +49,7 @@ static led_strip_handle_t led_strip;
static void max3421_init(void);
#endif
-#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4, OPT_MCU_ESP32S31)
static bool usb_init(uint8_t rhport, bool is_host);
#endif
@@ -111,10 +111,6 @@ void board_init(void) {
#endif
}
-#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4)
-
-#endif
-
//--------------------------------------------------------------------+
// Board porting API
//--------------------------------------------------------------------+
@@ -178,7 +174,7 @@ void board_reset_to_bootloader(void) {
// PHY Init
//--------------------------------------------------------------------
-#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4)
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_ESP32H4, OPT_MCU_ESP32P4, OPT_MCU_ESP32S31)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
#include "esp_private/usb_phy.h"
diff --git a/hw/bsp/espressif/family.cmake b/hw/bsp/espressif/family.cmake
index ca9eadaf6..30d5a6ac9 100644
--- a/hw/bsp/espressif/family.cmake
+++ b/hw/bsp/espressif/family.cmake
@@ -2,7 +2,10 @@
include("${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake")
string(TOUPPER ${IDF_TARGET} FAMILY_MCUS)
-# Device port default to Port1 for P4 (highspeed), Port0 for others (fullspeed)
+# Device/host port defaults:
+# - ESP32-P4 uses Port1 (highspeed)
+# - ESP32-S31 uses Port0 (highspeed)
+# - Other targets use Port0 and derive the default speed from RHPORT_SPEED
set(RHPORT_SPEED OPT_MODE_FULL_SPEED OPT_MODE_HIGH_SPEED)
if (NOT DEFINED RHPORT_DEVICE)
@@ -22,10 +25,18 @@ if (NOT DEFINED RHPORT_HOST)
endif()
if (NOT DEFINED RHPORT_DEVICE_SPEED)
- list(GET RHPORT_SPEED ${RHPORT_DEVICE} RHPORT_DEVICE_SPEED)
+ if (IDF_TARGET STREQUAL "esp32s31")
+ set(RHPORT_DEVICE_SPEED OPT_MODE_HIGH_SPEED)
+ else ()
+ list(GET RHPORT_SPEED ${RHPORT_DEVICE} RHPORT_DEVICE_SPEED)
+ endif ()
endif ()
if (NOT DEFINED RHPORT_HOST_SPEED)
- list(GET RHPORT_SPEED ${RHPORT_HOST} RHPORT_HOST_SPEED)
+ if (IDF_TARGET STREQUAL "esp32s31")
+ set(RHPORT_HOST_SPEED OPT_MODE_HIGH_SPEED)
+ else ()
+ list(GET RHPORT_SPEED ${RHPORT_HOST} RHPORT_HOST_SPEED)
+ endif ()
endif ()
# Add example src and bsp directories
diff --git a/hw/bsp/mm32/family.c b/hw/bsp/mm32/family.c
index 651c9496e..14a17f6c5 100644
--- a/hw/bsp/mm32/family.c
+++ b/hw/bsp/mm32/family.c
@@ -59,11 +59,11 @@ void OTG_FS_IRQHandler(void) {
void USB_DeviceClockInit(void) {
/* Select USBCLK source */
// RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_Div1);
- RCC->CFGR &= ~(0x3 << 22);
- RCC->CFGR |= (0x1 << 22);
+ RCC->CFGR &= ~(0x3U << 22);
+ RCC->CFGR |= (0x1U << 22);
/* Enable USB clock */
- RCC->AHB2ENR |= 0x1 << 7;
+ RCC->AHB2ENR |= 0x1U << 7;
}
void board_init(void) {
diff --git a/hw/bsp/samd11/family.c b/hw/bsp/samd11/family.c
index 0c987b85a..0864aa3dd 100644
--- a/hw/bsp/samd11/family.c
+++ b/hw/bsp/samd11/family.c
@@ -34,6 +34,8 @@
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#include "hal/include/hal_gpio.h"
@@ -66,7 +68,7 @@ void USB_Handler(void)
//--------------------------------------------------------------------+
/* Referenced GCLKs, should be initialized firstly */
-#define _GCLK_INIT_1ST (1 << 0 | 1 << 1)
+#define _GCLK_INIT_1ST (1u << 0 | 1u << 1)
/* Not referenced GCLKs, initialized last */
#define _GCLK_INIT_LAST (~_GCLK_INIT_1ST)
diff --git a/hw/bsp/samd2x_l2x/family.c b/hw/bsp/samd2x_l2x/family.c
index 11b6343cd..306ea2308 100644
--- a/hw/bsp/samd2x_l2x/family.c
+++ b/hw/bsp/samd2x_l2x/family.c
@@ -79,7 +79,7 @@
#ifdef SAMD21_FAMILY
/* Referenced GCLKs, should be initialized firstly */
-#define _GCLK_INIT_1ST (1 << 0 | 1 << 1)
+#define _GCLK_INIT_1ST (1u << 0 | 1u << 1)
/* Not referenced GCLKs, initialized last */
#define _GCLK_INIT_LAST (~_GCLK_INIT_1ST)
#endif
diff --git a/hw/bsp/samg/family.c b/hw/bsp/samg/family.c
index 519068986..9edc43b51 100644
--- a/hw/bsp/samg/family.c
+++ b/hw/bsp/samg/family.c
@@ -27,15 +27,17 @@
manufacturer: Microchip
*/
-#include "sam.h"
// Suppress warning caused by mcu driver
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
#pragma GCC diagnostic ignored "-Wredundant-decls"
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
+#include "sam.h"
#include "peripheral_clk_config.h"
#include "hal/include/hal_init.h"
#include "hal/include/hpl_usart_sync.h"
diff --git a/hw/bsp/tm4c/family.c b/hw/bsp/tm4c/family.c
index c5e4bd64e..4f85be220 100644
--- a/hw/bsp/tm4c/family.c
+++ b/hw/bsp/tm4c/family.c
@@ -36,7 +36,7 @@ static void board_uart_init(void) {
// BAUDRATE = 115200, with SystemCoreClock = 50 Mhz refer manual for calculation
// - BRDI = SystemCoreClock / (16* baud)
// - BRDF = int(fraction*64 + 0.5)
- UART0->CTL &= ~(1 << 0); // Disable UART0 by clearing UARTEN bit in the UARTCTL register
+ UART0->CTL &= ~(1U << 0); // Disable UART0 by clearing UARTEN bit in the UARTCTL register
UART0->IBRD = 27; // Write the integer portion of the BRD to the UARTIRD register
UART0->FBRD = 8; // Write the fractional portion of the BRD to the UARTFBRD registerer