-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit f586e5a
Showing
11 changed files
with
914 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# GitHub Action to automate the identification of common misspellings in text files. | ||
# https://github.com/codespell-project/actions-codespell | ||
# https://github.com/codespell-project/codespell | ||
name: codespell | ||
on: [push, pull_request] | ||
jobs: | ||
codespell: | ||
name: Check for spelling errors | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: codespell-project/actions-codespell@master | ||
with: | ||
check_filenames: true | ||
check_hidden: true | ||
skip: ./.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: CMake | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
build: | ||
# The CMake configure and build commands are platform agnostic and should work equally | ||
# well on Windows or Mac. You can convert this to a matrix build if you need | ||
# cross-platform coverage. | ||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: Install dependencies | ||
run: sudo apt update && sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential libzopfli-dev | ||
|
||
- name: Clone pico-sdk | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: raspberrypi/pico-sdk | ||
ref: 1.1.2 | ||
path: pico-sdk | ||
clean: false | ||
submodules: 'true' | ||
|
||
- name: Create Build Environment | ||
# Some projects don't allow in-source building, so create a separate build directory | ||
# We'll use this as our working directory for all subsequent commands | ||
run: cmake -E make_directory ${{github.workspace}}/build | ||
|
||
- name: Configure CMake | ||
# Use a bash shell so we can use the same syntax for environment variable | ||
# access regardless of the host operating system | ||
shell: bash | ||
working-directory: ${{github.workspace}}/build | ||
# Note the current convention is to use the -S and -B options here to specify source | ||
# and build directories, but this is only available with CMake 3.13 and higher. | ||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | ||
run: PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk cmake $GITHUB_WORKSPACE/src | ||
|
||
- uses: ammaraskar/gcc-problem-matcher@master | ||
|
||
- name: Build | ||
working-directory: ${{github.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk cmake --build . --config $BUILD_TYPE | ||
|
||
- name: Save artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: rp2040-dongle | ||
path: ${{github.workspace}}/build/*.uf2 | ||
|
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 @@ | ||
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,3 @@ | ||
[submodule "lib/heatshrink"] | ||
path = lib/heatshrink | ||
url = https://github.com/kripton/heatshrink.git |
Large diffs are not rendered by default.
Oops, something went wrong.
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,26 @@ | ||
# rp2040-compressiontest: Benchmark of different compression algorithms on the rp2040 | ||
|
||
### Building from source | ||
|
||
This project uses the usual toolchain for the RP2040-based projects. You will | ||
need a (cross-)compiler for the ARM Cortex M0 and the pico-sdk. For details | ||
how you can achieve this on your system, please refer to | ||
https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdf | ||
|
||
Basically, once all requirements are met, run: | ||
``` | ||
mkdir build | ||
cd build | ||
cmake ../src | ||
make | ||
``` | ||
This should result in a file called `rp2040-compressiontest.uf2` that can be copied to the Pico when it's in bootloader-mode. | ||
|
||
## License | ||
|
||
This source code, schematics and board layouts is licensed under the GPL. | ||
|
||
Parts taken and modified from TinyUSB (`tusb_config.h`, `usb_descriptors.c`) is: | ||
|
||
* The MIT License (MIT) | ||
* Copyright (c) 2019 Ha Thach (tinyusb.org) |
Submodule heatshrink
added at
bd2952
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,40 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
|
||
## pico_sdk_import.cmake is copied from | ||
## https://github.com/raspberrypi/pico-sdk/blob/master/external/pico_sdk_import.cmake | ||
include(pico_sdk_import.cmake) | ||
|
||
## Give the baby a name. Will also be the name of the resulting binaries | ||
project(rp2040-compressiontest) | ||
|
||
## Init the pico-sdk. Will instruct the user what to do if deps are missing | ||
pico_sdk_init() | ||
|
||
## Include the CMakeLists-files of (non-pico-sdk)-libraries we will be using | ||
include(../lib/heatshrink/CMakeLists.txt) | ||
|
||
## Add our own C/C++ files here | ||
## Sorted alphabetically | ||
add_executable(${CMAKE_PROJECT_NAME} | ||
${TINYUSB_LIBNETWORKING_SOURCES} | ||
main.c | ||
) | ||
|
||
## Needed so tusb_config.h is found by the tinyUSB-library included in the pico-sdk | ||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE | ||
${CMAKE_CURRENT_LIST_DIR} | ||
) | ||
|
||
## Pull in all pico-sdk + non-pico-sdk libraries | ||
## Sorted alphabetically | ||
target_link_libraries(${CMAKE_PROJECT_NAME} | ||
heatshrink | ||
pico_stdlib | ||
) | ||
|
||
## enable usb output, disable uart output | ||
pico_enable_stdio_usb(${CMAKE_PROJECT_NAME} 1) | ||
pico_enable_stdio_uart(${CMAKE_PROJECT_NAME} 0) | ||
|
||
## Create map/bin/hex/uf2 file etc. | ||
pico_add_extra_outputs(${CMAKE_PROJECT_NAME}) |
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,19 @@ | ||
/** | ||
* SPDX-License-Identifier: GPL-3.0 | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include "pico/stdlib.h" | ||
|
||
#include "picotool_binary_information.h" | ||
|
||
int main() { | ||
// Overclock the board to 250MHz. According to | ||
// https://www.youtube.com/watch?v=G2BuoFNLo this should be | ||
// totally safe with the default 1.10V Vcore | ||
//set_sys_clock_khz(250000, true); | ||
|
||
// Enable the USB console | ||
stdio_usb_init(); | ||
|
||
}; |
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,62 @@ | ||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake | ||
|
||
# This can be dropped into an external project to help locate this SDK | ||
# It should be include()ed prior to project() | ||
|
||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) | ||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) | ||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") | ||
endif () | ||
|
||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) | ||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) | ||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") | ||
endif () | ||
|
||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) | ||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) | ||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") | ||
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") | ||
|
||
if (NOT PICO_SDK_PATH) | ||
if (PICO_SDK_FETCH_FROM_GIT) | ||
include(FetchContent) | ||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) | ||
if (PICO_SDK_FETCH_FROM_GIT_PATH) | ||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") | ||
endif () | ||
FetchContent_Declare( | ||
pico_sdk | ||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk | ||
GIT_TAG master | ||
) | ||
if (NOT pico_sdk) | ||
message("Downloading Raspberry Pi Pico SDK") | ||
FetchContent_Populate(pico_sdk) | ||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) | ||
endif () | ||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) | ||
else () | ||
message(FATAL_ERROR | ||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." | ||
) | ||
endif () | ||
endif () | ||
|
||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") | ||
if (NOT EXISTS ${PICO_SDK_PATH}) | ||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") | ||
endif () | ||
|
||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) | ||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) | ||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK") | ||
endif () | ||
|
||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) | ||
|
||
include(${PICO_SDK_INIT_CMAKE_FILE}) |
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,10 @@ | ||
#ifndef PICOTOOL_BINARY_INFORMATION_H | ||
#define PICOTOOL_BINARY_INFORMATION_H | ||
|
||
#include "pico/binary_info.h" | ||
|
||
bi_decl(bi_program_name("rp2040-compressiontest")); | ||
bi_decl(bi_program_description("Benchmark different compression algorithms on the rp2040")); | ||
bi_decl(bi_program_url("https://github.com/kripton/rp2040-compressiontest")); | ||
|
||
#endif // PICOTOOL_BINARY_INFORMATION_H |