C++ Programming for Lich...where to start?

I’m new to the Lich, but not to DSP using C++.
(I’ve written VST plugins and worked on Arduino code, and been programming since forever, so may be a bit of a learning curve)

My aim is to write some stuff for the Lich using C++.
First planned project is to create a “is the Lich working?” patch to troubleshoot all the hardware, and to end up with a documented example to share which will show how to access the hardware from C++ code.

Any help would be much appreciated

I’m on Windows.
I found https://github.com/pingdynasty/OwlProgram (which doesn’t include Lich in it’s list of supported devices) Looks like the right place to be though.

There I find:
“On Windows, you’ll need a MAKE utility [7]. You’ll also need to open compile.mk and point TOOLROOT to your gcc installation directory, using a path string without spaces (such as using 8.3 filenames).”

That leads to a download for MinGW, and the first question.Which packages do I need to install?
(I’ve guessed MSYS for MinGW, Basic MinGW and the C++ option)

I’ve downloaded the code from https://github.com/pingdynasty/OwlProgram#ref7

I’ve seen the recommendation to edit compile.mk (which I’ve found in the downloaded code) .
…and presumably I need to edit the line

TOOLROOT ?= Tools/gcc-arm-none-eabi-9-2020-q2-update/bin/

so I think # need removing as it means ‘comment’
…but what is “?=” (guess, check for existence and warn if not there)

so following instructions without knowing better that’s
…which looks kind of wrong

so am I right so far, and what do I do next?

I’m thinking compile the CppTest example, but I’m stuck for the next step.

That would be anything that runs OWL firmware. What you’re looking at is the software side that is loaded dynamically and runs your patch code.

You should build static libraries once with “make libs”, this would give you an error if emscripten (emcc) for building web versions of patches is not installed (it’s not a problem in this case). Then you can build patches with something like “make clean load” and any extra options that is described in README file.

I hope you haven’t missed the C++ OWL docs that explain patch API basics and OwlProgram API docs.

Also, you can use patch library for building patches online instead of doing it locally, it may be easier to get started this way if you have problems with setup on Windows.

1 Like

Thanks for your response.
Much appreciated, I’d really like to crack this and get on to creating something worthwhile for the Lich.
I’m afraid that I’m not yet far enough along the “makefile” learning curve to make sense of it.
It can’t be difficult, I just need a couple of pointers.
Unfortunately I simply don’t know how to “build static libraries once with “make libs””
Or how to run “make clean load”.

I get what they do, first compile all the stuff which isn’t going to be edited during development, then actually compile the code being worked on. I just don’t know what kind of user interface should be used. Command line?

I have seen those docs, nothing wrong with them they just don’t cater for a raw beginner to work in that environment. I just need an example to get me on the right track.

I’ll have a go at the online thing, looks like fun. Would like to yet it running locally though.

i.e. just pointing to the installation folder for MinGW

No, this has nothing to do with MinGW itself. TOOLROOT is a variable that points to location where your ARM GCC compiler is installed. Readme files already explains that:

On Windows, you'll need a MAKE utility [7]. You'll also need to open compile.mk
and point TOOLROOT to your gcc installation directory, using a path string without
spaces (such as using 8.3 filenames).

So at the very least I would expect it to end with something like gcc-arm-none-eabi-9-2020-q2-update/bin/ (exact version may differ). It should contain various compiler toolchain executables, I imagine that would be something like arm-none-eabi-gcc.exe on Windows.

OK, thanks for that I think I’m getting somewhere now.

well that reference [7] leads to a download of MinGW, which has an executable named make.exe within it. MinGW is “A native Windows port of the GNU Compiler Collection (GCC)”
…and I installed it to C:\MinGW.

So question 1 is, was that needed?

So “gcc installation directory” means, 'directory containing something that may look like “arm-none-eabi-gcc.exe”.
I don’t think I have that.

All I have is the MinGW/MSYS installation and the OwlProgram-develop collection from github.

Question 2 is “What else do I need from that list when on Windows”?
(I’m only interested in C++)

Like the Readme says, you need GCC ARM compiler. It’s a separate software project and should be installed for building patches that will run on OWL.

MinGW includes only x86 version of GCC. But you will use other GNU tools that MinGW installs (make command among them). This is all described in makefile format and you don’t have to figure it out how it works - just run a commands or two to rebuild patches or libraries. It’s also possible to use x86 version of GCC to build native executables if you’ll want to troubleshoot code later.

You’ll also need FirmwareSender executable to convert patch binaries into sysex format and send to device. There’s a binary release of older version on github, it might still work. Otherwise you’ll have to built it too (or maybe @mars can make builds of newer release for Win/Mac)

OK, thanks again…progress(sorry it’s slow)…so far.

I’m going to document for anyone who reads the thread.
ARM GCC compiler downloaded from

