Skip to content

Commit

Permalink
Updates for SDK 2.0.0; no need for SDK patching for cyw
Browse files Browse the repository at this point in the history
  • Loading branch information
polpo committed Aug 22, 2024
1 parent 319a8a6 commit 9cb2a8e
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 25 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ jobs:
runs-on: ubuntu-22.04
env:
BUILD_TYPE: "Release"
PICOSDK_VER: "1.5.1"
PICOEXTRA_VER: "sdk-1.5.1"
PICOSDK_VER: "2.0.0"
PICOEXTRA_VER: "sdk-2.0.0"
# The Pico-SDK will listen to these environment vars
PICOTOOL_FETCH_FROM_GIT_PATH: ${{github.workspace}}/pico/picotool
PICO_SDK_PATH: ${{github.workspace}}/pico/pico-sdk
PICO_EXTRAS_PATH: ${{github.workspace}}/pico/pico-extras
OUTPUT_DIR: ${{github.workspace}}/binaries
Expand All @@ -20,7 +21,7 @@ jobs:
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '13.2.Rel1'
release: '13.3.Rel1'

# Since we reference stable versions of Pico-SDK and pico-extras, we can cache their downloads.
# If this were to reference changing branches (like "master"), this caching step must be removed!!!
Expand Down Expand Up @@ -50,7 +51,7 @@ jobs:
run: cmake -E make_directory ${{github.workspace}}/build

- name: Patch Pico SDK to allow LTO
run: sed -i 's/WRAPPER_FUNC(x) __wrap_/WRAPPER_FUNC(x) __attribute__((used)) __wrap_/' ${{env.PICO_SDK_PATH}}/src/rp2_common/pico_platform/include/pico/platform.h
run: sed -i 's/WRAPPER_FUNC(x) __wrap_/WRAPPER_FUNC(x) __attribute__((used)) __wrap_/' ${{env.PICO_SDK_PATH}}/src/rp2_common/pico_platform_compiler/include/pico/platform/compiler.h

- name: Build Mega Firmware
shell: bash
Expand Down
11 changes: 7 additions & 4 deletions sw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

cmake_minimum_required(VERSION 3.13)

set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR})
set(PICO_BOARD pico_w)
set(PICO_COPY_TO_RAM 1)

# Initialise pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
Expand All @@ -22,10 +25,6 @@ set(CMAKE_CXX_STANDARD 17)

include(pico_extras_import.cmake)

set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR})
set(PICO_BOARD PICO_W)
set(PICO_COPY_TO_RAM 1)

# Tell the Pico SDK to use our local tinyusb instead of the one included in the SDK
# This is needed to support tusb_xinput
set(PICO_TINYUSB_PATH ${CMAKE_CURRENT_LIST_DIR}/tinyusb)
Expand Down Expand Up @@ -322,13 +321,17 @@ function(build_ne2000 TARGET_NAME MULTIFW)
target_compile_definitions(${TARGET_NAME} PRIVATE
NE2000=1
PICOW=1
# CYW43_RESOURCE_ATTRIBUTE="__in_flash()"
CYW43_CONFIG_FILE="cyw43_firmware.h"
CYW43_PIO_CLOCK_DIV_INT=3
)
target_sources(${TARGET_NAME} PRIVATE
ne2000play.cpp
)
target_link_libraries(
${TARGET_NAME}
ne2000
pico_cyw43_arch_none
)
endfunction()

Expand Down
1 change: 1 addition & 0 deletions sw/flash_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "flash_settings.h"
#include "hardware/flash.h"
#include "hardware/sync.h"
#include "hardware/clocks.h"
#include "pico/stdlib.h"
#include "pico/flash.h"

Expand Down
16 changes: 8 additions & 8 deletions sw/ne2000/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ target_sources(ne2000 INTERFACE
)

target_link_libraries(ne2000 INTERFACE
# pico_cyw43_arch_none
pico_cyw43_arch_poll
pico_cyw43_arch_none
# pico_cyw43_arch_poll
)
target_compile_definitions(pico_cyw43_arch_poll_headers INTERFACE
CYW43_LWIP=0
)
target_compile_definitions(ne2000 INTERFACE
CYW43_LWIP=0
)
# target_compile_definitions(pico_cyw43_arch_poll_headers INTERFACE
# CYW43_LWIP=0
# )
# target_compile_definitions(ne2000 INTERFACE
# CYW43_LWIP=0
# )

2 changes: 2 additions & 0 deletions sw/ne2000/ne2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ char WIFI_SSID[33];
char WIFI_KEY[63];
*/

uint16_t pbuf_copy_partial(const struct pbuf *p, void *dataptr, uint16_t len, uint16_t offset) {}


#define CYW43_LINK_DOWN (0) ///< link is down
#define CYW43_LINK_JOIN (1) ///< Connected to wifi
Expand Down
2 changes: 1 addition & 1 deletion sw/ne2000play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void play_ne2000() {
break;
}
}
cyw43_arch_poll();
/* cyw43_arch_poll(); */
/*
if (((time_us_32() >> 21) & 0x1) == 0x1) {
if (flag == false) {
Expand Down
12 changes: 6 additions & 6 deletions sw/pico_extras_import.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ if (NOT PICO_EXTRAS_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_EXTRAS_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
FetchContent_Declare(
PICO_EXTRAS
pico_extras
GIT_REPOSITORY https://github.com/raspberrypi/pico-extras
GIT_TAG master
)
if (NOT PICO_EXTRAS)
message("Downloading PICO EXTRAS")
FetchContent_Populate(PICO_EXTRAS)
set(PICO_EXTRAS_PATH ${PICO_EXTRAS_SOURCE_DIR})
if (NOT pico_extras)
message("Downloading Raspberry Pi Pico Extras")
FetchContent_Populate(pico_extras)
set(PICO_EXTRAS_PATH ${pico_extras_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
Expand All @@ -59,4 +59,4 @@ endif ()

set(PICO_EXTRAS_PATH ${PICO_EXTRAS_PATH} CACHE PATH "Path to the PICO EXTRAS" FORCE)

add_subdirectory(${PICO_EXTRAS_PATH} pico_extras)
add_subdirectory(${PICO_EXTRAS_PATH} pico_extras)
1 change: 1 addition & 0 deletions sw/pico_reflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <stdio.h>
#include <hardware/flash.h>
#include "hardware/clocks.h"
#include "pico/multicore.h"
#include "pico/stdlib.h"

Expand Down
15 changes: 13 additions & 2 deletions sw/pico_sdk_import.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()

if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
endif ()

if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
endif()

set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")

if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
Expand All @@ -34,14 +45,14 @@ if (NOT PICO_SDK_PATH)
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
)
endif ()

Expand Down

0 comments on commit 9cb2a8e

Please sign in to comment.