Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Waveshare RP2040 board series #124

Merged
merged 12 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/qa-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ jobs:
--platform seeeduino_xiao \
--platform seeeduino_lotus \
--platform seeeduino_lotus@usbcons \
--platform waveshare_rp2040_plus \
--platform waveshare_rp2040_plus@usbcons \
--platform waveshare_rp2040_plus@16mb \
--platform waveshare_rp2040_plus@16mb@usbcons \
--testsuite-root bridle/tests/shields/grove/dts_bindings \
--testsuite-root bridle/tests/shields/x_grove_testbed/dts_bindings

Expand Down
30 changes: 30 additions & 0 deletions boards/arm/waveshare_rp2040/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2023 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config BOARD_WAVESHARE_RP2040_ONE
bool "Waveshare RP2040-One Board"
depends on SOC_RP2040

config BOARD_WAVESHARE_RP2040_ZERO
bool "Waveshare RP2040-Zero Board"
depends on SOC_RP2040

config BOARD_WAVESHARE_RP2040_MATRIX
bool "Waveshare RP2040-Matrix Board"
depends on SOC_RP2040

config BOARD_WAVESHARE_RP2040_TINY
bool "Waveshare RP2040-Tiny Board"
depends on SOC_RP2040

config BOARD_WAVESHARE_RP2040_ETH
bool "Waveshare RP2040-ETH Board"
depends on SOC_RP2040

config BOARD_WAVESHARE_RP2040_LCD_0_96
bool "Waveshare RP2040-LCD-0.96 Board"
depends on SOC_RP2040

config BOARD_WAVESHARE_RP2040_PLUS
bool "Waveshare RP2040-Plus Board"
depends on SOC_RP2040
105 changes: 105 additions & 0 deletions boards/arm/waveshare_rp2040/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright (c) 2023 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config BOARD
default "waveshare_rp2040_one" if BOARD_WAVESHARE_RP2040_ONE
default "waveshare_rp2040_zero" if BOARD_WAVESHARE_RP2040_ZERO
default "waveshare_rp2040_matrix" if BOARD_WAVESHARE_RP2040_MATRIX
default "waveshare_rp2040_tiny" if BOARD_WAVESHARE_RP2040_TINY
default "waveshare_rp2040_eth" if BOARD_WAVESHARE_RP2040_ETH
default "waveshare_rp2040_lcd_0_96" if BOARD_WAVESHARE_RP2040_LCD_0_96
default "waveshare_rp2040_plus" if BOARD_WAVESHARE_RP2040_PLUS
depends on BOARD_WAVESHARE_RP2040

config BOARD_WAVESHARE_RP2040_MINI
bool
default y if BOARD_WAVESHARE_RP2040_ONE
default y if BOARD_WAVESHARE_RP2040_ZERO
default y if BOARD_WAVESHARE_RP2040_MATRIX
default y if BOARD_WAVESHARE_RP2040_TINY
default n

config BOARD_WAVESHARE_RP2040_PICO
bool
default y if BOARD_WAVESHARE_RP2040_ETH
default y if BOARD_WAVESHARE_RP2040_LCD_0_96
default y if BOARD_WAVESHARE_RP2040_PLUS
default n

config BOARD_WAVESHARE_RP2040
bool
default y if BOARD_WAVESHARE_RP2040_MINI
default y if BOARD_WAVESHARE_RP2040_PICO
default n

config RP2_FLASH_W25Q080
default y
depends on BOARD_WAVESHARE_RP2040

config RESET
default y
depends on DT_HAS_RASPBERRYPI_PICO_RESET_ENABLED

config GPIO
default y
depends on DT_HAS_RASPBERRYPI_PICO_GPIO_ENABLED

choice WS2812_STRIP_DRIVER
default WS2812_STRIP_RPI_PICO_PIO
depends on DT_HAS_WORLDSEMI_WS2812_RPI_PICO_PIO_ENABLED
endchoice

config I2C_DW_CLOCK_SPEED
default 125
depends on I2C_DW && BOARD_WAVESHARE_RP2040

config USB_SELF_POWERED
default n
depends on USB_DEVICE_STACK && BOARD_WAVESHARE_RP2040

config USB_MAX_POWER
default 150 if BOARD_WAVESHARE_RP2040_ONE # 300mA
default 240 if BOARD_WAVESHARE_RP2040_ZERO # 480mA
default 150 if BOARD_WAVESHARE_RP2040_MATRIX # 300mA
default 150 if BOARD_WAVESHARE_RP2040_TINY # 300mA
default 240 if BOARD_WAVESHARE_RP2040_ETH # 480mA
default 250 if BOARD_WAVESHARE_RP2040_LCD_0_96 # 500mA
default 250 if BOARD_WAVESHARE_RP2040_PLUS # 500mA
depends on USB_DEVICE_STACK && BOARD_WAVESHARE_RP2040

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CONSOLE := zephyr,console
DT_COMPAT_Z_CDC_ACM_UART := zephyr,cdc-acm-uart
DT_COMPAT_RPIPICO_USB := raspberrypi,pico-usbd

# Macros to shorten Kconfig expressions
DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE))
DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE))

if BOARD_WAVESHARE_RP2040 && \
$(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \
$(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \
$(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_RPIPICO_USB))

# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
depends on LOG
endchoice

# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
depends on LOG
endchoice

# Wait 4000ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 4000
depends on LOG

# Wait 4000ms at startup for USB enumeration on host side
config BOOT_DELAY
default 4000

endif # @usbcons
38 changes: 38 additions & 0 deletions boards/arm/waveshare_rp2040/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2023 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

# This configuration allows selecting what debug adapter debugging
# waveshare_rp2040 by a command-line argument. It is mainly intended
# to support both the 'picoprobe' and 'raspberrypi-swd' adapter described
# in "Getting started with Raspberry Pi Pico". Any other SWD debug adapter
# might also be usable with this configuration.

# Set WAVESHARE_RP2040_DEBUG_ADAPTER to select debug adapter by command-line
# arguments, e.g.:
#
# west build -b <waveshare_rp2040_BOARD_VARIANT> \
# -- -DWAVESHARE_RP2040_DEBUG_ADAPTER=raspberrypi-swd
#
# The value is treated as a part of an interface file name contained in the
# debugger configuration file. The value must be the 'stem' part of the name
# of one of the files in the OpenOCD interface configuration file. The setting
# is store to CMakeCache.txt.

if ("${WAVESHARE_RP2040_DEBUG_ADAPTER}" STREQUAL "")
set(WAVESHARE_RP2040_DEBUG_ADAPTER "cmsis-dap")
endif()

board_runner_args(openocd --cmd-pre-init "source [find interface/${WAVESHARE_RP2040_DEBUG_ADAPTER}.cfg]")
board_runner_args(openocd --cmd-pre-init "transport select swd")
board_runner_args(openocd --cmd-pre-init "source [find target/rp2040.cfg]")

# The adapter speed is expected to be set by interface configuration.
# But if not so, set 2000 to adapter speed.
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 2000")

board_runner_args(jlink "--device=RP2040_M0_0")
board_runner_args(uf2 "--board-id=RPI-RP2")

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
Loading
Loading