…be careful, default location for installation is in Program Files folder, that’s no good because it contains space characters.
I put it in C:\GNUArm for simplicity

C:\GNUArm\bin is now location of arm-none-eabi-gcc.exe

I’ve edited compile.mk so the TOOLROOT variable points to those ( i think, not seen absolute address elsewhere in compile.mk)

TOOLROOT ?= C:/GNUArm/bin/

I have the FirmwareSender.exe executable downloaded (no installation)

So what’s the next step?
“issue the appropriate make command”? …how?
the only make.exe I see is in the MinGW

No worries, I think you’re almost there.

So you can’t run this in windows shell as it won’t see APIs provided by MinGW/MSYS. A part of MSYS is bash shell, so you should launch bash.exe and that should let you run commands for building everything (make and friends).

There might be some shortcut installed for running bash or there are a few terminal emulators you could use to run bash, but this is optional.

thanks for persisting
OK I found Bash.exe in MinGW.
It opens a console.
It runs make but can’t find “makefile” (not surprising)

I made a shortcut for bash.exe so I could run it from the folder with the compile.mk in it.

From bash I can then run make and I assume it finds “makefile” as that error is gone.

It then produces a lot of line numbers and says they have syntax errors.

Well it sounds like you can run “make libs” now to build static libraries (ignoring errors caused by emcc not installed) and then build/upload patches as the README file describes.

Well, yes, something happens, and I appear to have the prerequisites in place (in not necessarily configured).

I can run make lib, but
All I get is a list of syntax errors.
(and the same if I just run make)

but then I don’t really know what I’m doing.

The problem is with the term “run”.
What method do I use to run it, and where in the directory structure do I run it from?

Using Bash seems to be no different to using command prompt (in terms of result)

(in other news EMCC install and activate seemed to go ok, and the OpenWareLab docs for how the C++ code works are looking good)

Runs means literally type in terminal for bash to execute. So in case of “make libs”, “make” is the command and “libs” is the target that is defined in makefile. Naturally you should be running this from OwlProgram root.

So what are you trying to run and what’s the error you get?

Thanks again.
Yes, if “OwlProgram Root” is the location of compile.mk (etc.) then that’s indeed where I’m running it from.
I start the bash console (with shortcut edited to use that location) and type make libs.
I get a list of error messages, mostly “syntax error”.
Exactly the same happens if I just run make lib from the DOS Prompt.

