From 75eb763055739e4a5e5625e273ed4ab6252f0a24 Mon Sep 17 00:00:00 2001 From: Kevin <68612569+diyelectromusic@users.noreply.github.com> Date: Wed, 17 Apr 2024 20:21:18 +0100 Subject: [PATCH] Very early initial support for RPi 5 based on dev branch of circle. (#638) * Very early initial support for RPi 5 based on dev branch of circle. * Added parameter to choose UART option on all RPi versions to be GP14/15 * Build for Raspberry Pi 5 * Update README.md for RPi 5 --------- Co-authored-by: probonopd --- .github/workflows/build.yml | 6 ++++++ README.md | 3 ++- src/config.txt | 6 +++++- src/kernel.cpp | 4 ++++ src/minidexed.cpp | 8 ++++++++ src/serialmididevice.cpp | 6 +++++- src/usbminidexedmidigadget.h | 18 ++++++++++++++++++ submod.sh | 4 ++-- 8 files changed, 50 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56ef1fd..8df5911 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,12 @@ jobs: wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz tar xf *-arm-none-eabi.tar.xz mkdir -p kernels + - name: Build for Raspberry Pi 5 + run: | + set -ex + export PATH=$(readlink -f ./gcc-*aarch64-none*/bin/):$PATH + RPI=5 bash -ex build.sh + cp ./src/kernel*.img ./kernels/ - name: Build for Raspberry Pi 4 run: | set -ex diff --git a/README.md b/README.md index 5c5aca4..e1807bf 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Video about this project by [Floyd Steinberg](https://www.youtube.com/watch?v=Z3 ## System Requirements -- Raspberry Pi 1, 2, 3, 4, or 400 (Zero and Zero 2 can be used but need HDMI or a supported i2s DAC for audio out). On Raspberry Pi 1 and on Raspberry Pi Zero there will be severely limited functionality (only one tone generator instead of 8) +- Raspberry Pi 1, 2, 3, 4, or 400. Raspberry Pi Zero and Zero 2 can be used but need HDMI or a supported i2s DAC for audio out. On Raspberry Pi 1 and on Raspberry Pi Zero there will be severely limited functionality (only one tone generator instead of 8) +- Raspberry Pi 5 can be used but currently support is experimental; HDMI sound and USB Gadget mode are not available yet - A [PCM5102A or PCM5122 based DAC](https://github.com/probonopd/MiniDexed/wiki/Hardware#i2s-dac), HDMI display or [audio extractor](https://github.com/probonopd/MiniDexed/wiki/Hardware#hdmi-to-audio) for good sound quality. If you don't have this, you can use the headphone jack on the Raspberry Pi but on anything but the Raspberry 4 the sound quality will be seriously limited - Optionally (but highly recommended), an [LCDC1602 Display](https://www.berrybase.de/en/sensors-modules/displays/alphanumeric-displays/alphanumerisches-lcd-16x2-gr-252-n/gelb) (with or without i2c "backpack" board) and a [KY-040 rotary encoder](https://www.berrybase.de/en/components/passive-components/potentiometer/rotary-encoder/drehregler/rotary-encoder-mit-breakoutboard-ohne-gewinde-und-mutter) diff --git a/src/config.txt b/src/config.txt index 7957b5c..c10dfa1 100644 --- a/src/config.txt +++ b/src/config.txt @@ -10,7 +10,7 @@ gpu_mem=16 disable_overscan=0 # -# Use 64-bit for RPi 3, 4, 400 and Zero 2, and 32-bit for all other models +# Use 64-bit for RPi 3, 4, 400, 5 and Zero 2, and 32-bit for all other models # [pi3] @@ -24,3 +24,7 @@ kernel=kernel8-rpi4.img # Zero 2 W [pi02] arm_64bit=1 + +[pi5] +arm_64bit=1 +kernel=kernel_2712.img diff --git a/src/kernel.cpp b/src/kernel.cpp index c06c386..3ff835c 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -68,8 +68,12 @@ bool CKernel::Initialize (void) if (m_Config.GetUSBGadgetMode()) { +#if RASPPI==5 +#warning No support for USB Gadget Mode on RPI 5 yet +#else // Run the USB stack in USB Gadget (device) mode m_pUSB = new CUSBMiniDexedMIDIGadget (&mInterrupt); +#endif } else { diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 968320a..e2576b5 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -103,7 +103,11 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, if (pConfig->GetUSBGadgetMode()) { +#if RASPPI==5 + LOGNOTE ("USB Gadget (Device) Mode NOT supported on RPI 5"); +#else LOGNOTE ("USB In Gadget (Device) Mode"); +#endif } else { @@ -128,6 +132,9 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, } else if (strcmp (pDeviceName, "hdmi") == 0) { +#if RASPPI==5 + LOGNOTE ("HDMI mode NOT supported on RPI 5."); +#else LOGNOTE ("HDMI mode"); m_pSoundDevice = new CHDMISoundBaseDevice (pInterrupt, pConfig->GetSampleRate (), @@ -136,6 +143,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, // The channels are swapped by default in the HDMI sound driver. // TODO: Remove this line, when this has been fixed in the driver. m_bChannelsSwapped = !m_bChannelsSwapped; +#endif } else { diff --git a/src/serialmididevice.cpp b/src/serialmididevice.cpp index 883fd4d..b37a498 100644 --- a/src/serialmididevice.cpp +++ b/src/serialmididevice.cpp @@ -28,11 +28,15 @@ LOGMODULE("serialmididevice"); +// There are several UART options - see circle/include/serial.h +// 0 corresponds to GP14/GP15 on all RPi versions. +#define SERIAL_MIDI_DEVICE 0 + CSerialMIDIDevice::CSerialMIDIDevice (CMiniDexed *pSynthesizer, CInterruptSystem *pInterrupt, CConfig *pConfig, CUserInterface *pUI) : CMIDIDevice (pSynthesizer, pConfig, pUI), m_pConfig (pConfig), - m_Serial (pInterrupt, TRUE), + m_Serial (pInterrupt, TRUE, SERIAL_MIDI_DEVICE), m_nSerialState (0), m_nSysEx (0), m_SendBuffer (&m_Serial) diff --git a/src/usbminidexedmidigadget.h b/src/usbminidexedmidigadget.h index bbb5f44..8513549 100644 --- a/src/usbminidexedmidigadget.h +++ b/src/usbminidexedmidigadget.h @@ -22,6 +22,23 @@ #ifndef _usbminidexedmidigadget_h #define _usbminidexedmidigadget_h +#if RASPPI==5 +#include +#include + +#warning No support for USB Gadget Mode on RPI 5 yet +class CUSBMiniDexedMIDIGadget +{ +public: + CUSBMiniDexedMIDIGadget (CInterruptSystem *pInterruptSystem) + { + } + + ~CUSBMiniDexedMIDIGadget (void) + { + } +}; +#else #include #include #include @@ -82,5 +99,6 @@ protected: return CUSBMIDIGadget::GetDescriptor(wValue, wIndex, pLength); } }; +#endif #endif diff --git a/submod.sh b/submod.sh index 2e24228..d72d19c 100755 --- a/submod.sh +++ b/submod.sh @@ -6,13 +6,13 @@ git submodule update --init --recursive # # Use fixed master branch of circle-stdlib then re-update cd circle-stdlib/ -git checkout 695ab4a +git checkout 3bd135d git submodule update --init --recursive cd - # # Optional update submodules explicitly cd circle-stdlib/libs/circle -git checkout fe09c4b +git checkout 4b3e06f cd - cd circle-stdlib/libs/circle-newlib #git checkout develop