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

Hal rpi pico cleanup #84545

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion drivers/adc/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ config ADC_RPI_PICO
bool "Raspberry Pi Pico ADC driver"
default y
depends on DT_HAS_RASPBERRYPI_PICO_ADC_ENABLED
select PICOSDK_USE_ADC
select PINCTRL
depends on RESET
2 changes: 1 addition & 1 deletion drivers/clock_control/clock_control_rpi_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ static int clock_control_rpi_pico_init(const struct device *dev)
RESETS_RESET_USBCTRL_BITS));

/* Start tick in watchdog */
watchdog_start_tick(cycles_per_tick);
tick_start(TICK_WATCHDOG, cycles_per_tick);
#if defined(CONFIG_SOC_SERIES_RP2350)
tick_start(TICK_TIMER0, cycles_per_tick);
tick_start(TICK_TIMER1, cycles_per_tick);
Expand Down
1 change: 0 additions & 1 deletion drivers/counter/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
config COUNTER_TIMER_RPI_PICO
def_bool y
select PICOSDK_USE_TIMER
select PICOSDK_USE_CLAIM
depends on DT_HAS_RASPBERRYPI_PICO_TIMER_ENABLED
2 changes: 0 additions & 2 deletions drivers/dma/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ config DMA_RPI_PICO
bool "Raspberry Pi Pico DMA driver"
default y
depends on DT_HAS_RASPBERRYPI_PICO_DMA_ENABLED
select PICOSDK_USE_DMA
select PICOSDK_USE_CLAIM
depends on RESET
help
DMA driver for RaspberryPi Pico.
1 change: 0 additions & 1 deletion drivers/pwm/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ config PWM_RPI_PICO
default y
depends on DT_HAS_RASPBERRYPI_PICO_PWM_ENABLED
depends on RESET
select PICOSDK_USE_PWM
select PINCTRL
help
Enable PWM driver for RPi Pico family of MCUs
1 change: 0 additions & 1 deletion drivers/serial/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ config UART_RPI_PICO_PIO
depends on DT_HAS_RASPBERRYPI_PICO_UART_PIO_ENABLED
select SERIAL_HAS_DRIVER
select PICOSDK_USE_PIO
select PICOSDK_USE_CLAIM
select PINCTRL
depends on RESET
1 change: 0 additions & 1 deletion drivers/spi/Kconfig.rpi_pico
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ config SPI_RPI_PICO_PIO
default y
depends on DT_HAS_RASPBERRYPI_PICO_SPI_PIO_ENABLED
select PICOSDK_USE_PIO
select PICOSDK_USE_CLAIM
select PINCTRL
help
Enable driving SPI via PIO on the PICO
97 changes: 35 additions & 62 deletions modules/hal_rpi_pico/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,18 @@ if(CONFIG_HAS_RPI_PICO)
zephyr_compile_definitions(PICO_RP2350)
endif()

zephyr_compile_definitions(PICO_NO_FPGA_CHECK)
zephyr_compile_definitions(PICO_NO_SIM_CHECK)

# Pico sources and headers necessary for every build.
# These contain definitions and implementation used mostly for
# initializing the SoC, and therefore are always required.

zephyr_library_sources(
${rp2_common_dir}/hardware_clocks/clocks.c
${rp2_common_dir}/hardware_pll/pll.c
${rp2_common_dir}/hardware_xosc/xosc.c
${rp2_common_dir}/hardware_watchdog/watchdog.c
${rp2_common_dir}/hardware_sync_spin_lock/sync_spin_lock.c
${rp2_common_dir}/hardware_ticks/ticks.c
${rp2_common_dir}/pico_bootrom/bootrom.c
${rp2xxx_dir}/pico_platform/platform.c
)

