electro-smith / oopsy

gen~ to Daisy: exporting Max Gen patchers for the ElectroSmith Daisy hardware platforms
MIT License
121 stars 27 forks source link

Firmware not loading from oopsy on windows. #46

Closed grabanton closed 3 years ago

grabanton commented 3 years ago

Hello! I have some troubles with loading examples on my daisy patch from max on windows machine. I'll write down the entire sequence of actions:

First, I installed all the necessary toolchain on my machine, as it was written in the instructions in daisyWiki. I added all the necessary paths to my PATH environment variable. Next I cloned oopsy repo from github and I tried to run the install.sh And I got error:

image

Then I opened the script and executed the commands line by line. But the make file was always running with an error 127:

image

335 line in makefile:

image

I checked the contents of the build folder and a large number of files appeared there.

image

Then I decided to try to run the project from the example. Opened the reverb.maxpat patch. I put Daisy in boot loader mode, made sure that the computer sees DFU in FS Mode.

image

Then I clicked on the bang and everything seemed to run without errors, but the loading into the module did not occur. There are no warnings or errors. Just nothing.

image

The firmware files appeared on the disk

image

From web browser all works correctly. I tried many examples from your site and they all loaded and worked. I really hope that you will help me quickly solve this problem, as I planned to use the module soon. Thanks!

grabanton commented 3 years ago

image

grabanton commented 3 years ago

image

grabanton commented 3 years ago

I try understand what happens in oopsy code, and I found some strange thing: After generation part, must be exist reverb.bin file in source folder, but there is no such file there.

image

image

grabanton commented 3 years ago

I extracted the commands that oopsy runs when building the program. I tried to run the first one in the terminal. I run it from the same folder as in build_path (as in oopsy.js : execSync(line, { cwd: build_path }).toString()) and got error:

anton@anton_desktop /cygdrive/c/Users/anton/Documents/Max 8/Packages/oopsy/source/build_reverb_patch/build
$ arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H750xx -DUSE_HAL_DRIVER -DHSE_VALUE=16000000 -DSTM32H750xx -I../libdaisy -I../libdaisy/src/ -I../libdaisy/src/usbd -I../libdaisy/Drivers/CMSIS/Include/ -I../libdaisy/Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../libdaisy/Drivers/STM32H7xx_HAL_Driver/Inc/ -I../libdaisy/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../libdaisy/core/ -I  -O3 -Wall -Wno-missing-attributes -fasm -fdata-sections -ffunction-sections -MMD -MP -MF"build/system_stm32h7xx.d" -I"../gen_dsp" -O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -std=gnu11 -Wa,-a,-ad,-alms=build/system_stm32h7xx.lst ../libdaisy/core/system_stm32h7xx.c -o build/system_stm32h7xx.o
arm-none-eabi-gcc.exe: error: ../libdaisy/core/system_stm32h7xx.c: No such file
or directory
arm-none-eabi-gcc.exe: fatal error: no input files
compilation terminated.
grabanton commented 3 years ago

There is such a file there

image

grrrwaaa commented 3 years ago

I'm not really sure what's happening here, but something seems to be very wrong from the start -- the error message in running ./install.sh is confusing -- but if that part isn't working then it won't work from Max.

I'm hoping @stephenhensley can chime in here as he's worked a lot on the toolchain installation and particularly the Windows workflow.

stephenhensley commented 3 years ago

Hi @grabanton sorry to hear you're experiencing issues.

Thank you for all of the detail above, it is certainly helpful.

The version of Make used throughout the ecosystem was recently changed in the wiki, but that doesn't seem to explain all of the issues you're seeing. We are looking into this now, and actually are wrapping up a new (much simpler) toolchain installation process for windows.

I had not previously tested using cygwin for anything, and generally suggest people use git-bash, or similar.

However, when attempting to run this from cygwin I can replicate the initial errors you were seeing when running the install script, and am able to resolve it by running: dos2unix.exe install.sh from the oopsy directory.

Once you're able to confirm that your oopsy/source/libdaisy/build/ directory contains a file called, libdaisy.a, it should be possible for you to navigate to the generated project folder (i.e. oopsy/source/build_reverb_patch/) and run make.

That should create the binary file that you noted was missing.

Once you have confirmed that you can manually build that file, it would be worth attempting to do so from Max/MSP.

As soon as we have an update on the new toolchain installation, I will chime back here as well. That way if the above doesn't work, we can at least all be using the same set of tools to try to resolve the issue.

Hope that helps!

grabanton commented 3 years ago

The version of Make used throughout the ecosystem was recently changed in the wiki, but that doesn't seem to explain all of the issues you're seeing. We are looking into this now, and actually are wrapping up a new (much simpler) toolchain installation process for windows.

Thank you, @stephenhensley! And which version of make is correct? In the wiki, it is suggested to put cygwin (by the way, there is no make by default, I had to add it when re-installing and several versions are available there) https://github.com/electro-smith/DaisyWiki/wiki/1c.-Installing-the-Toolchain-on-Windows

image

grabanton commented 3 years ago

