Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/*
.vscode/*
.DS_Store
CMakeUserPresets.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "lib/tusb_ump"]
path = lib/tusb_ump
url = git@github.com:midi2-dev/tusb_ump.git
[submodule "lib/CMSIS_5"]
path = lib/CMSIS_5
url = git@github.com:ARM-software/CMSIS_5.git
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ if(WIN32)
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.2.0)
set(toolchainVersion 14_2_Rel1)
set(picotoolVersion 2.2.0-a4)
set(sdkVersion 2.3.0)
set(toolchainVersion 15_2_Rel1)
set(picotoolVersion 2.3.0)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
# ====================================================================================
set(PICO_BOARD pico CACHE STRING "Board type")

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.13)

#############################################
# Pull in Pico SDK (must be before project)
Expand All @@ -37,8 +37,8 @@ project(AmeNote C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.1")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.1 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
if (PICO_SDK_VERSION_STRING VERSION_LESS "2.0.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 2.0.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()

set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR})
Expand Down
47 changes: 47 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"binaryDir": "${sourceDir}/build",
"generator": "Ninja",
"cacheVariables": {
"PICO_BOARD": "pico"
}
},
{
"name": "release",
"displayName": "Release (Ninja)",
"description": "Default CLI/CI build. Requires PICO_SDK_PATH (and PICO_TOOLCHAIN_PATH, unless the toolchain is on PATH) to be set in the environment.",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "debug",
"displayName": "Debug (Ninja)",
"description": "Debug build with symbols and no optimization.",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
{
"name": "release",
"configurePreset": "release"
},
{
"name": "debug",
"configurePreset": "debug"
}
]
}
2 changes: 1 addition & 1 deletion ProtoZOA_Main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.13)

project(ProtoZOA_Main)

Expand Down
2 changes: 1 addition & 1 deletion ProtoZOA_PicoProbe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.13)

include(pico_sdk_import.cmake)

Expand Down
80 changes: 64 additions & 16 deletions ProtoZOA_PicoProbe/pico_sdk_import.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()

# Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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}')")
Expand All @@ -18,9 +40,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 @@ -29,25 +62,40 @@ if (NOT PICO_SDK_PATH)
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 ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
endif ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
)

if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Populate(
pico_sdk
QUIET
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE

SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
)
else ()
FetchContent_Populate(
pico_sdk
QUIET
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}

SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-src
BINARY_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-build
SUBBUILD_DIR ${FETCHCONTENT_BASE_DIR}/pico_sdk-subbuild
)
endif ()

set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,39 @@ This git has the following sub directories:
|:----------|:----------|
| ProtoZOA_Main | Code and build for the Main Pico on ProtoZOA - the one soldered onto main board. |
| ProtoZOA_PicoProbe | Code and build for the PicoProbe utility from Raspberry configured for use on ProtoZOA development board. Can be loaded onto either Main or UUT Pico. See [User Manual](doc/UserManual) for more information. |
| ProtoZOA_UUT | Code and build for the UUT (Unit Under Test) Pico on ProtoZOA - the one on connectors. |
| UUT | Code and build for the UUT (Unit Under Test) Pico on ProtoZOA - the one on connectors. |
| UUT_FreeRTOS | UUT variants built on FreeRTOS (e.g. USB MIDI Echo, general FreeRTOS task examples). |
| lib | Dependencies pulled in as git submodules (CMSIS_5, FreeRTOS-Kernel, ni-midi2, AM_MIDI2.0Lib, tusb_ump). |
| doc | ProtoZOA support documentation. |
| CMakeLists.txt | cmake build support file |
| CMakeLists.txt | Top-level cmake build file. |
| CMakePresets.json | CLI/CI/IDE-agnostic configure & build presets (`cmake --preset release`). |
| Contribution.md | Contribution agreement |
| License.md | License agreement |
| README.md | This file. |
| pico_sdk_import.cmake | SDK connection file for Pico development |

## Building

This project targets [Raspberry Pi Pico SDK](https://github.com/raspberrypi/pico-sdk) **2.3.0** with ARM GNU Toolchain **15_2_Rel1**, and requires **CMake 4.x** (SDK 2.3.0's linker-script system relies on a `target_link_options(... "LINKER:-L...")` mechanism that CMake 3.x fails to translate correctly for `copy_to_ram` binaries such as `ProtoZOA_Main` and `picoprobe` -- you'll see a `cannot open linker script file section_platform_end.incl` link error if you build with CMake < 4).

1. Clone with submodules (submodule URLs are SSH -- make sure you have an SSH key configured for GitHub):
```
git clone --recursive git@github.com:midi2-dev/AmeNote_Protozoa.git
```
or, if already cloned:
```
git submodule update --init --recursive
```
2. Either:
- **VS Code**: install the official [Raspberry Pi Pico VS Code extension](https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico) and use it to install SDK 2.3.0 / toolchain 15_2_Rel1, then open the folder and build via the extension's CMake/Build commands, or
- **CLI / other IDEs (CLion, etc.)**: install the Pico SDK and ARM GNU toolchain yourself, set `PICO_SDK_PATH` (and `PICO_TOOLCHAIN_PATH`, unless the toolchain is on `PATH`) in your environment, then:
```
cmake --preset release
cmake --build --preset release
```
See [CMakePresets.json](CMakePresets.json) for the available presets (`release`, `debug`).
3. See [Developer Guide](doc/DeveloperGuide) for more detail.

## MIDI Association ([www.midi.org](http://www.midi.org))
ProtoZOA is part of the offering from the MIDI Association towards their mission for corporate members to:
- Develop and enhance MIDI to respond to new market needs
Expand Down
4 changes: 2 additions & 2 deletions UUT/CME_WIDI_CORE_EXP/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main()
uint32_t umpCount;
if (ump_n_available) {
uint8_t mVersion = tud_alt_setting(0) +1 ;
if ((umpCount = tud_ump_read(0, UMPpacket, 4))) {
if ((umpCount = tud_ump_read_ntoh(0, UMPpacket, 4))) {
switch (umpCount) {
case 1:
printf("MIDI %d UMP 0x%08x \n", mVersion, UMPpacket[0]);
Expand Down Expand Up @@ -106,7 +106,7 @@ int main()
CME2UMP.bytestreamParse(ch);
while (CME2UMP.availableUMP()) {
uint32_t ump = CME2UMP.readUMP();
tud_ump_write(0, &ump, 1);
tud_ump_write_hton(0, &ump, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions UUT/CME_WIDI_CORE_EXP/usb_descriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ static midi2_cs_interface_desc_group_terminal_blocks_n_t(2) group_terminal_block
{
.header = {
.bLength = 5,
.bDescriptorType = MIDI_CS_INTERFACE_GR_TRM_BLOCK,
.bDescriptorType = MIDI_1_CS_INTERFACE_GR_TRM_BLOCK,
.bDescriptorSubType = MIDI_GR_TRM_BLOCK_HEADER,
.wTotalLength = sizeof(group_terminal_blocks_desc)
},
.aBlock = {
// 5-PIN DIN In Function Block
{
.bLength = 13,
.bDescriptorType = MIDI_CS_INTERFACE_GR_TRM_BLOCK,
.bDescriptorType = MIDI_1_CS_INTERFACE_GR_TRM_BLOCK,
.bDescriptorSubType = MIDI_GR_TRM_BLOCK,
.bGrpTrmBlkID = 1,
.bGrpTrmBlkType = 0x02, // OUT Group Terminals only
Expand All @@ -466,7 +466,7 @@ static midi2_cs_interface_desc_group_terminal_blocks_n_t(2) group_terminal_block
// 5-PIN DIN Out Function Block
{
.bLength = 13,
.bDescriptorType = MIDI_CS_INTERFACE_GR_TRM_BLOCK,
.bDescriptorType = MIDI_1_CS_INTERFACE_GR_TRM_BLOCK,
.bDescriptorSubType = MIDI_GR_TRM_BLOCK,
.bGrpTrmBlkID = 2,
.bGrpTrmBlkType = 0x01, // IN Group Terminals only
Expand Down
Loading