-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add beginnings of software implementation
- Software is based off my wifi pc remote button code, as well as my old SNES STM32 controller converter code for the TinyUSB descriptor. - This code relies on the following upstream PRs: - raspberrypi/pico-sdk#1530 - FreeRTOS/FreeRTOS-Kernel#991 - raspberrypi/pico-sdk#1635
- Loading branch information
Showing
27 changed files
with
3,693 additions
and
2 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
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 @@ | ||
/include/secrets.h | ||
/build |
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,54 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
include(pico_sdk_import.cmake) | ||
include(FreeRTOS_Kernel_import.cmake) | ||
|
||
project(snes_controllers_to_usb) | ||
|
||
pico_sdk_init() | ||
|
||
add_executable(snes_controllers_to_usb | ||
src/main.cpp | ||
src/log.cpp | ||
src/server.cpp | ||
src/network_task.cpp | ||
src/cli_task.cpp | ||
src/FreeRTOS_support.cpp | ||
src/usb_descriptors.c | ||
src/syscalls.cpp | ||
) | ||
|
||
target_link_libraries(snes_controllers_to_usb | ||
pico_cyw43_arch_lwip_sys_freertos | ||
pico_stdlib | ||
pico_rand | ||
FreeRTOS-Kernel-Heap3 | ||
tinyusb_device | ||
tinyusb_board | ||
) | ||
|
||
target_compile_options(snes_controllers_to_usb PRIVATE | ||
$<$<CXX_COMPILER_ID:MSVC>:/W4> | ||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra> | ||
-fstack-usage | ||
-Wno-psabi | ||
) | ||
|
||
target_include_directories(snes_controllers_to_usb PRIVATE | ||
${CMAKE_SOURCE_DIR}/include | ||
) | ||
|
||
target_compile_features(snes_controllers_to_usb PRIVATE | ||
cxx_std_23 | ||
) | ||
|
||
pico_set_printf_implementation(snes_controllers_to_usb compiler) | ||
pico_set_stdio_implementation(snes_controllers_to_usb compiler) | ||
|
||
set_property(TARGET snes_controllers_to_usb PROPERTY CXX_STANDARD 23) | ||
|
||
if (DEFINED HOSTNAME) | ||
add_compile_definitions(CYW43_HOST_NAME=\"${HOSTNAME}\") | ||
endif() | ||
|
||
pico_add_extra_outputs(snes_controllers_to_usb) |
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,61 @@ | ||
# This is a copy of <FREERTOS_KERNEL_PATH>/portable/ThirdParty/GCC/RP2040/FREERTOS_KERNEL_import.cmake | ||
|
||
# This can be dropped into an external project to help locate the FreeRTOS kernel | ||
# It should be include()ed prior to project(). Alternatively this file may | ||
# or the CMakeLists.txt in this directory may be included or added via add_subdirectory | ||
# respectively. | ||
|
||
if (DEFINED ENV{FREERTOS_KERNEL_PATH} AND (NOT FREERTOS_KERNEL_PATH)) | ||
set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH}) | ||
message("Using FREERTOS_KERNEL_PATH from environment ('${FREERTOS_KERNEL_PATH}')") | ||
endif () | ||
|
||
set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2040") | ||
# undo the above | ||
set(FREERTOS_KERNEL_RP2040_BACK_PATH "../../../..") | ||
|
||
if (NOT FREERTOS_KERNEL_PATH) | ||
# check if we are inside the FreeRTOS kernel tree (i.e. this file has been included directly) | ||
get_filename_component(_ACTUAL_PATH ${CMAKE_CURRENT_LIST_DIR} REALPATH) | ||
get_filename_component(_POSSIBLE_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} REALPATH) | ||
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH) | ||
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH) | ||
endif() | ||
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH) | ||
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH) | ||
message("Setting FREERTOS_KERNEL_PATH to ${FREERTOS_KERNEL_PATH} based on location of FreeRTOS-Kernel-import.cmake") | ||
elseif (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../FreeRTOS-Kernel") | ||
set(FREERTOS_KERNEL_PATH ${PICO_SDK_PATH}/../FreeRTOS-Kernel) | ||
message("Defaulting FREERTOS_KERNEL_PATH as sibling of PICO_SDK_PATH: ${FREERTOS_KERNEL_PATH}") | ||
endif() | ||
endif () | ||
|
||
if (NOT FREERTOS_KERNEL_PATH) | ||
foreach(POSSIBLE_SUFFIX Source FreeRTOS-Kernel FreeRTOS/Source) | ||
# check if FreeRTOS-Kernel exists under directory that included us | ||
set(SEARCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) | ||
get_filename_component(_POSSIBLE_PATH ${SEARCH_ROOT}/${POSSIBLE_SUFFIX} REALPATH) | ||
if (EXISTS ${_POSSIBLE_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt) | ||
get_filename_component(FREERTOS_KERNEL_PATH ${_POSSIBLE_PATH} REALPATH) | ||
message("Setting FREERTOS_KERNEL_PATH to '${FREERTOS_KERNEL_PATH}' found relative to enclosing project") | ||
break() | ||
endif() | ||
endforeach() | ||
endif() | ||
|
||
if (NOT FREERTOS_KERNEL_PATH) | ||
message(FATAL_ERROR "FreeRTOS location was not specified. Please set FREERTOS_KERNEL_PATH.") | ||
endif() | ||
|
||
set(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" CACHE PATH "Path to the FreeRTOS Kernel") | ||
|
||
get_filename_component(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") | ||
if (NOT EXISTS ${FREERTOS_KERNEL_PATH}) | ||
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' not found") | ||
endif() | ||
if (NOT EXISTS ${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt) | ||
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' does not contain an RP2040 port here: ${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}") | ||
endif() | ||
set(FREERTOS_KERNEL_PATH ${FREERTOS_KERNEL_PATH} CACHE PATH "Path to the FreeRTOS_KERNEL" FORCE) | ||
|
||
add_subdirectory(${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} FREERTOS_KERNEL) |
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,9 @@ | ||
This software is released under the following licenses: | ||
- GPL v2 or later | ||
- LGPL v2.1 or later | ||
|
||
You should be able to find the text to the GPL v2, GPL v3, LGPL v2.1, and LGPL | ||
v3.0 licenses in the root directory of this repository. | ||
|
||
At the time of this writing all of the available licenses could be found on | ||
https://www.gnu.org/licenses/licenses.html |
Oops, something went wrong.