-
Notifications
You must be signed in to change notification settings - Fork 952
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77c04e4
commit 5e9a5e8
Showing
36 changed files
with
2,915 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[submodule "tinyusb"] | ||
path = lib/tinyusb | ||
url = https://github.com/hathach/tinyusb.git | ||
[submodule "lib/cyw43-driver"] | ||
path = lib/cyw43-driver | ||
url = https://github.com/georgerobotics/cyw43-driver.git | ||
[submodule "lib/lwip"] | ||
path = lib/lwip | ||
url = https://github.com/lwip-tcpip/lwip.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cyw43-driver
added at
195dfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
// ----------------------------------------------------- | ||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO | ||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES | ||
// ----------------------------------------------------- | ||
|
||
// This header may be included by other board headers as "boards/pico.h" | ||
|
||
#ifndef _BOARDS_PICO_W_H | ||
#define _BOARDS_PICO_W_H | ||
|
||
// For board detection | ||
#define RASPBERRYPI_PICO_W | ||
|
||
// --- UART --- | ||
#ifndef PICO_DEFAULT_UART | ||
#define PICO_DEFAULT_UART 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_UART_TX_PIN | ||
#define PICO_DEFAULT_UART_TX_PIN 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_UART_RX_PIN | ||
#define PICO_DEFAULT_UART_RX_PIN 1 | ||
#endif | ||
|
||
// --- LED --- | ||
// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip | ||
// no PICO_DEFAULT_WS2812_PIN | ||
|
||
// --- I2C --- | ||
#ifndef PICO_DEFAULT_I2C | ||
#define PICO_DEFAULT_I2C 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_I2C_SDA_PIN | ||
#define PICO_DEFAULT_I2C_SDA_PIN 4 | ||
#endif | ||
#ifndef PICO_DEFAULT_I2C_SCL_PIN | ||
#define PICO_DEFAULT_I2C_SCL_PIN 5 | ||
#endif | ||
|
||
// --- SPI --- | ||
#ifndef PICO_DEFAULT_SPI | ||
#define PICO_DEFAULT_SPI 0 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_SCK_PIN | ||
#define PICO_DEFAULT_SPI_SCK_PIN 18 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_TX_PIN | ||
#define PICO_DEFAULT_SPI_TX_PIN 19 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_RX_PIN | ||
#define PICO_DEFAULT_SPI_RX_PIN 16 | ||
#endif | ||
#ifndef PICO_DEFAULT_SPI_CSN_PIN | ||
#define PICO_DEFAULT_SPI_CSN_PIN 17 | ||
#endif | ||
|
||
// --- FLASH --- | ||
|
||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 | ||
|
||
#ifndef PICO_FLASH_SPI_CLKDIV | ||
#define PICO_FLASH_SPI_CLKDIV 2 | ||
#endif | ||
|
||
#ifndef PICO_FLASH_SIZE_BYTES | ||
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) | ||
#endif | ||
|
||
// note the SMSP mode pin is on WL_GPIO1 | ||
// #define PICO_SMPS_MODE_PIN | ||
|
||
#ifndef PICO_RP2040_B0_SUPPORTED | ||
#define PICO_RP2040_B0_SUPPORTED 0 | ||
#endif | ||
|
||
#ifndef PICO_RP2040_B1_SUPPORTED | ||
#define PICO_RP2040_B1_SUPPORTED 0 | ||
#endif | ||
|
||
#ifndef CYW43_PIN_WL_HOST_WAKE | ||
#define CYW43_PIN_WL_HOST_WAKE 24 | ||
#endif | ||
|
||
#ifndef CYW43_PIN_WL_REG_ON | ||
#define CYW43_PIN_WL_REG_ON 23 | ||
#endif | ||
|
||
#ifndef CYW43_WL_GPIO_COUNT | ||
#define CYW43_WL_GPIO_COUNT 3 | ||
#endif | ||
|
||
#ifndef CYW43_WL_GPIO_LED_PIN | ||
#define CYW43_WL_GPIO_LED_PIN 0 | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set(PICO_CYW43_SUPPORTED "1" CACHE INTERNAL "Try to add support for PICO_CYW43") | ||
include(${CMAKE_CURRENT_LIST_DIR}/generic_board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
if (DEFINED ENV{PICO_CYW43_DRIVER_PATH} AND (NOT PICO_CYW43_DRIVER_PATH)) | ||
set(PICO_CYW43_DRIVER_PATH $ENV{PICO_CYW43_DRIVER_PATH}) | ||
message("Using PICO_CYW43_DRIVER_PATH from environment ('${PICO_CYW43_DRIVER_PATH}')") | ||
endif() | ||
|
||
set(CYW43_DRIVER_TEST_FILE "src/cyw43.h") | ||
|
||
if (NOT PICO_CYW43_DRIVER_PATH) | ||
set(PICO_CYW43_DRIVER_PATH ${PICO_SDK_PATH}/lib/cyw43-driver) | ||
if (PICO_CYW43_SUPPORTED AND NOT EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE}) | ||
message(WARNING "cyw43-driver submodule has not been initialized; Pico W wireless support will be unavailable | ||
hint: try 'git submodule update --init' from your SDK directory (${PICO_SDK_PATH}).") | ||
endif() | ||
elseif (NOT EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE}) | ||
message(WARNING "PICO_CYW43_DRIVER_PATH specified but content not present.") | ||
endif() | ||
|
||
if (EXISTS ${PICO_CYW43_DRIVER_PATH}/${CYW43_DRIVER_TEST_FILE}) | ||
message("cyw43-driver available at ${PICO_CYW43_DRIVER_PATH}") | ||
|
||
pico_register_common_scope_var(PICO_CYW43_DRIVER_PATH) | ||
|
||
# base driver without our bus | ||
add_library(cyw43_driver_base INTERFACE) | ||
target_sources(cyw43_driver_base INTERFACE | ||
${PICO_CYW43_DRIVER_PATH}/src/cyw43_ll.c | ||
${PICO_CYW43_DRIVER_PATH}/src/cyw43_stats.c | ||
${PICO_CYW43_DRIVER_PATH}/src/cyw43_lwip.c | ||
${PICO_CYW43_DRIVER_PATH}/src/cyw43_ctrl.c | ||
) | ||
target_include_directories(cyw43_driver_base INTERFACE | ||
${PICO_CYW43_DRIVER_PATH}/src | ||
${PICO_CYW43_DRIVER_PATH}/firmware | ||
) | ||
|
||
# Build the driver for cyw43 for pico w | ||
|
||
# Firmware stuff | ||
set(CYW43_FIRMWARE_BIN 43439A0-7.95.49.00.combined) | ||
string(REGEX REPLACE [\\\.\-] _ CYW43_FIRMWARE_BIN_ ${CYW43_FIRMWARE_BIN}) | ||
string(REGEX MATCH [^_]+_?[^_]*_?[^_]*_?[^_]*_?[^_]* CYW43_FIRMWARE_PRETTY ${CYW43_FIRMWARE_BIN_}) | ||
set(CYW43_FIRMWARE_PRETTY fw_${CYW43_FIRMWARE_PRETTY}) | ||
set(RESOURCE_SECNAME .big_const) | ||
set(RESOURCE_SECFLAGS contents,alloc,load,readonly,data) | ||
set(CYW43_FIRMWARE_OBJ ${CMAKE_CURRENT_BINARY_DIR}/cyw43_resource.o) | ||
|
||
add_custom_target(cyw43_firmware_package DEPENDS ${CYW43_FIRMWARE_OBJ}) | ||
|
||
# cyw43_resource.o contains the WiFi and BT firmware as a binary blob | ||
add_custom_command( | ||
OUTPUT ${CYW43_FIRMWARE_OBJ} | ||
DEPENDS ${PICO_CYW43_DRIVER_PATH}/firmware/${CYW43_FIRMWARE_BIN} | ||
WORKING_DIRECTORY ${PICO_CYW43_DRIVER_PATH}/firmware | ||
COMMAND ${CMAKE_OBJCOPY} -I binary -O elf32-littlearm -B arm | ||
--readonly-text | ||
--rename-section .data=${RESOURCE_SECNAME},${RESOURCE_SECFLAGS} | ||
--redefine-sym _binary_${CYW43_FIRMWARE_BIN_}_start=${CYW43_FIRMWARE_PRETTY}_start | ||
--redefine-sym _binary_${CYW43_FIRMWARE_BIN_}_end=${CYW43_FIRMWARE_PRETTY}_end | ||
--redefine-sym _binary_${CYW43_FIRMWARE_BIN_}_size=${CYW43_FIRMWARE_PRETTY}_size | ||
${CYW43_FIRMWARE_BIN} ${CYW43_FIRMWARE_OBJ} | ||
) | ||
|
||
add_library(cyw43_driver_picow INTERFACE) | ||
target_sources(cyw43_driver_picow INTERFACE | ||
${CMAKE_CURRENT_LIST_DIR}/cyw43_bus_pio_spi.c | ||
) | ||
pico_generate_pio_header(cyw43_driver_picow ${CMAKE_CURRENT_LIST_DIR}/cyw43_bus_pio_spi.pio) | ||
add_dependencies(cyw43_driver_picow INTERFACE cyw43_firmware_package) | ||
target_link_libraries(cyw43_driver_picow INTERFACE | ||
${CYW43_FIRMWARE_OBJ} | ||
) | ||
target_link_libraries(cyw43_driver_picow INTERFACE | ||
cyw43_driver_base | ||
pico_stdlib | ||
hardware_pio | ||
hardware_dma | ||
hardware_exception | ||
) | ||
|
||
pico_promote_common_scope_vars() | ||
endif() |
Oops, something went wrong.