From 33e6532a53c83c73ee3a2dd78962a0f10c5d0d89 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 22 Mar 2021 16:28:03 +0000 Subject: [PATCH] Clock initialization using the SDK, no settings. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14080 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- demos/RP/RT-RP2040-PICO/Makefile | 4 ++-- os/common/ext/RP/RP2040/rp2040.h | 2 -- os/hal/ports/RP/RP2040/hal_lld.c | 5 ++++- os/hal/ports/RP/RP2040/hal_lld.h | 2 +- os/various/pico_bindings/pico-sdk.mk | 6 +++++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/demos/RP/RT-RP2040-PICO/Makefile b/demos/RP/RT-RP2040-PICO/Makefile index 2b0742a79..82223112d 100644 --- a/demos/RP/RT-RP2040-PICO/Makefile +++ b/demos/RP/RT-RP2040-PICO/Makefile @@ -121,7 +121,7 @@ LDSCRIPT= $(STARTUPLD)/RP2040_RAM.ld # setting. CSRC = $(ALLCSRC) \ $(TESTSRC) \ - $(PICOSDKROOT)/src/rp2_common/hardware_clocks/clocks.c \ + $(CHIBIOS)/os/various/syscalls.c \ main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global @@ -152,7 +152,7 @@ CPPWARN = -Wall -Wextra -Wundef # # List all user C define here, like -D_DEBUG=1 -UDEFS = -DCRT0_VTOR_INIT=1 +UDEFS = -DCRT0_VTOR_INIT=1 -DPICO_NO_FPGA_CHECK # Define ASM defines here UADEFS = -DCRT0_VTOR_INIT=1 diff --git a/os/common/ext/RP/RP2040/rp2040.h b/os/common/ext/RP/RP2040/rp2040.h index f4c2de31d..7dc12848a 100644 --- a/os/common/ext/RP/RP2040/rp2040.h +++ b/os/common/ext/RP/RP2040/rp2040.h @@ -84,8 +84,6 @@ typedef struct { __IO uint32_t xxx; } XXX_TypeDef; -#define XIP_BASE 0x10000000U - #define PERIPH_BASE 0x40000000U /** diff --git a/os/hal/ports/RP/RP2040/hal_lld.c b/os/hal/ports/RP/RP2040/hal_lld.c index 297843a5b..af68314cc 100644 --- a/os/hal/ports/RP/RP2040/hal_lld.c +++ b/os/hal/ports/RP/RP2040/hal_lld.c @@ -24,6 +24,9 @@ #include "hal.h" +/* From Pico-SDK */ +#include "hardware/clocks.h" + /*===========================================================================*/ /* Driver local definitions. */ /*===========================================================================*/ @@ -75,7 +78,7 @@ void hal_lld_init(void) { void rp_clock_init(void) { #if !RP_NO_INIT - + clocks_init(); #endif /* RP_NO_INIT */ } diff --git a/os/hal/ports/RP/RP2040/hal_lld.h b/os/hal/ports/RP/RP2040/hal_lld.h index 07d1edbdd..77674a20a 100644 --- a/os/hal/ports/RP/RP2040/hal_lld.h +++ b/os/hal/ports/RP/RP2040/hal_lld.h @@ -87,7 +87,7 @@ #error "RP_XOSCCLK not defined in board.h" #endif -#define RP_CORE_CK RP_ROSCCLK +#define RP_CORE_CK 125000000 /*===========================================================================*/ /* Driver data structures and types. */ diff --git a/os/various/pico_bindings/pico-sdk.mk b/os/various/pico_bindings/pico-sdk.mk index 963fa2f95..f9beb08b5 100644 --- a/os/various/pico_bindings/pico-sdk.mk +++ b/os/various/pico_bindings/pico-sdk.mk @@ -1,6 +1,10 @@ # Pico-SDK files. PICOSDKROOT := $(CHIBIOS)/ext/pico-sdk -PICOSDKSRC = + +PICOSDKSRC = $(PICOSDKROOT)/src/rp2_common/hardware_clocks/clocks.c \ + $(PICOSDKROOT)/src/rp2_common/hardware_pll/pll.c \ + $(PICOSDKROOT)/src/rp2_common/hardware_watchdog/watchdog.c \ + $(PICOSDKROOT)/src/rp2_common/hardware_xosc/xosc.c \ PICOSDKINC = $(CHIBIOS)//os/various/pico_bindings/dumb/include \ $(PICOSDKROOT)/src/common/pico_base/include \