If I run from a different location I get the response “can’t find makefile”
I just checked, and if I remove the file “makefile” from the folder then make won’t find it.
So make is looking at that “makefile” file and seeing syntax errors.
…but opening ‘makefile’ doesn’t reveal anything that looks like a syntax error.
(first 4 error of syntax reported on lines 4,5,7,9,

I would suggest to post output of “make libs” here, it’s not clear what the actual error is.

Also, if you’re not using OwlProgram from develop branch, it may be better to do that. And make sure to install git submodules like README instructs.

bash.exe"-3.1$ make libs
MAKE Version 5.4 Copyright (c) 1987, 2010 Embarcadero Technologies, Inc.
Error makefile 4: Command syntax error
Error makefile 5: Command syntax error
Error makefile 7: Command syntax error
Error makefile 9: Command syntax error
Error makefile 10: Command syntax error
Error makefile 12: Command syntax error
Error makefile 14: Command syntax error
Error makefile 19: Command syntax error
Error makefile 25: Command syntax error
Error makefile 31: Command syntax error
Error makefile 37: Command syntax error
Error makefile 43: Command syntax error
Error makefile 49: Command syntax error
Error makefile 51: Command syntax error
Error makefile 53: Command syntax error
Error makefile 56: Command syntax error
Error makefile 60: Command syntax error
Error makefile 65: Command syntax error
Error makefile 79: Command syntax error
Error makefile 80: Command syntax error
Error makefile 81: Command syntax error
Error makefile 82: Command syntax error
Error makefile 83: Command syntax error
Error makefile 84: Command syntax error
Error makefile 92: Colon expected
Error makefile 93: Command syntax error
Error makefile 94: Command syntax error
Error makefile 95: Command syntax error
*** 28 errors during make ***

OK, there’s the error messages ^

I think issue is that the bash is picking up a different make executable that is on the windows system paths, while the one that’s at C:\MinGW\msys\1.0\bin .is hidden. Although bash is located also in C:\MinGW\msys\1.0\bin I’m running it from OwlProgram-develop.
So bash can’t see the correct version of make.exe

This is why I had real doubts about the setup working, because there are different elements of the system in completely different directory structures.

I’ve tried to follow the readme, but I don’t think it’s intended as a cookbook for Windows installation.

Yes, that’s wrong “make” apparently, you should see something like this from version prompt (make -v):

$ make -v
GNU Make 4.3
...other stuff

I think you need to modify PATH variable to something like this:

Yes it’s not heavily used on Windows. An alternative is to use Windows Subsystem for Linux, this basically gives you a virtualized Linux kernel and necessary software, so you would be able to follow instructions intended for Linux. That’s in theory, I don’t know if anyone used it with OWL (but I’ve heard WSL2 works quite well).

I think that’s not the make that is installed with ming. Look for ming32-make.exe, ie try
ming32-make libs
You might have to give a full absolute path to ming32-make or add the ming bin directory to your path.

Thanks again, progress at last.

Text from bash console.
Yes, it was picking up a different version of make, connected with Delphi.
with comments

bash.exe"-3.1$ make -v
MAKE Version 5.4 Copyright (c) 1987, 2010 Embarcadero Technologies, Inc.

the one I want is here

bash.exe"-3.1$ C:/MinGW/msys/1.0/bin/make -v
GNU Make 3.81

some time later…tell bash where it is (and also the other stuff it needs)
the " are needed .

bash.exe"-3.1$ export PATH=“C:\MinGW\msys\1.0\bin”

check that PATH is now correctly defined

bash.exe"-3.1$ export
declare -x !::="::\"
declare -x ALLUSERSPROFILE=“C:\ProgramData”
declare -x APPDATA=“C:\Users\Andy\AppData\Roaming”
declare -x COMMONPROGRAMFILES=“C:\Program Files (x86)\Common Files”
declare -x COMMONPROGRAMFILES(X86)=“C:\Program Files (x86)\Common Files”
declare -x COMMONPROGRAMW6432=“C:\Program Files\Common Files”
declare -x COMSPEC=“C:\WINDOWS\system32\cmd.exe”
declare -x FP_NO_HOST_CHECK=“NO”
declare -x HOMEDRIVE=“C:”
declare -x HOMEPATH="\"
declare -x IBREDISTDIR=“C:\Users\Public\Documents\InterBase\redist\InterBa
declare -x LOCALAPPDATA=“C:\Users\Andy\AppData\Local”
declare -x LOGONSERVER="\\ANDY-PC"
declare -x OLDPWD
declare -x OS=“Windows_NT”
declare -x PATH=“C:\MinGW\msys\1.0\bin”
declare -x PROCESSOR_ARCHITEW6432=“AMD64”
declare -x PROCESSOR_IDENTIFIER=“Intel64 Family 6 Model 58 Stepping 9, GenuineIn
declare -x PROCESSOR_LEVEL=“6”
declare -x PROCESSOR_REVISION=“3a09”
declare -x PROGRAMDATA=“C:\ProgramData”
declare -x PROGRAMFILES=“C:\Program Files (x86)”
declare -x PROGRAMFILES(X86)=“C:\Program Files (x86)”
declare -x PROGRAMW6432=“C:\Program Files”
declare -x PSMODULEPATH=“C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
declare -x PUBLIC=“C:\Users\Public”
declare -x PWD="/c/OwlProgram-develop/OwlProgram-develop"
declare -x SESSIONNAME=“Console”
declare -x SHLVL=“1”
declare -x SYSTEMDRIVE=“C:”
declare -x TEMP="/tmp"
declare -x TERM=“cygwin”
declare -x TMP="/tmp"
declare -x USERDOMAIN=“Andy-PC”
declare -x USERNAME=“Andy”
declare -x USERPROFILE=“C:\Users\Andy”
declare -x VS120COMNTOOLS=“C:\Program Files (x86)\Microsoft Visual Studio 12.0
declare -x VS80COMNTOOLS=“C:\Program Files (x86)\Microsoft Visual Studio 8\Co
declare -x WINDIR=“C:\WINDOWS”

now see if it actually works…it does

bash.exe"-3.1$ make libs
/bin/sh: emcc: command not found
make[1]: *** [Build/web/ColourScreenPatch.o] Error 127
make: *** [libs] Error 2

So that’s as you predicted, just an error for emcc

EMCC is installed though, so would be good to get that working.

I put FirmwareSender.exe in the OwlProgram-develop\Tools firectory,
because “Makefile” has the following line in it

FIRMWARESENDER ?= Tools/FirmwareSender

Yeah it looks like emcc is installed somewhere not on the PATH variable and it’s not visible to bash and make. It’s ok because you only need it to build web versions of patches that can run in the browser.

You can check contents of Libraries directory, if it has those 2 files then the libraries are built: libdaisysp.a and libowlprg.a. As your error only mentioned lack of emcc, they should be there.

You could run something like make clean load PATCHNAME=Awesome to build a patch from PatchSource/AwesomePatch.hpp . This would load patch into memory and the README describes how to store them on device and other targets defined in Makefile. So I think you could try running actual code now.