zephyr_include_directories(
${common_dir}/boot_picoboot_headers/include
${common_dir}/boot_picobin_headers/include
${common_dir}/pico_base_headers/include
${common_dir}/hardware_claim/include
${rp2_common_dir}/boot_bootrom_headers/include
${rp2_common_dir}/hardware_base/include
${rp2_common_dir}/hardware_clocks/include
Expand All @@ -82,81 +77,59 @@ if(CONFIG_HAS_RPI_PICO)
${rp2_common_dir}/hardware_boot_lock/include
${rp2_common_dir}/hardware_ticks/include
${rp2_common_dir}/hardware_sync_spin_lock/include
${rp2_common_dir}/hardware_xip_cache/include
${rp2_common_dir}/hardware_pwm/include
${rp2_common_dir}/hardware_adc/include
${rp2_common_dir}/hardware_dma/include
${rp2_common_dir}/hardware_gpio/include
${rp2_common_dir}/hardware_flash/include
${rp2_common_dir}/hardware_rtc/include
${rp2_common_dir}/hardware_pio/include
${rp2_common_dir}/pico_bootrom/include
${rp2_common_dir}/pico_flash/include
${rp2_common_dir}/pico_platform_compiler/include
${rp2_common_dir}/pico_platform_sections/include
${rp2_common_dir}/pico_platform_panic/include
${common_dir}/boot_picoboot_headers/include
${common_dir}/boot_picobin_headers/include
${rp2_common_dir}/pico_runtime/include
${rp2_common_dir}/pico_runtime_init/include
${rp2xxx_dir}/hardware_regs/include
${rp2xxx_dir}/hardware_structs/include
${rp2xxx_dir}/pico_platform/include
${CMAKE_CURRENT_LIST_DIR}
)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_GPIO
${rp2_common_dir}/hardware_gpio/gpio.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_GPIO
${rp2_common_dir}/hardware_gpio/include)
zephyr_library_sources(
${common_dir}/hardware_claim/claim.c
${rp2_common_dir}/hardware_clocks/clocks.c
${rp2_common_dir}/hardware_pll/pll.c
${rp2_common_dir}/hardware_xosc/xosc.c
${rp2_common_dir}/hardware_sync_spin_lock/sync_spin_lock.c
${rp2_common_dir}/hardware_ticks/ticks.c
${rp2_common_dir}/pico_bootrom/bootrom.c
)

zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_UART
${rp2_common_dir}/hardware_uart/include)
zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_GPIO
${rp2_common_dir}/hardware_gpio/gpio.c)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_FLASH
${rp2_common_dir}/hardware_flash/flash.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_FLASH
${rp2_common_dir}/hardware_flash/include)

zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_PWM
${rp2_common_dir}/hardware_pwm/include)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_ADC
${rp2_common_dir}/hardware_adc/adc.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_ADC
${rp2_common_dir}/hardware_adc/include)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_DMA
${rp2_common_dir}/hardware_dma/dma.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_DMA
${rp2_common_dir}/hardware_dma/include)
${rp2_common_dir}/hardware_flash/flash.c
${rp2_common_dir}/hardware_xip_cache/xip_cache.c)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_TIMER
${rp2_common_dir}/hardware_timer/timer.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_TIMER
${rp2_common_dir}/hardware_timer/include)
${rp2_common_dir}/hardware_timer/timer.c)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_RTC
${rp2_common_dir}/hardware_rtc/rtc.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_RTC
${rp2_common_dir}/hardware_rtc/include)
${rp2_common_dir}/hardware_rtc/rtc.c)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_PIO
${rp2_common_dir}/hardware_pio/pio.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_PIO
${rp2_common_dir}/hardware_pio/include)
${rp2_common_dir}/hardware_pio/pio.c)

zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_RP2350
${rp2_common_dir}/pico_runtime_init/runtime_init.c)

# Some flash driver functions must be executed from the RAM.
# Originally pico-sdk places them in the RW data section, so this
# implementation does the same.
zephyr_linker_sources_ifdef(CONFIG_PICOSDK_USE_FLASH RWDATA timecritical.ld)

# A function in flash.c adds 1 to a function pointer, causing a warning
set_source_files_properties(
${rp2_common_dir}/hardware_flash/flash.c
PROPERTIES
COMPILE_FLAGS $<TARGET_PROPERTY:compiler,warning_no_pointer_arithmetic>
)

zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_CLAIM
${common_dir}/hardware_claim/claim.c)
zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_CLAIM
${common_dir}/hardware_claim/include)

zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_RP2350
${rp2_common_dir}/pico_runtime_init/runtime_init.c)
zephyr_include_directories_ifdef(CONFIG_SOC_SERIES_RP2350
${rp2_common_dir}/pico_runtime/include
${rp2_common_dir}/pico_runtime_init/include)

endif()
26 changes: 0 additions & 26 deletions modules/hal_rpi_pico/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
config HAS_RPI_PICO
bool

config PICOSDK_USE_UART
bool
help
Use the UART driver from pico-sdk

config PICOSDK_USE_GPIO
bool
help
Expand All @@ -19,32 +14,11 @@ config PICOSDK_USE_FLASH
help
Use the flash driver from pico-sdk

config PICOSDK_USE_PWM
bool
help
Use the PWM driver from pico-sdk

config PICOSDK_USE_ADC
bool
help
Use the ADC driver from pico-sdk

config PICOSDK_USE_DMA
bool
help
Use the DMA driver from pico-sdk

config PICOSDK_USE_PIO
bool
select PICOSDK_USE_CLAIM
help
Use the PIO driver from pico-sdk

config PICOSDK_USE_CLAIM
bool
help
Use the "claim" driver from pico-sdk

config PICOSDK_USE_TIMER
bool
help
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ manifest:
- hal
- name: hal_rpi_pico
path: modules/hal/rpi_pico
revision: 7b57b24588797e6e7bf18b6bda168e6b96374264
revision: pull/9/head
groups:
- hal
- name: hal_silabs
Expand Down
Loading