I decided to do everything from the beginning. I deleted the folder with oopsy, reinstalled cygwin, added the latest version of make and dos2unix just in case. I tried to do everything via git-bash as you suggested. But make can't run from git-bash (( I was looking for duplicates of cygwin1.dll as it is written in the error, but it is only one... The reboot also did not give any results.

anton@anton_desktop MINGW64 ~/Documents/Max 8/Packages
$ git clone https://github.com/electro-smith/oopsy.git
Cloning into 'oopsy'...
remote: Enumerating objects: 1287, done.
remote: Counting objects: 100% (693/693), done.
remote: Compressing objects: 100% (413/413), done.
remote: Total 1287 (delta 503), reused 444 (delta 269), pack-reused 594
Receiving objects: 100% (1287/1287), 510.18 KiB | 1.03 MiB/s, done.
Resolving deltas: 100% (925/925), done.

anton@anton_desktop MINGW64 ~/Documents/Max 8/Packages
$ cd oopsy

anton@anton_desktop MINGW64 ~/Documents/Max 8/Packages/oopsy (main)
$ ./install.sh
/c/Users/anton/Documents/Max 8/Packages/oopsy
get submodules
Submodule 'source/libdaisy' (https://github.com/electro-smith/libDaisy.git) registered for path 'source/libdaisy'
Cloning into 'C:/Users/anton/Documents/Max 8/Packages/oopsy/source/libdaisy'...
Submodule path 'source/libdaisy': checked out '7e578bb13e80ecc406df01543116f46790ad3386'
rebuilding everything. . .
only errors, and warnings will output. . .
-------------------
rebuilding libdaisy
      1 [main] make (12276) C:\cygwin64\bin\make.exe: *** fatal error - cygheap base mismatch detected - 0x18034C408/0x180357408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
      0 [main] make (11584) C:\cygwin64\bin\make.exe: *** fatal error - cygheap base mismatch detected - 0x18034C408/0x180357408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
done building libdaisy

Then I tried to do it through cygwin. I converted install.sh in the unix format. And launched it. But unfortunately it failed again. Make stumbles again on line 330. In the ./source/libdaisy/build folder at this time there are much fewer files and only one folder with drivers. Naturally libdaisy.a there isn't.

anton@anton_desktop /cygdrive/c/Users/anton/Documents/Max 8/Packages/oopsy
$ dos2unix.exe install.sh
dos2unix: converting file install.sh to Unix format...

anton@anton_desktop /cygdrive/c/Users/anton/Documents/Max 8/Packages/oopsy
$ ./install.sh
/cygdrive/c/Users/anton/Documents/Max 8/Packages/oopsy
get submodules
rebuilding everything. . .
only errors, and warnings will output. . .
-------------------
rebuilding libdaisy
make: *** [Makefile:330: build/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_dma.o] Error 127
make: *** Waiting for unfinished jobs....
make: *** [Makefile:330: build/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_dma2d.o] Error 127
make: *** [Makefile:330: build/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_delayblock.o] Error 127
done building libdaisy

As I understand it, error 127 means that make could not find the specified path? And apparently the problem is the same as it was when I ran the command generated by oopsy.js and it could not find the files?

I am sitting with this for the second day and I am very sad that I have not made any progress in solving this problem (((

stephenhensley commented 3 years ago

Hi @grabanton sorry to hear that that didn't work out well.

I believe I had originally tested windows on oopsy with the GnuWin32 version of make. This was the version originally documented in the wiki.

We are working on wrapping up the simpler toolchain for windows. The repo is now public and contains the binaries for all of the windows tools, along with an install.bat file that will add the appropriate entry to your PATH variable. We will be updating the wikis as soon as we've finished double checking everything, but I suspect this may get you up and running.

I recommend doing any testing/verification using the git-bash terminal.


To gleam a bit more information about the errors (should you still get them), can you navigate directly to the oopsy/source/libdaisy directory (or right click and select the "Git bash here" option in the file explorer), and run the make command there.

Sorry you're having such a rough time. We are aware of some of the issues with getting everything up and running on windows, and are actively trying to make it better.

grabanton commented 3 years ago

Great! It works! I removed everything I installed before, removed the paths from the environment variables, cloned the DaisyToolchain repository, and ran install.bat. After that, I opened oopsy/install.sh in git-bash, and it ran without errors for the first time! After that, I successfully compiled and uploaded the reverb patch from the oopsy examples. Everything works perfectly! @stephenhensley thank you very much for your help!

grabanton commented 3 years ago

I'm trying to upload different patches. In general, everything is fine, but periodically there is a situation that the device in the boot loader mode is no longer detected by the system. Only a PC reboot helps. Between reboots, I manage to upload 2-4 patches. Upd. I use another usb port and everything is fine now.

stephenhensley commented 3 years ago

Glad to hear that the new toolchain worked out well, and that a different USB port seems to be working for you.

I've noticed that occasionally Windows will reset the driver of the Daisy, but it's usually closer to once a day or week in frequency, and can be resolved without rebooting the PC.

You should be able to use Zadig to set the Driver back to WinUSB.