Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c32f50a
Update CMakeLists.txt
DatanoiseTV Aug 12, 2024
1bb19e1
Add RP235x support (untested).
DatanoiseTV Aug 19, 2024
dcd5b93
Switch VultDSP to floating point operation.
DatanoiseTV Aug 19, 2024
964bfaf
Switch to pico-sdk fork with RP235x PicoADK support (temporary)
DatanoiseTV Aug 19, 2024
4bb4dd3
Change Pico Platform to ARM.
DatanoiseTV Aug 19, 2024
61d8c43
Use float/fixed based on the platform used.
DatanoiseTV Aug 19, 2024
41b05cf
Conditional Vult Platform-specific fixes.
DatanoiseTV Aug 19, 2024
e5eec8e
Add barebones template.
DatanoiseTV Sep 13, 2024
fe71053
Minor code optimization.
DatanoiseTV Sep 13, 2024
7cde60e
Improve USB MIDI Implementation.
DatanoiseTV Sep 13, 2024
1e337fc
Prepare MIDI Host support.
DatanoiseTV Sep 13, 2024
a73eb6b
Add breaking changes and try to get PD/HVCC running.
DatanoiseTV Sep 16, 2024
5ea5c62
fix tusb error
CarloCattano Oct 12, 2024
2f5b831
added noteon , noteoff and cc
CarloCattano Oct 12, 2024
c0a62bb
added noteon , noteoff and cc
CarloCattano Oct 12, 2024
b9eb745
64 samples update
CarloCattano Oct 12, 2024
ecb4881
Merge pull request #26 from CarloCattano/RP235x-PD
DatanoiseTV Oct 12, 2024
5ff39c2
Update Heavy CMakeLists.txt to use a wildcard.
DatanoiseTV Oct 12, 2024
6722033
Add docs/hvcc.md for tracking todo's
CarloCattano Oct 12, 2024
633f191
Add docs/hvcc.md for tracking todo's
CarloCattano Oct 12, 2024
adfe054
Add TLSF for PSRAM allocator.
Oct 13, 2024
3240820
Add precompiled audio lib, add target for prebuilding libs.
Oct 13, 2024
327df27
Add linker script for PSRAM. Add PSRAM allocation code.
Oct 13, 2024
6b029ba
Update midi_input_usb.h
DatanoiseTV Oct 13, 2024
206ea66
Add rudimentary MIDI Clock support
DatanoiseTV Oct 13, 2024
14d6aaf
Merge pull request #28 from DatanoiseTV/RP235x-PD-MidiClock
DatanoiseTV Oct 13, 2024
1ba5a2a
MIDI clock takes no args.
DatanoiseTV Oct 13, 2024
97297ad
Merge remote-tracking branch 'upstream/RP235x-PD' into RP235x-PD
CarloCattano Oct 13, 2024
188a1ff
Fixes reverting testing psram and tusb conditional
CarloCattano Oct 13, 2024
bfb9680
Fixes reverting testing psram and tusb conditional
CarloCattano Oct 13, 2024
dec49f4
Trying midi clock RT
CarloCattano Oct 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ build/*
*.bin
*.elf
.vscode
.DS_Store
compile_commands.json
tags
.cache
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@
[submodule "lib/vult"]
path = lib/vult
url = https://github.com/vult-dsp/vult.git
[submodule "lib/FreeRTOS-Kernel"]
path = lib/FreeRTOS-Kernel
url = https://github.com/raspberrypi/FreeRTOS-Kernel.git
[submodule "lib/pico-sdk"]
path = lib/pico-sdk
url = https://github.com/DatanoiseTV/pico-sdk
[submodule "lib/usb_midi_host"]
path = lib/usb_midi_host
url = https://github.com/rppicomidi/usb_midi_host
[submodule "lib/tlsf"]
path = lib/tlsf
url = https://github.com/earlephilhower/tlsf.git
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"cmake.buildBeforeRun": true,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"nrf-connect.topdir": "/home/syso/dev/ztry",
"nrf-connect.toolchain.path": "PATH"
"nrf-connect.toolchain.path": "PATH",
"files.associations": {
"__locale": "cpp"
}
}
172 changes: 111 additions & 61 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,78 +1,76 @@
# PicoADK CMakeLists.txt

cmake_minimum_required(VERSION 3.13)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)

# Add option for using precompiled libraries
option(USE_PRECOMPILED_LIBS "Use precompiled libraries for audio and pico-sdk" OFF)

set(PICO_EXTRAS_PATH "../lib/pico-extras")
set(PICO_BOARD datanoisetv_rp2350_dsp)
set(PICO_PLATFORM "rp2350-arm-s")
set(FREERTOS_KERNEL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/FreeRTOS-Kernel")

if (USE_PRECOMPILED_LIBS)
set(PICO_SDK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/precompiled/pico-sdk")
else()
set(PICO_SDK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/pico-sdk")
endif()

# Define values for the placeholders
set(FLASH_LENGTH 4M) # Example value for FLASH length
set(PSRAM_LENGTH 8M) # Example value for PSRAM length
set(RAM_LENGTH 520K) # Example value for RAM length
set(EEPROM_START 0x1FFF000) # Example EEPROM start address
set(FS_START 0x08080000) # Example file system start address
set(FS_END 0x080C0000) # Example file system end address

set(DSP_SAMPLE_RATE 48000)

# Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake)
include(pico_extras_import.cmake)

set(PICO_BOARD datanoisetv_rp2040_dsp)

set(FREERTOS_SRC_DIRECTORY "${PICO_SDK_PATH}/lib/tinyusb/lib/FreeRTOS-Kernel")

add_library(FreeRTOS STATIC
${FREERTOS_SRC_DIRECTORY}/event_groups.c
${FREERTOS_SRC_DIRECTORY}/list.c
${FREERTOS_SRC_DIRECTORY}/queue.c
${FREERTOS_SRC_DIRECTORY}/stream_buffer.c
${FREERTOS_SRC_DIRECTORY}/tasks.c
${FREERTOS_SRC_DIRECTORY}/timers.c
${FREERTOS_SRC_DIRECTORY}/portable/MemMang/heap_3.c
${FREERTOS_SRC_DIRECTORY}/portable/GCC/ARM_CM0/port.c
)

target_include_directories(FreeRTOS PUBLIC
${FREERTOS_CFG_DIRECTORY}/
${FREERTOS_SRC_DIRECTORY}/include
${FREERTOS_SRC_DIRECTORY}/portable/GCC/ARM_CM0
)

include(FreeRTOS_Kernel_import.cmake)

project(main C CXX ASM)

pico_sdk_init()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR} ".")

add_subdirectory(lib/audio)
add_subdirectory(lib/oled)
if (USE_PRECOMPILED_LIBS)
add_library(audio STATIC IMPORTED)
set_target_properties(audio PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/precompiled/audio.a")
else()
add_subdirectory(lib/audio)
endif()

message("CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
message("CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")

# Generate Vult C++ code from Vult Code every time
set(VULT_EXAMPLE_PATH "${CMAKE_CURRENT_LIST_DIR}/lib/vult/examples")
add_custom_command(
OUTPUT ALL ${CMAKE_CURRENT_BINARY_DIR}/vult.cpp
COMMAND vultc ${CMAKE_CURRENT_LIST_DIR}/vultsrc/dsp.vult
-i ${VULT_EXAMPLE_PATH}/osc
-i ${VULT_EXAMPLE_PATH}/util
-i ${VULT_EXAMPLE_PATH}/filters
-i ${VULT_EXAMPLE_PATH}/env
-i ${VULT_EXAMPLE_PATH}/midi
-i ${VULT_EXAMPLE_PATH}/effects
-i ${VULT_EXAMPLE_PATH}/units
-ccode
-real fixed
-samplerate 44140
-o vult
COMMENT "Transcompiling Vult DSP Code to C++."
)
add_subdirectory(lib/oled)
add_subdirectory(lib/heavy)

# Set the real flag based on the PICO_PLATFORM variable
if (DEFINED PICO_PLATFORM AND PICO_PLATFORM STREQUAL "rp2350-arm-s")
set(REAL_TYPE_FLAG "float")
message("Using float for real type")
else()
set(REAL_TYPE_FLAG "fixed")
message("Using fixed for real type")
endif()

if (NOT FREERTOS_KERNEL_PATH AND NOT DEFINED ENV{FREERTOS_KERNEL_PATH})
message("Skipping FreeRTOS examples as FREERTOS_KERNEL_PATH not defined")
return()
endif()

add_executable(main
vultsrc/dsp.vult
src/usb_descriptors.c
src/main.cpp
src/picoadk_hw.cpp
src/vultin.cpp
src/midi_input_usb.cpp
src/get_serial.c
${CMAKE_CURRENT_BINARY_DIR}/vult.cpp)
# src/psram.cpp
lib/FreeRTOS-Kernel/portable/MemMang/heap_3.c
)

pico_set_program_name(main "main")
pico_set_program_version(main "0.1")
Expand All @@ -84,7 +82,8 @@ pico_enable_stdio_usb(main 0)
target_link_libraries(main pico_stdlib)

# Add any user requested libraries
target_link_libraries(main
if (USE_PRECOMPILED_LIBS)
target_link_libraries(main
hardware_adc
hardware_spi
hardware_i2c
Expand All @@ -94,24 +93,72 @@ target_link_libraries(main
hardware_timer
hardware_watchdog
hardware_clocks
hardware_sync_spin_lock
hardware_sync
pico_unique_id
pico_bootsel_via_double_reset
pico_util_buffer
pico_multicore
pico_stdio_uart
tinyusb_device
tinyusb_host
tinyusb_board
Audio
#Oled
FreeRTOS
)
audio
FreeRTOS-Kernel
heavy
)
else()
target_link_libraries(main
hardware_adc
hardware_spi
hardware_i2c
hardware_dma
hardware_pio
hardware_interp
hardware_timer
hardware_watchdog
hardware_clocks
hardware_sync_spin_lock
hardware_sync
pico_unique_id
pico_bootsel_via_double_reset
pico_util_buffer
pico_multicore
pico_stdio_uart
tinyusb_device
tinyusb_host
tinyusb_board
Audio
FreeRTOS-Kernel
heavy
)
endif()

target_compile_definitions(main PRIVATE
USE_AUDIO_I2S=1
USE_AUDIO_I2S=1
PICO_USE_SW_SPIN_LOCKS=1
USE_USB_MIDI_HOST=0
SAMPLE_RATE=${DSP_SAMPLE_RATE}
RP2350_PSRAM_CS=0
)

target_compile_definitions(Audio PRIVATE
SAMPLE_RATE=${DSP_SAMPLE_RATE}
)

# # Configure the linker script with actual values
# configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/default.ld.in # Input template file
# ${CMAKE_CURRENT_BINARY_DIR}/default.ld # Output linker script file
# @ONLY # Use only @var@ style placeholders
# )

# Set the linker script to use the custom default.ld
# pico_set_linker_script(main ${CMAKE_CURRENT_BINARY_DIR}/default.ld)


target_link_options(main PRIVATE
-Xlinker --print-memory-usage
-Xlinker --print-memory-usage
)

file(GLOB files "${CMAKE_CURRENT_LIST_DIR}/piosrc/*.pio")
Expand All @@ -122,9 +169,12 @@ endforeach()

add_compile_options("-Wall" "-Wredundant-decls")

pico_define_boot_stage2(slower_boot2 ${PICO_DEFAULT_BOOT_STAGE2_FILE})
target_compile_definitions(slower_boot2 PRIVATE PICO_FLASH_SPI_CLKDIV=4)

pico_set_boot_stage2(main slower_boot2)
if (PICO_PLATFORM STREQUAL "rp2040")
pico_define_boot_stage2(slower_boot2 ${PICO_DEFAULT_BOOT_STAGE2_FILE})
target_compile_definitions(slower_boot2 PRIVATE PICO_FLASH_SPI_CLKDIV=4)
pico_set_boot_stage2(main slower_boot2)
else()
message("Skipping slower_boot2 as PICO_PLATFORM is not rp2040")
endif()

pico_add_extra_outputs(main)
70 changes: 70 additions & 0 deletions FreeRTOS_Kernel_import.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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 ()

if(PICO_PLATFORM STREQUAL "rp2040")
set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2040")
else()
if (PICO_PLATFORM STREQUAL "rp2350-riscv")
set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2350_RISC-V")
else()
set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2350_ARM_NTZ")
endif()
endif()

# 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 a '${PICO_PLATFORM}' 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)
Loading
Loading