Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed compilation when using Midi Stream Player with RP2040/2350 #57

Open
nyh-workshop opened this issue Oct 3, 2024 · 3 comments
Open

Comments

@nyh-workshop
Copy link

nyh-workshop commented Oct 3, 2024

From git commit: #5656b69 and onwards

System used: Raspberry Pico 2 RP2350 (ARM Cortex M4F cores selected)

Hi Marcel Licence,
When I'm compiling a sample application ML Synth Example in Arduino, I encountered many compilation errors such as:

In file included from c:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/ml_inline.h:53,
                 from E:\pico-projects-2024\ml_synth_fm_example\ml_inline.ino:32:
c:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h: In function 'uint8_t MIDI_open(const char*, const char*)':
c:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:177:24: error: no matching function for call to 'fs::FS::begin(bool)'
  177 |     if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED))
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\yongh\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\4.1.1\libraries\LittleFS\src/LittleFS.h:29,
                 from E:\pico-projects-2024\ml_synth_fm_example\ml_synth_fm_example.ino:76:
C:\Users\yongh\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\4.1.1\cores\rp2040/FS.h:198:10: note: candidate: 'bool fs::FS::begin()'
  198 |     bool begin();
      |          ^~~~~
C:\Users\yongh\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\4.1.1\cores\rp2040/FS.h:198:10: note:   candidate expects 0 arguments, 1 provided
c:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h: In function 'void MidiStreamPlayer_ListFiles(uint8_t)':
c:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:545:32: error: no matching function for call to 'fs::FS::begin(bool)'
  545 |             if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED))
      |                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\yongh\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\4.1.1\cores\rp2040/FS.h:198:10: note: candidate: 'bool fs::FS::begin()'
  198 |     bool begin();
      |          ^~~~~
C:\Users\yongh\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\4.1.1\cores\rp2040/FS.h:198:10: note:   candidate expects 0 arguments, 1 provided

In the midi_stream_player it does not seem to contain any LittleFS specific includes for RP2040/2350.

I have manually modified this midi_stream_player.h to include the LittleFS.h and it gives the same error, unfortunately.

Do you have examples of the midi stream player that is working for RP2040/2350? So far it works on the ESP32.

@nyh-workshop
Copy link
Author

nyh-workshop commented Oct 3, 2024

There are even more undefined references if I took out the parameter in the LittleFs.begin. When I looked closely it seems that the begin for the RP2040/2350 do not take any parameters. So I tried removing this in the MIDI_open:

static uint8_t MIDI_open(const char *path, const char *mode)
{
    if (!LittleFS.begin())
    {
        Serial.println("LITTLEFS Mount Failed");
        return 0;
    }

Compile Output:

C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\AppData\Local\Temp\arduino_build_440122\sketch\ml_synth_fm_example.ino.cpp.o: in function `_Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch':
C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:356:(.text._Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch+0x38): undefined reference to `_Z21midi_file_stream_loadPcP11midi_proc_s'
C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:360:(.text._Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch+0x50): undefined reference to `_Z16interpret_uint16Ph'
C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:376:(.text._Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch+0x64): undefined reference to `_Z26MidiStreamReadTrackPrepareP11midi_proc_s'
C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:380:(.text._Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch+0x76): undefined reference to `_Z29MidiStreamReadSingleEventTimeP11midi_proc_sPl'
C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:364:(.text._Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch+0x86): undefined reference to `_Z20MidiStreamParseTrackP11midi_proc_s'
C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:372:(.text._Z42MidiStreamPlayer_PlayMidiFile_fromLittleFSPch+0xc6): undefined reference to `_Z19MidiStreamSkipTrackP11midi_proc_s'
C:/Users/yongh/AppData/Local/Arduino15/packages/rp2040/tools/pqt-gcc/4.0.1-8ec9d6f/bin/../lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/bin/ld.exe: C:\Users\yongh\AppData\Local\Temp\arduino_build_440122\sketch\ml_synth_fm_example.ino.cpp.o: in function `_Z21MidiStreamPlayer_Tickm':
C:\Users\yongh\OneDrive\Documents\Arduino\libraries\ML_SynthTools\src/midi_stream_player.h:504:(.text._Z21MidiStreamPlayer_Tickm+0xe): undefined reference to `_Z16interpret_uint16Ph'

Suspected that these functions are not compiled into the RP2040/2350 archive library file (such as libML_SynthTools_RP2040.a). I have scanned the ESP32 ones and they have these inside.

@marcel-licence
Copy link
Owner

Hello, thank you very much for your message. I will check this soon. I've created this fs/... files to be able to have one interface with different ports for the different platforms. I think I should update the stream player to use this interface to avoid a bunch of changes in case a platform changes.

@marcel-licence
Copy link
Owner

I've updated the implementation now using the fs implementation which might be a bit more future proof. The rp2350 implementation needs some more work because I got some trouble with linking some libs. The new rp2040 board library works a bit different and this causes trouble with some code.
libML_SynthTools_RP2040.a -> must be moved one folder up to be found
This might break other projects accidentality try to link code from the lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants