ER-301 Emulator for Linux and macOS

It’s early times for the newly released emulator so I expect some hiccups. Please post here your questions about and problems with the emulator.

3 Likes

Any reason the emulator shouldn’t work on Ubuntu running on VirtualBox in a Win 10 host?

If you can play audio from your VirtualBox then it should be good to go. The emulator is built on SDL2.

2 Likes

Yes, all good on Ubuntu 20.1 inside of Oracle VirtualBox on Win10. Instructions were good. I have the emulator running and making sound, core package installed.

Not really sure on the next steps to begin creating a package for middle layer.

8 Likes

Ooh, this looks very interesting. I am going to give this a go. I do everything on Linux any way. Lets see if I can get this to run on Fedora.

1 Like

This is probably due to my linux skills having a couple of decades worth of rust on them. But I am failing on the test your build environment step. It seems to be complaining about a file which I think it there…

Tip for anyone planning to go this VirtualBox/Ubuntu route. VirtualBox suggests a HDD size of 10Gb for Ubuntu. Go bigger. I ran out of space installing the TI SDK and had to jump through some extra hoops to grow the drive. Guessing 20Gb is probably plenty.

1 Like

I wonder if this will play nicely with the Windows Subsystem for Linux and an X server. It works with some GUI applications (I’ve only used emacs and the gnome terminal that way). It looks like it’s possible to set up PulseAudio as well.

I’m guessing it can all be made to work without too much effort.

1 Like

How about OS X? I’ll get a pi and make my own if necessary

On debian 10 (aka buster aka stable), make emu apparently works, but the subsequent testing/linux/emu/emu.elf ./xroot ~/.od/rear ~/.od/front fails.

Here is the command output:

I took care of manually installing lua 5.4.2 thinking the 5.3 version available in debian repos might be too old.
Also the ~/.od folder is not created.
Wrinting this makes me think that maybe it is the version of glibc / gcc which is too old on debian stable. Oh well, i’ll fire up a qemu vm, that’s easy enough.

(ps. should we file issues on github or post here ?)

Awesome work, Brian.
I just compiled it on Fedora 33.
I just needed to find a few packages. The names were different than on Ubuntu.
For those that interested.
# dnf install fftw-devel SDL2-devel SDL2_ttf-devel swig zip python3
And if you don’t already have the development tools do this. I didn’t need this part.
# dnf groupinstall "Development Tools"

After that, follow the steps from the git repo to compile.

2 Likes

What happens when you execute that particular path-to-g++ yourself?

Request: let’s copy and paste terminal history instead of screen shots, so we can select portions when needed. You can quote terminal dumps like this:

```bash
cd tmp
```

Becomes

cd tmp

I get the same error message when I execute that path myself. I probably should have noted that the TI SDK installer gives an error message before it finishes so this may have something to do with it.

image

After this error it takes me to a dialogue with a Finish button.

EDIT: OK, looks like the problem is that the file in question is a 32-bit executable trying to run on a 64-bit system without proper support for that.

file arm-none-eabi-g++
arm-none-eabi-g++: ELF 32-bit LSB executable, Intel 80386, version 9 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.8, stripped

Found the solution here, installing libc6-i386 via apt.

I was able to compile both core and teletype now.

So if my package does not yet include any compiled code, only Lua (as in Accents), is there a rough guide on how to run this in the emulator and eventually create a package?

1 Like

I’m pretty sure you can ignore that warning. I’ve had it too and it refers to a portion of the SDK that we don’t use here.

Please try installing this:

sudo apt install gcc-multilib

And then see if you can execute the compiler.

1 Like

That’s what I suspected. What you did is fine but. I believe installing ‘gcc-multilib’ is just the more generic/canned way to solve the issue.

I would first take care of these renamed API:

SYSTEM: Unit:createObject(type, name, …) → Unit:addObject(name, o)
SYSTEM: Unit:createMonoBranch → Unit:addMonoBranch
SYSTEM: Unit:createStereoBranch → Unit:addStereoBranch
SYSTEM: Unit:onLoadMenu → Unit:onShowMenu
SYSTEM: Object:optionSet → Object:setOptionValue

Pick a unit in mods/core/assets and follow as an example. Note that some C++ objects will reside in the ‘app’ module while others will reside in the ‘core.libcore’ module. This is because the majority of the Units and their required Objects were moved out of the firmware and into the separate core library (or mod). For example, in LimiterUnit.lua we see objects being created like this:

  local inGain = self:addObject("inGain", app.ConstantGain())
  local outGain = self:addObject("outGain", app.ConstantGain())
  local limiter = self:addObject("limiter", libcore.Limiter())

The ConstantGain object is obtained from the ‘app’ module, while the Limiter object is obtained from the libcore.so shared library packaged with the core mod. The require at the top of the LimiterUnit.lua file gets you access to it:

local libcore = require "core.libcore"

This is also how other Unit developers can use the C++ objects that you package with your library.

1 Like

Got it. Removed libc6-i386 and installed gcc-multilib, and can still compile!

So let’s say I want to take the simplest one and try to get it working. Let’s assume I make all of the reference changes correctly (possibly a bold assumption :slight_smile: ).

What’s a good place for me to place the lua file? What do I need to do to turn it into a package that can be installed via the emulator? Or do I even have the workflow paradigm right?

You have it right! :wink: Here is what the teletype package looks like:

clarkson@gimli:~/.../testing/am335x/mods$ unzip -l teletype-0.6.00.pkg
Archive:  teletype-0.6.00.pkg
  Length      Date    Time    Name
---------  ---------- -----   ----
     1267  2021-02-04 14:55   CV.lua
     1317  2021-02-04 14:55   TR.lua
     2990  2021-02-17 12:41   init.lua (IGNORE)
      367  2021-02-10 17:36   toc.lua (used to be init.lua before v0.6)
   124606  2021-03-01 15:38   libteletype.so (IGNORE)
---------                     -------
   130547                     5 files

You can ignore the *.so and init.lua files. What used to be in your init.lua file is now in the toc.lua (table-of-contents). So in conclusion,

  1. Rename your init.lua to toc.lua.
  2. Zip all your lua files together.
  3. Rename the zip file to something like accents-0.6.00.pkg

Extra Credit: If you enjoy reading makefiles (:laughing:) there is also the scripts/mod-builder.mk which handles the entire process of compiling and packaging lua and C/C++ code together. It is called by the teletype.mk makefile.

1 Like

That seems straightforward enough! I’ll see how far I can get.

Ha, yes, definitely after I get some baby steps under my belt. Literally it has been 30 years since I’ve touched gcc or makefile!

Is your machine named after a famous dwarf by chance? :slight_smile:

If you are using vscode, perhaps these will be of use?

.vscode/launch.json

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "gdb emu",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/testing/linux/emu/emu.elf",
      "args": ["${workspaceFolder}/xroot", "~/.od/rear", "~/.od/front"],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "compile emu",
      "miDebuggerPath": "/usr/bin/gdb"
    }
  ]
}

.vscode/tasks.json

{
  "tasks": [
    {
      "label": "compile emu",
      "type": "shell",
      "command": "make emu -j8",
      "presentation": {
        "reveal": "always",
      },
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ],
  "version": "2.0.0"
}

Once you have vscode properly setup, you can just press F5 to start the emulator in gdb with full stack traces and the ability to CTRL click on error messages for quick code navigation.

All of my machines are named after characters from a certain set of novels written in the 50’s. Gandalf is getting pretty old and clunky. Might be time to replace him.

2 Likes

Those scripts will definitely be helpful! Thank you!

How is the encoder on the emulator supposed to work. I was using my mouse scroll wheel but it seemed pretty coarse. Is there a modifier key?

Not so easy to get rid of Gandalf. Even shadow and flame only took him out temporarily. :joy: